Bug 1318627 - Remove Zone::active and related infrastructure. r=jonco, f=bhackett
authorJan de Mooij <jdemooij@mozilla.com>
Thu, 08 Dec 2016 14:26:36 -1000
changeset 325463 853a0dfc4d5f5d0a4edb51e9b6356b547556ecc5
parent 325462 d8f60ae71774924b84fb6347057c7fd45394ed03
child 325464 c3d4bcee4905b8d322319d9585e76a148a7b707f
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersjonco
bugs1318627
milestone53.0a1
Bug 1318627 - Remove Zone::active and related infrastructure. r=jonco, f=bhackett
js/src/gc/Zone.cpp
js/src/gc/Zone.h
js/src/jit-test/tests/xdr/async.js
js/src/jsgc.cpp
js/src/jsgc.h
js/src/vm/Stack.cpp
--- a/js/src/gc/Zone.cpp
+++ b/js/src/gc/Zone.cpp
@@ -37,17 +37,16 @@ JS::Zone::Zone(JSRuntime* rt)
     usage(&rt->gc.usage),
     gcDelayBytes(0),
     propertyTree(this),
     baseShapes(this, BaseShapeSet()),
     initialShapes(this, InitialShapeSet()),
     data(nullptr),
     isSystem(false),
     usedByExclusiveThread(false),
-    active(false),
     jitZone_(nullptr),
     gcState_(NoGC),
     gcScheduled_(false),
     gcPreserveCode_(false),
     jitUsingBarriers_(false),
     keepShapeTables_(false),
     listNext_(NotOnList)
 {
@@ -123,21 +122,16 @@ Zone::onTooMuchMalloc()
         GCRuntime& gc = runtimeFromAnyThread()->gc;
         gcMallocGCTriggered = gc.triggerZoneGC(this, JS::gcreason::TOO_MUCH_MALLOC);
     }
 }
 
 void
 Zone::beginSweepTypes(FreeOp* fop, bool releaseTypes)
 {
-    // Periodically release observed types for all scripts. This is safe to
-    // do when there are no frames for the zone on the stack.
-    if (active)
-        releaseTypes = false;
-
     AutoClearTypeInferenceStateOnOOM oom(this);
     types.beginSweep(fop, releaseTypes, oom);
 }
 
 Zone::DebuggerVector*
 Zone::getOrCreateDebuggers(JSContext* cx)
 {
     if (debuggers)
--- a/js/src/gc/Zone.h
+++ b/js/src/gc/Zone.h
@@ -412,19 +412,16 @@ struct Zone : public JS::shadow::Zone,
 
     // Per-zone data for use by an embedder.
     void* data;
 
     bool isSystem;
 
     mozilla::Atomic<bool> usedByExclusiveThread;
 
-    // True when there are active frames.
-    bool active;
-
 #ifdef DEBUG
     unsigned gcLastZoneGroupIndex;
 #endif
 
     static js::HashNumber UniqueIdToHash(uint64_t uid) {
         return js::HashNumber(uid >> 32) ^ js::HashNumber(uid & 0xFFFFFFFF);
     }
 
--- a/js/src/jit-test/tests/xdr/async.js
+++ b/js/src/jit-test/tests/xdr/async.js
@@ -1,10 +1,13 @@
 load(libdir + 'bytecode-cache.js');
 
+// Prevent relazification triggered by some zeal modes.
+gczeal(0);
+
 async function f1(a, b) {
   let x = await 10;
   return x;
 };
 var toStringResult = f1.toString();
 
 var test = `
 async function f1(a, b) {
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -2921,22 +2921,16 @@ SliceBudget::checkOverBudget(JSContext* 
 
     bool over = PRMJ_Now() >= deadline;
     if (!over)
         counter = CounterReset;
     return over;
 }
 
 void
-js::MarkCompartmentActive(InterpreterFrame* fp)
-{
-    fp->script()->compartment()->zone()->active = true;
-}
-
-void
 GCRuntime::requestMajorGC(JS::gcreason::Reason reason)
 {
     MOZ_ASSERT(!CurrentThreadIsPerformingGC());
 
     if (majorGCRequested())
         return;
 
     majorGCTriggerReason = reason;
@@ -5555,17 +5549,16 @@ GCRuntime::finishCollection(JS::gcreason
 
     uint64_t currentTime = PRMJ_Now();
     schedulingState.updateHighFrequencyMode(lastGCTime, currentTime, tunables);
 
     for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) {
         if (zone->isCollecting()) {
             MOZ_ASSERT(zone->isGCFinished());
             zone->setGCState(Zone::NoGC);
-            zone->active = false;
         }
 
         MOZ_ASSERT(!zone->isCollecting());
         MOZ_ASSERT(!zone->wasGCStarted());
     }
 
     MOZ_ASSERT(zonesToMaybeCompact.isEmpty());
 
@@ -5735,25 +5728,16 @@ class AutoGCSlice {
     AutoSetThreadIsPerformingGC performingGC;
 };
 
 } /* anonymous namespace */
 
 AutoGCSlice::AutoGCSlice(JSRuntime* rt)
   : runtime(rt)
 {
-    /*
-     * During incremental GC, the compartment's active flag determines whether
-     * there are stack frames active for any of its scripts. Normally this flag
-     * is set at the beginning of the mark phase. During incremental GC, we also
-     * set it at the start of every phase.
-     */
-    for (ActivationIterator iter(rt); !iter.done(); ++iter)
-        iter->compartment()->zone()->active = true;
-
     for (GCZonesIter zone(rt); !zone.done(); zone.next()) {
         /*
          * Clear needsIncrementalBarrier early so we don't do any write
          * barriers during GC. We don't need to update the Ion barriers (which
          * is expensive) because Ion code doesn't run during GC. If need be,
          * we'll update the Ion barriers in ~AutoGCSlice.
          */
         if (zone->isGCMarking()) {
--- a/js/src/jsgc.h
+++ b/js/src/jsgc.h
@@ -831,19 +831,16 @@ class ArenaLists
 /* The number of GC cycles an empty chunk can survive before been released. */
 const size_t MAX_EMPTY_CHUNK_AGE = 4;
 
 } /* namespace gc */
 
 class InterpreterFrame;
 
 extern void
-MarkCompartmentActive(js::InterpreterFrame* fp);
-
-extern void
 TraceRuntime(JSTracer* trc);
 
 extern void
 ReleaseAllJITCode(FreeOp* op);
 
 extern void
 PrepareForDebugGC(JSRuntime* rt);
 
--- a/js/src/vm/Stack.cpp
+++ b/js/src/vm/Stack.cpp
@@ -392,19 +392,16 @@ InterpreterFrame::trace(JSTracer* trc, V
             unaliasedLocal(--nfixed).setUndefined();
 
         // Trace live locals.
         traceValues(trc, 0, nlivefixed);
     }
 
     if (script->compartment()->debugEnvs)
         script->compartment()->debugEnvs->traceLiveFrame(trc, this);
-
-    if (trc->isMarkingTracer())
-        script->compartment()->zone()->active = true;
 }
 
 void
 InterpreterFrame::traceValues(JSTracer* trc, unsigned start, unsigned end)
 {
     if (start < end)
         TraceRootRange(trc, end - start, slots() + start, "vm_stack");
 }