Bug 997274 - Value.h uses NUNBOX32 and PUNBOX64 instead of JS_BITS_PER_WORD. r=nbp

This commit is contained in:
Heiher 2014-05-21 06:47:10 -07:00
parent 88b5b45de0
commit 66354089ba
2 changed files with 29 additions and 22 deletions

View File

@ -15,6 +15,7 @@
#include <limits> /* for std::numeric_limits */
#include "js-config.h"
#include "jstypes.h"
#include "js/Anchor.h"
@ -46,7 +47,7 @@ namespace JS { class Value; }
# define JSVAL_ALIGNMENT
#endif
#if JS_BITS_PER_WORD == 64
#if defined(JS_PUNBOX64)
# define JSVAL_TAG_SHIFT 47
#endif
@ -84,7 +85,7 @@ JS_ENUM_HEADER(JSValueType, uint8_t)
JS_STATIC_ASSERT(sizeof(JSValueType) == 1);
#if JS_BITS_PER_WORD == 32
#if defined(JS_NUNBOX32)
/* Remember to propagate changes to the C defines below. */
JS_ENUM_HEADER(JSValueTag, uint32_t)
@ -101,7 +102,7 @@ JS_ENUM_HEADER(JSValueTag, uint32_t)
JS_STATIC_ASSERT(sizeof(JSValueTag) == 4);
#elif JS_BITS_PER_WORD == 64
#elif defined(JS_PUNBOX64)
/* Remember to propagate changes to the C defines below. */
JS_ENUM_HEADER(JSValueTag, uint32_t)
@ -147,7 +148,7 @@ typedef uint8_t JSValueType;
#define JSVAL_TYPE_OBJECT ((uint8_t)0x07)
#define JSVAL_TYPE_UNKNOWN ((uint8_t)0x20)
#if JS_BITS_PER_WORD == 32
#if defined(JS_NUNBOX32)
typedef uint32_t JSValueTag;
#define JSVAL_TAG_CLEAR ((uint32_t)(0xFFFFFF80))
@ -159,7 +160,7 @@ typedef uint32_t JSValueTag;
#define JSVAL_TAG_NULL ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_NULL))
#define JSVAL_TAG_OBJECT ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_OBJECT))
#elif JS_BITS_PER_WORD == 64
#elif defined(JS_PUNBOX64)
typedef uint32_t JSValueTag;
#define JSVAL_TAG_MAX_DOUBLE ((uint32_t)(0x1FFF0))
@ -181,7 +182,7 @@ typedef uint64_t JSValueShiftedTag;
#define JSVAL_SHIFTED_TAG_NULL (((uint64_t)JSVAL_TAG_NULL) << JSVAL_TAG_SHIFT)
#define JSVAL_SHIFTED_TAG_OBJECT (((uint64_t)JSVAL_TAG_OBJECT) << JSVAL_TAG_SHIFT)
#endif /* JS_BITS_PER_WORD */
#endif /* JS_PUNBOX64 */
#endif /* !defined(__SUNPRO_CC) && !defined(__xlC__) */
#define JSVAL_LOWER_INCL_TYPE_OF_OBJ_OR_NULL_SET JSVAL_TYPE_NULL
@ -189,7 +190,7 @@ typedef uint64_t JSValueShiftedTag;
#define JSVAL_UPPER_INCL_TYPE_OF_NUMBER_SET JSVAL_TYPE_INT32
#define JSVAL_LOWER_INCL_TYPE_OF_PTR_PAYLOAD_SET JSVAL_TYPE_MAGIC
#if JS_BITS_PER_WORD == 32
#if defined(JS_NUNBOX32)
#define JSVAL_TYPE_TO_TAG(type) ((JSValueTag)(JSVAL_TAG_CLEAR | (type)))
@ -198,7 +199,7 @@ typedef uint64_t JSValueShiftedTag;
#define JSVAL_UPPER_INCL_TAG_OF_NUMBER_SET JSVAL_TAG_INT32
#define JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET JSVAL_TAG_STRING
#elif JS_BITS_PER_WORD == 64
#elif defined(JS_PUNBOX64)
#define JSVAL_PAYLOAD_MASK 0x00007FFFFFFFFFFFLL
#define JSVAL_TAG_MASK 0xFFFF800000000000LL
@ -215,7 +216,7 @@ typedef uint64_t JSValueShiftedTag;
#define JSVAL_UPPER_EXCL_SHIFTED_TAG_OF_NUMBER_SET JSVAL_SHIFTED_TAG_UNDEFINED
#define JSVAL_LOWER_INCL_SHIFTED_TAG_OF_GCTHING_SET JSVAL_SHIFTED_TAG_STRING
#endif /* JS_BITS_PER_WORD */
#endif /* JS_PUNBOX64 */
typedef enum JSWhyMagic
{
@ -242,7 +243,7 @@ typedef enum JSWhyMagic
} JSWhyMagic;
#if defined(IS_LITTLE_ENDIAN)
# if JS_BITS_PER_WORD == 32
# if defined(JS_NUNBOX32)
typedef union jsval_layout
{
uint64_t asBits;
@ -263,7 +264,7 @@ typedef union jsval_layout
double asDouble;
void *asPtr;
} JSVAL_ALIGNMENT jsval_layout;
# elif JS_BITS_PER_WORD == 64
# elif defined(JS_PUNBOX64)
typedef union jsval_layout
{
uint64_t asBits;
@ -286,9 +287,9 @@ typedef union jsval_layout
size_t asWord;
uintptr_t asUIntPtr;
} JSVAL_ALIGNMENT jsval_layout;
# endif /* JS_BITS_PER_WORD */
# endif /* JS_PUNBOX64 */
#else /* defined(IS_LITTLE_ENDIAN) */
# if JS_BITS_PER_WORD == 32
# if defined(JS_NUNBOX32)
typedef union jsval_layout
{
uint64_t asBits;
@ -309,7 +310,7 @@ typedef union jsval_layout
double asDouble;
void *asPtr;
} JSVAL_ALIGNMENT jsval_layout;
# elif JS_BITS_PER_WORD == 64
# elif defined(JS_PUNBOX64)
typedef union jsval_layout
{
uint64_t asBits;
@ -330,7 +331,7 @@ typedef union jsval_layout
size_t asWord;
uintptr_t asUIntPtr;
} JSVAL_ALIGNMENT jsval_layout;
# endif /* JS_BITS_PER_WORD */
# endif /* JS_PUNBOX64 */
#endif /* defined(IS_LITTLE_ENDIAN) */
JS_STATIC_ASSERT(sizeof(jsval_layout) == 8);
@ -378,7 +379,7 @@ JS_STATIC_ASSERT(sizeof(jsval_layout) == 8);
# define JS_VALUE_CONSTEXPR_VAR const
#endif
#if JS_BITS_PER_WORD == 32
#if defined(JS_NUNBOX32)
/*
* N.B. GCC, in some but not all cases, chooses to emit signed comparison of
@ -623,7 +624,7 @@ JSVAL_EXTRACT_NON_DOUBLE_TYPE_IMPL(jsval_layout l)
return (JSValueType)type;
}
#elif JS_BITS_PER_WORD == 64
#elif defined(JS_PUNBOX64)
static inline JS_VALUE_CONSTEXPR jsval_layout
BUILD_JSVAL(JSValueTag tag, uint64_t payload)
@ -858,7 +859,7 @@ JSVAL_EXTRACT_NON_DOUBLE_TYPE_IMPL(jsval_layout l)
return (JSValueType)type;
}
#endif /* JS_BITS_PER_WORD */
#endif /* JS_PUNBOX64 */
static inline jsval_layout JSVAL_TO_IMPL(JS::Value v);
static inline JS_VALUE_CONSTEXPR JS::Value IMPL_TO_JSVAL(jsval_layout l);
@ -1224,17 +1225,17 @@ class Value
}
const size_t *payloadWord() const {
#if JS_BITS_PER_WORD == 32
#if defined(JS_NUNBOX32)
return &data.s.payload.word;
#elif JS_BITS_PER_WORD == 64
#elif defined(JS_PUNBOX64)
return &data.asWord;
#endif
}
const uintptr_t *payloadUIntPtr() const {
#if JS_BITS_PER_WORD == 32
#if defined(JS_NUNBOX32)
return &data.s.payload.uintptr;
#elif JS_BITS_PER_WORD == 64
#elif defined(JS_PUNBOX64)
return &data.asUIntPtr;
#endif
}

View File

@ -40,6 +40,12 @@
useable. See jscpucfg.h. */
#undef JS_HAVE_SYS_ISA_DEFS_H
/* Define to 1 if SpiderMonkey is in NUNBOX32 mode. */
#undef JS_NUNBOX32
/* Define to 1 if SpiderMonkey is in PUNBOX64 mode. */
#undef JS_PUNBOX64
/* MOZILLA JSAPI version number components */
#undef MOZJS_MAJOR_VERSION
#undef MOZJS_MINOR_VERSION