Bug 863523 - Avoid post-barrier on global slots for JIT code; r=billm,terrence

--HG--
extra : rebase_source : 07295033b68776856fc3f519d08a6a114c930dd6
This commit is contained in:
Brian Hackett 2013-03-20 16:15:00 -07:00
parent b992828389
commit e9bd27c3ae

View File

@ -653,6 +653,28 @@ JSPropertyDescriptor::trace(JSTracer *trc)
}
}
static inline void
MarkGlobalForMinorGC(JSTracer *trc, JSCompartment *compartment)
{
/*
* Named properties of globals which have had Ion activity are treated as
* roots during minor GCs. This allows writes to globals to occur without
* needing a write barrier.
*/
JS_ASSERT(trc->runtime->isHeapMinorCollecting());
if (!compartment->ionCompartment())
return;
GlobalObject *global = compartment->maybeGlobal();
if (!global)
return;
/* Global reserved slots never hold nursery things. */
for (size_t i = JSCLASS_RESERVED_SLOTS(global->getClass()); i < global->slotSpan(); ++i)
MarkValueRoot(trc, global->nativeGetSlotRef(i).unsafeGet(), "MinorGlobalRoot");
}
void
js::gc::MarkRuntime(JSTracer *trc, bool useSavedRoots)
{
@ -741,6 +763,9 @@ js::gc::MarkRuntime(JSTracer *trc, bool useSavedRoots)
if (IS_GC_MARKING_TRACER(trc) && !c->zone()->isCollecting())
continue;
if (trc->runtime->isHeapMinorCollecting())
MarkGlobalForMinorGC(trc, c);
/* During a GC, these are treated as weak pointers. */
if (!IS_GC_MARKING_TRACER(trc)) {
if (c->watchpointMap)