Bug 849536 - Make GetGCThingTraceKind work for Nursery things; r=billm

--HG--
extra : rebase_source : f13dffb79a041292b3a2b283927d4ca8bdda2dcf
This commit is contained in:
Terrence Cole 2013-03-11 10:47:33 -07:00
parent 95af7822f7
commit 6a424f90bd
2 changed files with 15 additions and 11 deletions

View File

@ -27,7 +27,7 @@ namespace gc {
*/
class VerifierNursery
{
HashSet<void*, PointerHasher<void*, 3>, SystemAllocPolicy> nursery;
HashSet<const void *, PointerHasher<const void *, 3>, SystemAllocPolicy> nursery;
public:
VerifierNursery() : nursery() {}
@ -53,7 +53,7 @@ class VerifierNursery
return enable();
}
bool isInside(void *cell) const {
bool isInside(const void *cell) const {
JS_ASSERT((uintptr_t(cell) & 0x3) == 0);
return nursery.initialized() && nursery.has(cell);
}

View File

@ -48,14 +48,6 @@ struct AutoMarkInDeadZone
namespace gc {
inline JSGCTraceKind
GetGCThingTraceKind(const void *thing)
{
JS_ASSERT(thing);
const Cell *cell = reinterpret_cast<const Cell *>(thing);
return MapAllocToTraceKind(cell->getAllocKind());
}
/* Capacity for slotsToThingKind */
const size_t SLOTS_TO_THING_KIND_LIMIT = 17;
@ -191,7 +183,7 @@ ShouldNurseryAllocate(const NurseryType &nursery, AllocKind kind, InitialHeap he
#endif
inline bool
IsInsideNursery(JSRuntime *rt, void *thing)
IsInsideNursery(JSRuntime *rt, const void *thing)
{
#ifdef JSGC_GENERATIONAL
#if JS_GC_ZEAL
@ -202,6 +194,18 @@ IsInsideNursery(JSRuntime *rt, void *thing)
return false;
}
inline JSGCTraceKind
GetGCThingTraceKind(const void *thing)
{
JS_ASSERT(thing);
const Cell *cell = static_cast<const Cell *>(thing);
#ifdef JSGC_GENERATIONAL
if (IsInsideNursery(cell->runtime(), cell))
return JSTRACE_OBJECT;
#endif
return MapAllocToTraceKind(cell->getAllocKind());
}
static inline void
GCPoke(JSRuntime *rt)
{