Bug 857345 - ExposeToActiveJS should not care about GC things in the Nursery; r=billm

--HG--
extra : rebase_source : 709ce1e8e36f080d8a58b0a3b22a8955f72cf17f
This commit is contained in:
Terrence Cole 2013-04-01 15:31:49 -07:00
parent 738dd217d2
commit bea8a89ed8
3 changed files with 27 additions and 6 deletions

View File

@ -237,10 +237,20 @@ ExposeGCThingToActiveJS(void *thing, JSGCTraceKind kind)
{
JS_ASSERT(kind != JSTRACE_SHAPE);
if (GCThingIsMarkedGray(thing))
UnmarkGrayGCThingRecursively(thing, kind);
else if (IsIncrementalBarrierNeededOnGCThing(thing, kind))
shadow::Runtime *rt = js::gc::GetGCThingRuntime(thing);
#ifdef JSGC_GENERATIONAL
/*
* GC things residing in the nursery cannot be gray: they have no mark bits.
* All live objects in the nursery are moved to tenured at the beginning of
* each GC slice, so the gray marker never sees nursery things.
*/
if (uintptr_t(thing) >= rt->gcNurseryStart_ && uintptr_t(thing) < rt->gcNurseryEnd_)
return;
#endif
if (IsIncrementalBarrierNeededOnGCThing(rt, thing, kind))
IncrementalReferenceBarrier(thing, kind);
else if (GCThingIsMarkedGray(thing))
UnmarkGrayGCThingRecursively(thing, kind);
}
static JS_ALWAYS_INLINE void

View File

@ -149,9 +149,8 @@ GCThingIsMarkedGray(void *thing)
}
static JS_ALWAYS_INLINE bool
IsIncrementalBarrierNeededOnGCThing(void *thing, JSGCTraceKind kind)
IsIncrementalBarrierNeededOnGCThing(shadow::Runtime *rt, void *thing, JSGCTraceKind kind)
{
shadow::Runtime *rt = js::gc::GetGCThingRuntime(thing);
if (!rt->needsBarrier_)
return false;
js::Zone *zone = GetGCThingZone(thing);

View File

@ -206,7 +206,19 @@ struct Runtime
/* Restrict zone access during Minor GC. */
bool needsBarrier_;
Runtime() : needsBarrier_(false) {}
#ifdef JSGC_GENERATIONAL
/* Allow inlining of Nursery::isInside. */
uintptr_t gcNurseryStart_;
uintptr_t gcNurseryEnd_;
#endif
Runtime()
: needsBarrier_(false)
#ifdef JSGC_GENERATIONAL
, gcNurseryStart_(0)
, gcNurseryEnd_(0)
#endif
{}
};
} /* namespace shadow */