Bug 1290592 - Unwind the complex conditional around atoms marking; r=jonco

--HG--
extra : rebase_source : 4a9e3554197699de3c207f0c81519985516d0ed5
This commit is contained in:
Terrence Cole 2016-07-29 14:38:21 -07:00
parent 9b885d433e
commit 2d66e62e03
2 changed files with 14 additions and 12 deletions

View File

@ -946,6 +946,7 @@ class GCRuntime
bool shouldPreserveJITCode(JSCompartment* comp, int64_t currentTime,
JS::gcreason::Reason reason);
void traceRuntimeForMajorGC(JSTracer* trc, AutoLockForExclusiveAccess& lock);
void traceRuntimeAtoms(JSTracer* trc, AutoLockForExclusiveAccess& lock);
void traceRuntimeCommon(JSTracer* trc, TraceOrMarkRuntime traceOrMark,
AutoLockForExclusiveAccess& lock);
void bufferGrayRoots();

View File

@ -280,6 +280,8 @@ js::gc::GCRuntime::traceRuntimeForMajorGC(JSTracer* trc, AutoLockForExclusiveAcc
return;
gcstats::AutoPhase ap(stats, gcstats::PHASE_MARK_ROOTS);
if (rt->atomsCompartment(lock)->zone()->isCollecting())
traceRuntimeAtoms(trc, lock);
JSCompartment::traceIncomingCrossCompartmentEdgesForZoneGC(trc);
traceRuntimeCommon(trc, MarkRuntime, lock);
}
@ -320,9 +322,20 @@ js::gc::GCRuntime::traceRuntime(JSTracer* trc, AutoLockForExclusiveAccess& lock)
MOZ_ASSERT(!rt->isBeingDestroyed());
gcstats::AutoPhase ap(stats, gcstats::PHASE_MARK_ROOTS);
traceRuntimeAtoms(trc, lock);
traceRuntimeCommon(trc, TraceRuntime, lock);
}
void
js::gc::GCRuntime::traceRuntimeAtoms(JSTracer* trc, AutoLockForExclusiveAccess& lock)
{
gcstats::AutoPhase ap(stats, gcstats::PHASE_MARK_RUNTIME_DATA);
MarkPermanentAtoms(trc);
MarkAtoms(trc, lock);
MarkWellKnownSymbols(trc);
jit::JitRuntime::Mark(trc, lock);
}
void
js::gc::GCRuntime::traceRuntimeCommon(JSTracer* trc, TraceOrMarkRuntime traceOrMark,
AutoLockForExclusiveAccess& lock)
@ -354,18 +367,6 @@ js::gc::GCRuntime::traceRuntimeCommon(JSTracer* trc, TraceOrMarkRuntime traceOrM
// Trace the self-hosting global compartment.
rt->markSelfHostingGlobal(trc);
// Trace the atoms Compartment.
if (!rt->isHeapMinorCollecting()) {
gcstats::AutoPhase ap(stats, gcstats::PHASE_MARK_RUNTIME_DATA);
if (traceOrMark == TraceRuntime || rt->atomsCompartment(lock)->zone()->isCollecting()) {
MarkPermanentAtoms(trc);
MarkAtoms(trc, lock);
MarkWellKnownSymbols(trc);
jit::JitRuntime::Mark(trc, lock);
}
}
// Trace anything in the single context. Note that this is actually the
// same struct as the JSRuntime, but is still split for historical reasons.
rt->contextFromMainThread()->mark(trc);