diff --git a/js/src/gc/GCRuntime.h b/js/src/gc/GCRuntime.h index 45efc0229172..767600cd23a7 100644 --- a/js/src/gc/GCRuntime.h +++ b/js/src/gc/GCRuntime.h @@ -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(); diff --git a/js/src/gc/RootMarking.cpp b/js/src/gc/RootMarking.cpp index 2856a0ee8e1a..bf0322570f7f 100644 --- a/js/src/gc/RootMarking.cpp +++ b/js/src/gc/RootMarking.cpp @@ -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);