Bug 836524 - Zone renaming part 3 (r=jonco)
authorBill McCloskey <wmccloskey@mozilla.com>
Wed, 06 Feb 2013 18:08:22 -0800
changeset 130995 f4a00ea823fd750699546859f5381f4484eccf97
parent 130994 8794e665403743ef1b1dc2bb106b03b62b5816ad
child 130996 f61a56d201d6ef82b21ea7c8a97561163569aa01
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs836524
milestone21.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 836524 - Zone renaming part 3 (r=jonco)
js/src/jsgc.cpp
js/src/jsgc.h
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -1845,18 +1845,18 @@ GCMarker::hasBufferedGrayRoots() const
 {
     return !grayFailed;
 }
 
 void
 GCMarker::startBufferingGrayRoots()
 {
     JS_ASSERT(!grayFailed);
-    for (GCCompartmentsIter c(runtime); !c.done(); c.next())
-        JS_ASSERT(c->gcGrayRoots.empty());
+    for (GCZonesIter zone(runtime); !zone.done(); zone.next())
+        JS_ASSERT(zone->gcGrayRoots.empty());
 
     JS_ASSERT(!callback);
     callback = GrayCallback;
     JS_ASSERT(IS_GC_MARKING_TRACER(this));
 }
 
 void
 GCMarker::endBufferingGrayRoots()
@@ -1864,28 +1864,28 @@ GCMarker::endBufferingGrayRoots()
     JS_ASSERT(callback == GrayCallback);
     callback = NULL;
     JS_ASSERT(IS_GC_MARKING_TRACER(this));
 }
 
 void
 GCMarker::resetBufferedGrayRoots()
 {
-    for (GCCompartmentsIter c(runtime); !c.done(); c.next())
-        c->gcGrayRoots.clearAndFree();
+    for (GCZonesIter zone(runtime); !zone.done(); zone.next())
+        zone->gcGrayRoots.clearAndFree();
     grayFailed = false;
 }
 
 void
-GCMarker::markBufferedGrayRoots(JSCompartment *comp)
+GCMarker::markBufferedGrayRoots(JS::Zone *zone)
 {
     JS_ASSERT(!grayFailed);
-    JS_ASSERT(comp->isGCMarkingGray());
-
-    for (GrayRoot *elem = comp->gcGrayRoots.begin(); elem != comp->gcGrayRoots.end(); elem++) {
+    JS_ASSERT(zone->isGCMarkingGray());
+
+    for (GrayRoot *elem = zone->gcGrayRoots.begin(); elem != zone->gcGrayRoots.end(); elem++) {
 #ifdef DEBUG
         debugPrinter = elem->debugPrinter;
         debugPrintArg = elem->debugPrintArg;
         debugPrintIndex = elem->debugPrintIndex;
 #endif
         void *tmp = elem->thing;
         JS_SET_TRACING_LOCATION(this, (void *)&elem->thing);
         MarkKind(this, &tmp, elem->kind);
@@ -1903,20 +1903,20 @@ GCMarker::appendGrayRoot(void *thing, JS
 
     GrayRoot root(thing, kind);
 #ifdef DEBUG
     root.debugPrinter = debugPrinter;
     root.debugPrintArg = debugPrintArg;
     root.debugPrintIndex = debugPrintIndex;
 #endif
 
-    JSCompartment *comp = static_cast<Cell *>(thing)->compartment();
-    if (comp->isCollecting()) {
-        comp->maybeAlive = true;
-        if (!comp->gcGrayRoots.append(root)) {
+    Zone *zone = static_cast<Cell *>(thing)->zone();
+    if (zone->isCollecting()) {
+        zone->maybeAlive = true;
+        if (!zone->gcGrayRoots.append(root)) {
             grayFailed = true;
             resetBufferedGrayRoots();
         }
     }
 }
 
 void
 GCMarker::GrayCallback(JSTracer *trc, void **thingp, JSGCTraceKind kind)
@@ -2862,29 +2862,29 @@ MarkWeakReferences(JSRuntime *rt, gcstat
 }
 
 static void
 MarkWeakReferencesInCurrentGroup(JSRuntime *rt, gcstats::Phase phase)
 {
     MarkWeakReferences<GCCompartmentGroupIter>(rt, phase);
 }
 
-template <class CompartmentIterT>
+template <class ZoneIterT, class CompartmentIterT>
 static void
 MarkGrayReferences(JSRuntime *rt)
 {
     GCMarker *gcmarker = &rt->gcMarker;
 
     {
         gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_SWEEP_MARK);
         gcstats::AutoPhase ap1(rt->gcStats, gcstats::PHASE_SWEEP_MARK_GRAY);
         gcmarker->setMarkColorGray();
         if (gcmarker->hasBufferedGrayRoots()) {
-            for (CompartmentIterT c(rt); !c.done(); c.next())
-                gcmarker->markBufferedGrayRoots(c);
+            for (ZoneIterT zone(rt); !zone.done(); zone.next())
+                gcmarker->markBufferedGrayRoots(zone);
         } else {
             JS_ASSERT(!rt->gcIsIncremental);
             if (JSTraceDataOp op = rt->gcGrayRootsTraceOp)
                 (*op)(gcmarker, rt->gcGrayRootsData);
         }
         SliceBudget budget;
         gcmarker->drainMarkStack(budget);
     }
@@ -2894,31 +2894,31 @@ MarkGrayReferences(JSRuntime *rt)
     JS_ASSERT(gcmarker->isDrained());
 
     gcmarker->setMarkColorBlack();
 }
 
 static void
 MarkGrayReferencesInCurrentGroup(JSRuntime *rt)
 {
-    MarkGrayReferences<GCCompartmentGroupIter>(rt);
+    MarkGrayReferences<GCZoneGroupIter, GCCompartmentGroupIter>(rt);
 }
 
 #ifdef DEBUG
 
 static void
 MarkAllWeakReferences(JSRuntime *rt, gcstats::Phase phase)
 {
     MarkWeakReferences<GCCompartmentsIter>(rt, phase);
 }
 
 static void
 MarkAllGrayReferences(JSRuntime *rt)
 {
-    MarkGrayReferences<GCCompartmentsIter>(rt);
+    MarkGrayReferences<GCZonesIter, GCCompartmentsIter>(rt);
 }
 
 class js::gc::MarkingValidator
 {
   public:
     MarkingValidator(JSRuntime *rt);
     ~MarkingValidator();
     void nonIncrementalMark();
--- a/js/src/jsgc.h
+++ b/js/src/jsgc.h
@@ -1044,17 +1044,17 @@ struct GCMarker : public JSTracer {
      * then mark them later, after black marking is complete for each
      * compartment. This accumulation can fail, but in that case we switch to
      * non-incremental GC.
      */
     bool hasBufferedGrayRoots() const;
     void startBufferingGrayRoots();
     void endBufferingGrayRoots();
     void resetBufferedGrayRoots();
-    void markBufferedGrayRoots(JSCompartment *comp);
+    void markBufferedGrayRoots(JS::Zone *zone);
 
     static void GrayCallback(JSTracer *trc, void **thing, JSGCTraceKind kind);
 
     size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const;
 
     MarkStack<uintptr_t> stack;
 
   private: