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
Родитель 27e941762a
Коммит 13d16e7003
3 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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) */