Bug 1290584 - Lift stack marking into a function; r=jonco
authorTerrence Cole <terrence@mozilla.com>
Fri, 29 Jul 2016 14:11:33 -0700
changeset 312848 f6efc93a3267fdaa88cc2e5bcf3e1dce153189c4
parent 312847 7fb14ae2f4d8d7e70bfd9880ee33c48a07efd055
child 312849 4fb9118e1f62fb16d7e747b647b744db23718468
push id81470
push usertcole@mozilla.com
push dateTue, 06 Sep 2016 20:06:56 +0000
treeherdermozilla-inbound@9db0bc3c54ce [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1290584
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1290584 - Lift stack marking into a function; r=jonco
js/src/gc/RootMarking.cpp
js/src/gc/Statistics.cpp
js/src/gc/Statistics.h
--- a/js/src/gc/RootMarking.cpp
+++ b/js/src/gc/RootMarking.cpp
@@ -320,33 +320,41 @@ js::gc::GCRuntime::traceRuntime(JSTracer
 }
 
 void
 js::gc::GCRuntime::traceRuntimeCommon(JSTracer* trc, TraceOrMarkRuntime traceOrMark,
                                       AutoLockForExclusiveAccess& lock)
 {
     MOZ_ASSERT(!rt->mainThread.suppressGC);
 
-    // Trace C stack roots.
     {
-        gcstats::AutoPhase ap(stats, gcstats::PHASE_MARK_ROOTERS);
+        gcstats::AutoPhase ap(stats, gcstats::PHASE_MARK_STACK);
 
-        AutoGCRooter::traceAll(trc);
+        // Trace active interpreter and JIT stack roots.
+        MarkInterpreterActivations(rt, trc);
+        jit::MarkJitActivations(rt, trc);
 
-        MarkExactStackRoots(rt, trc);
-        rt->markSelfHostingGlobal(trc);
+        // Trace legacy C stack roots.
+        AutoGCRooter::traceAll(trc);
 
         for (RootRange r = rootsHash.all(); !r.empty(); r.popFront()) {
             const RootEntry& entry = r.front();
             TraceRoot(trc, entry.key(), entry.value());
         }
 
-        MarkPersistentRooted(rt, trc);
+        // Trace C stack roots.
+        MarkExactStackRoots(rt, trc);
     }
 
+    // Trace runtime global roots.
+    MarkPersistentRooted(rt, trc);
+
+    // 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);
@@ -362,20 +370,16 @@ js::gc::GCRuntime::traceRuntimeCommon(JS
     // same struct as the JSRuntime, but is still split for historical reasons.
     rt->contextFromMainThread()->mark(trc);
 
     // Trace all compartment roots, but not the compartment itself; it is
     // marked via the parent pointer if traceRoots actually traces anything.
     for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next())
         c->traceRoots(trc, traceOrMark);
 
-    // Trace JS stack roots.
-    MarkInterpreterActivations(rt, trc);
-    jit::MarkJitActivations(rt, trc);
-
     // Trace SPS.
     rt->spsProfiler.trace(trc);
 
     // Trace the embedding's black and gray roots.
     if (!rt->isHeapMinorCollecting()) {
         gcstats::AutoPhase ap(stats, gcstats::PHASE_MARK_EMBEDDING);
 
         /*
--- a/js/src/gc/Statistics.cpp
+++ b/js/src/gc/Statistics.cpp
@@ -175,17 +175,17 @@ static const PhaseInfo phases[] = {
         /* PHASE_MARK_ROOTS */
     { PHASE_TRACE_HEAP, "Trace Heap", PHASE_NO_PARENT, 47 },
         /* PHASE_MARK_ROOTS */
     { PHASE_BARRIER, "Barriers", PHASE_NO_PARENT, 55 },
         { PHASE_UNMARK_GRAY, "Unmark gray", PHASE_BARRIER, 56 },
     { PHASE_MARK_ROOTS, "Mark Roots", PHASE_MULTI_PARENTS, 48 },
         { PHASE_BUFFER_GRAY_ROOTS, "Buffer Gray Roots", PHASE_MARK_ROOTS, 49 },
         { PHASE_MARK_CCWS, "Mark Cross Compartment Wrappers", PHASE_MARK_ROOTS, 50 },
-        { PHASE_MARK_ROOTERS, "Mark Rooters", PHASE_MARK_ROOTS, 51 },
+        { PHASE_MARK_STACK, "Mark C and JS stacks", PHASE_MARK_ROOTS, 51 },
         { PHASE_MARK_RUNTIME_DATA, "Mark Runtime-wide Data", PHASE_MARK_ROOTS, 52 },
         { PHASE_MARK_EMBEDDING, "Mark Embedding", PHASE_MARK_ROOTS, 53 },
         { PHASE_MARK_COMPARTMENTS, "Mark Compartments", PHASE_MARK_ROOTS, 54 },
     { PHASE_LIMIT, nullptr, PHASE_NO_PARENT, 59 }
 
     // Current number of telemetryBuckets is 59. If you insert new phases
     // somewhere, start at that number and count up. Do not change any existing
     // numbers.
--- a/js/src/gc/Statistics.h
+++ b/js/src/gc/Statistics.h
@@ -76,17 +76,17 @@ enum Phase : uint8_t {
     PHASE_MINOR_GC,
     PHASE_EVICT_NURSERY,
     PHASE_TRACE_HEAP,
     PHASE_BARRIER,
     PHASE_UNMARK_GRAY,
     PHASE_MARK_ROOTS,
     PHASE_BUFFER_GRAY_ROOTS,
     PHASE_MARK_CCWS,
-    PHASE_MARK_ROOTERS,
+    PHASE_MARK_STACK,
     PHASE_MARK_RUNTIME_DATA,
     PHASE_MARK_EMBEDDING,
     PHASE_MARK_COMPARTMENTS,
 
     PHASE_LIMIT,
     PHASE_NONE = PHASE_LIMIT,
     PHASE_EXPLICIT_SUSPENSION = PHASE_LIMIT,
     PHASE_IMPLICIT_SUSPENSION,