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

This commit is contained in:
Brian Hackett 2013-03-20 16:15:00 -07:00
Родитель 370f251151
Коммит 84d39eeee2
1 изменённых файлов: 27 добавлений и 0 удалений

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

@ -649,6 +649,30 @@ JSPropertyDescriptor::trace(JSTracer *trc)
}
}
static inline void
MarkGlobalForMinorGC(JSTracer *trc, JSCompartment *compartment)
{
#ifdef JS_ION
/*
* 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");
#endif /* JS_ION */
}
void
js::gc::MarkRuntime(JSTracer *trc, bool useSavedRoots)
{
@ -737,6 +761,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)