Bug 703833 - Add an uintptr_t alternative to the jsval payload, and use it for MarkStackRangeConservatively. r=luke

This commit is contained in:
Mike Hommey 2012-05-22 08:45:13 +02:00
parent 96de05d930
commit bee280e4c7
3 changed files with 14 additions and 2 deletions

View File

@ -572,6 +572,14 @@ class Value
#endif
}
const uintptr_t *payloadUIntPtr() const {
#if JS_BITS_PER_WORD == 32
return &data.s.payload.uintptr;
#elif JS_BITS_PER_WORD == 64
return &data.asUIntPtr;
#endif
}
#if !defined(_MSC_VER) && !defined(__sparc)
/* To make jsval binary compatible when linking across C and C++ with MSVC,
* JS::Value needs to be POD. Otherwise, jsval will be passed in memory

View File

@ -1109,8 +1109,8 @@ MarkConservativeStackRoots(JSTracer *trc, bool useSavedRoots)
void
MarkStackRangeConservatively(JSTracer *trc, Value *beginv, Value *endv)
{
const uintptr_t *begin = beginv->payloadWord();
const uintptr_t *end = endv->payloadWord();
const uintptr_t *begin = beginv->payloadUIntPtr();
const uintptr_t *end = endv->payloadUIntPtr();
#ifdef JS_NUNBOX32
/*
* With 64-bit jsvals on 32-bit systems, we can optimize a bit by

View File

@ -237,6 +237,7 @@ typedef union jsval_layout
void *ptr;
JSWhyMagic why;
size_t word;
uintptr_t uintptr;
} payload;
JSValueTag tag;
} s;
@ -264,6 +265,7 @@ typedef union jsval_layout
double asDouble;
void *asPtr;
size_t asWord;
uintptr_t asUIntPtr;
} JSVAL_ALIGNMENT jsval_layout;
# endif /* JS_BITS_PER_WORD */
#else /* defined(IS_LITTLE_ENDIAN) */
@ -282,6 +284,7 @@ typedef union jsval_layout
void *ptr;
JSWhyMagic why;
size_t word;
uintptr_t uintptr;
} payload;
} s;
double asDouble;
@ -306,6 +309,7 @@ typedef union jsval_layout
double asDouble;
void *asPtr;
size_t asWord;
uintptr_t asUIntPtr;
} JSVAL_ALIGNMENT jsval_layout;
# endif /* JS_BITS_PER_WORD */
#endif /* defined(IS_LITTLE_ENDIAN) */