FS-2855 Fix spidermonkey under windows x64

This commit is contained in:
Jeff Lenk 2010-11-17 15:39:33 -06:00
parent 180f58a677
commit 4d41a0f3a2
3 changed files with 129 additions and 78 deletions

View File

@ -77,6 +77,7 @@
**
***********************************************************************/
#ifdef WIN32
/* These also work for __MWERKS__ */
# define JS_EXTERN_API(__type) extern __declspec(dllexport) __type
# define JS_EXPORT_API(__type) __declspec(dllexport) __type
@ -86,26 +87,15 @@
# define JS_DLL_CALLBACK
# define JS_STATIC_DLL_CALLBACK(__x) static __x
#elif defined(WIN16)
#elif defined(XP_OS2) && defined(__declspec)
#ifdef _WINDLL
#define JS_EXTERN_API(__type) extern __type _cdecl _export _loadds
#define JS_EXPORT_API(__type) __type _cdecl _export _loadds
#define JS_EXTERN_DATA(__type) extern __type _export
#define JS_EXPORT_DATA(__type) __type _export
# define JS_EXTERN_API(__type) extern __declspec(dllexport) __type
# define JS_EXPORT_API(__type) __declspec(dllexport) __type
# define JS_EXTERN_DATA(__type) extern __declspec(dllexport) __type
# define JS_EXPORT_DATA(__type) __declspec(dllexport) __type
#define JS_DLL_CALLBACK __cdecl __loadds
#define JS_STATIC_DLL_CALLBACK(__x) static __x CALLBACK
#else /* this must be .EXE */
#define JS_EXTERN_API(__type) extern __type _cdecl _export
#define JS_EXPORT_API(__type) __type _cdecl _export
#define JS_EXTERN_DATA(__type) extern __type _export
#define JS_EXPORT_DATA(__type) __type _export
#define JS_DLL_CALLBACK __cdecl __loadds
#define JS_STATIC_DLL_CALLBACK(__x) __x JS_DLL_CALLBACK
#endif /* _WINDLL */
# define JS_DLL_CALLBACK
# define JS_STATIC_DLL_CALLBACK(__x) static __x
#else /* Unix */
@ -131,12 +121,16 @@
# else
# define JS_IMPORT_API(__x) __declspec(dllimport) __x
# endif
#elif defined(XP_OS2) && defined(__declspec)
# define JS_IMPORT_API(__x) __declspec(dllimport) __x
#else
# define JS_IMPORT_API(__x) JS_EXPORT_API (__x)
#endif
#if defined(_WIN32) && !defined(__MWERKS__)
# define JS_IMPORT_DATA(__x) __declspec(dllimport) __x
#elif defined(XP_OS2) && defined(__declspec)
# define JS_IMPORT_DATA(__x) __declspec(dllimport) __x
#else
# define JS_IMPORT_DATA(__x) JS_EXPORT_DATA (__x)
#endif
@ -145,21 +139,30 @@
* The linkage of JS API functions differs depending on whether the file is
* used within the JS library or not. Any source file within the JS
* interpreter should define EXPORT_JS_API whereas any client of the library
* should not.
* should not. STATIC_JS_API is used to build JS as a static library.
*/
#ifdef EXPORT_JS_API
#if defined(STATIC_JS_API)
# define JS_PUBLIC_API(t) t
# define JS_PUBLIC_DATA(t) t
#elif defined(EXPORT_JS_API)
# define JS_PUBLIC_API(t) JS_EXPORT_API(t)
# define JS_PUBLIC_DATA(t) JS_EXPORT_DATA(t)
#else
# define JS_PUBLIC_API(t) JS_IMPORT_API(t)
# define JS_PUBLIC_DATA(t) JS_IMPORT_DATA(t)
#endif
#define JS_FRIEND_API(t) JS_PUBLIC_API(t)
#define JS_FRIEND_DATA(t) JS_PUBLIC_DATA(t)
#ifdef _WIN32
# define JS_INLINE __inline
#if defined(_MSC_VER)
# define JS_INLINE __forceinline
#elif defined(__GNUC__)
# define JS_INLINE
#else
@ -174,7 +177,14 @@
** behave syntactically more like functions when called.
***********************************************************************/
#define JS_BEGIN_MACRO do {
#if defined(_MSC_VER) && _MSC_VER >= 1400
# define JS_END_MACRO \
} __pragma(warning(push)) __pragma(warning(disable:4127)) \
while (0) __pragma(warning(pop))
#else
# define JS_END_MACRO } while (0)
#endif
/***********************************************************************
** MACROS: JS_BEGIN_EXTERN_C
@ -183,11 +193,15 @@
** Macro shorthands for conditional C++ extern block delimiters.
***********************************************************************/
#ifdef __cplusplus
# define JS_BEGIN_EXTERN_C extern "C" {
# define JS_END_EXTERN_C }
#else
# define JS_BEGIN_EXTERN_C
# define JS_END_EXTERN_C
#endif
/***********************************************************************
@ -294,6 +308,7 @@ typedef long JSInt32;
** the JSLL_ macros (see jslong.h).
************************************************************************/
#ifdef JS_HAVE_LONG_LONG
# if JS_BYTES_PER_LONG == 8
typedef long JSInt64;
typedef unsigned long JSUint64;
@ -307,7 +322,9 @@ typedef unsigned __int64 JSUint64;
typedef long long JSInt64;
typedef unsigned long long JSUint64;
# endif /* JS_BYTES_PER_LONG == 8 */
#else /* !JS_HAVE_LONG_LONG */
typedef struct {
# ifdef IS_LITTLE_ENDIAN
JSUint32 lo, hi;
@ -316,6 +333,7 @@ typedef struct {
#endif
} JSInt64;
typedef JSInt64 JSUint64;
#endif /* !JS_HAVE_LONG_LONG */
/************************************************************************
@ -362,7 +380,11 @@ typedef ptrdiff_t JSPtrdiff;
** A type for pointer difference. Variables of this type are suitable
** for storing a pointer or pointer sutraction.
************************************************************************/
#if JS_BYTES_PER_WORD == 8 && JS_BYTES_PER_LONG != 8
typedef JSUint64 JSUptrdiff;
#else
typedef unsigned long JSUptrdiff;
#endif
/************************************************************************
** TYPES: JSBool
@ -380,15 +402,20 @@ typedef JSIntn JSBool;
** TYPES: JSPackedBool
** DESCRIPTION:
** Use JSPackedBool within structs where bitfields are not desireable
** but minimum and consistant overhead matters.
** but minimum and consistent overhead matters.
************************************************************************/
typedef JSUint8 JSPackedBool;
/*
** A JSWord is an integer that is the same size as a void*
*/
#if JS_BYTES_PER_WORD == 8 && JS_BYTES_PER_LONG != 8
typedef JSInt64 JSWord;
typedef JSUint64 JSUword;
#else
typedef long JSWord;
typedef unsigned long JSUword;
#endif
#include "jsotypes.h"
@ -409,13 +436,37 @@ typedef unsigned long JSUword;
**
***********************************************************************/
#if defined(__GNUC__) && (__GNUC__ > 2)
# define JS_LIKELY(x) (__builtin_expect((x), 1))
# define JS_UNLIKELY(x) (__builtin_expect((x), 0))
#else
# define JS_LIKELY(x) (x)
# define JS_UNLIKELY(x) (x)
#endif
/***********************************************************************
** MACROS: JS_ARRAY_LENGTH
** JS_ARRAY_END
** DESCRIPTION:
** Macros to get the number of elements and the pointer to one past the
** last element of a C array. Use them like this:
**
** jschar buf[10], *s;
** JSString *str;
** ...
** for (s = buf; s != JS_ARRAY_END(buf); ++s) *s = ...;
** ...
** str = JS_NewStringCopyN(cx, buf, JS_ARRAY_LENGTH(buf));
** ...
**
***********************************************************************/
#define JS_ARRAY_LENGTH(array) (sizeof (array) / sizeof (array)[0])
#define JS_ARRAY_END(array) ((array) + JS_ARRAY_LENGTH(array))
JS_END_EXTERN_C
#endif /* jstypes_h___ */

View File

@ -44,7 +44,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="SM_EXPORTS;JS_HAS_FILE_OBJECT=1"
PreprocessorDefinitions="SM_EXPORTS;JS_HAS_FILE_OBJECT=1;XP_WIN"
UsePrecompiledHeader="0"
/>
<Tool
@ -111,7 +111,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="SM_EXPORTS;JS_HAS_FILE_OBJECT=1"
PreprocessorDefinitions="SM_EXPORTS;JS_HAS_FILE_OBJECT=1;XP_WIN"
UsePrecompiledHeader="0"
/>
<Tool
@ -178,7 +178,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="SM_EXPORTS;JS_HAS_FILE_OBJECT=1"
PreprocessorDefinitions="SM_EXPORTS;JS_HAS_FILE_OBJECT=1;XP_WIN"
UsePrecompiledHeader="0"
/>
<Tool
@ -244,7 +244,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="SM_EXPORTS;JS_HAS_FILE_OBJECT=1"
PreprocessorDefinitions="SM_EXPORTS;JS_HAS_FILE_OBJECT=1;XP_WIN"
UsePrecompiledHeader="0"
/>
<Tool

View File

@ -72,7 +72,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SM_EXPORTS;JS_HAS_FILE_OBJECT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>SM_EXPORTS;JS_HAS_FILE_OBJECT=1;XP_WIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
@ -91,7 +91,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SM_EXPORTS;JS_HAS_FILE_OBJECT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>SM_EXPORTS;JS_HAS_FILE_OBJECT=1;XP_WIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
@ -107,7 +107,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SM_EXPORTS;JS_HAS_FILE_OBJECT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>SM_EXPORTS;JS_HAS_FILE_OBJECT=1;XP_WIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
@ -125,7 +125,7 @@
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SM_EXPORTS;JS_HAS_FILE_OBJECT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>SM_EXPORTS;JS_HAS_FILE_OBJECT=1;XP_WIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>