[tbb-commits] [tor-browser/esr24] Backed out changeset 42531d5e6ca2 (Bug 986843) for test failures

mikeperry at torproject.org mikeperry at torproject.org
Fri Aug 29 05:26:38 UTC 2014


commit a79c2bfce5b8d2416d01250dbbaa7e6cf0dc1ae1
Author: Jon Coppeard <jcoppeard at mozilla.com>
Date:   Wed Apr 2 17:19:28 2014 +0100

    Backed out changeset 42531d5e6ca2 (Bug 986843) for test failures
---
 js/src/gc/RootMarking.cpp |    2 +-
 js/src/gc/Zone.cpp        |    1 +
 js/src/gc/Zone.h          |    2 ++
 js/src/jsapi.cpp          |   29 +++++++++++------------------
 js/src/jscompartment.cpp  |    2 +-
 js/src/jscompartment.h    |    2 +-
 js/src/jsgc.cpp           |    4 ++--
 7 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/js/src/gc/RootMarking.cpp b/js/src/gc/RootMarking.cpp
index 88574f3..861c2d6 100644
--- a/js/src/gc/RootMarking.cpp
+++ b/js/src/gc/RootMarking.cpp
@@ -744,7 +744,7 @@ js::gc::MarkRuntime(JSTracer *trc, bool useSavedRoots)
 #endif
 
     for (CompartmentsIter c(rt); !c.done(); c.next())
-        c->markRoots(trc);
+        c->mark(trc);
 
     /* The embedding can register additional roots here. */
     for (size_t i = 0; i < rt->gcBlackRootTracers.length(); i++) {
diff --git a/js/src/gc/Zone.cpp b/js/src/gc/Zone.cpp
index 0b6161c..5625b99 100644
--- a/js/src/gc/Zone.cpp
+++ b/js/src/gc/Zone.cpp
@@ -23,6 +23,7 @@ using namespace js::gc;
 JS::Zone::Zone(JSRuntime *rt)
   : rt(rt),
     allocator(this),
+    hold(false),
     ionUsingBarriers_(false),
     active(false),
     gcScheduled(false),
diff --git a/js/src/gc/Zone.h b/js/src/gc/Zone.h
index 39e867d..73e7043 100644
--- a/js/src/gc/Zone.h
+++ b/js/src/gc/Zone.h
@@ -108,6 +108,8 @@ struct Zone : private JS::shadow::Zone,
 
     js::CompartmentVector        compartments;
 
+    bool                         hold;
+
   private:
     bool                         ionUsingBarriers_;
 
diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp
index 68b6afa..3632a74 100644
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -3171,32 +3171,23 @@ JS_GetObjectId(JSContext *cx, JSObject *obj, jsid *idp)
     return JS_TRUE;
 }
 
-class AutoCompartmentRooter : private JS::CustomAutoRooter
+class AutoHoldZone
 {
   public:
-    explicit AutoCompartmentRooter(JSContext *cx, JSCompartment *comp
-                                   MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-      : CustomAutoRooter(cx), compartment(comp)
+    explicit AutoHoldZone(Zone *zone
+                          MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
+      : holdp(&zone->hold)
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
+        *holdp = true;
     }
 
-    operator JSCompartment *() {
-        return compartment;
-    }
-
-    JSCompartment *operator->() {
-        return compartment;
-    }
-
-  protected:
-    virtual void trace(JSTracer *trc)
-    {
-        compartment->mark();
+    ~AutoHoldZone() {
+        *holdp = false;
     }
 
   private:
-    JSCompartment *compartment;
+    bool *holdp;
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
@@ -3218,7 +3209,7 @@ JS_NewGlobalObject(JSContext *cx, JSClass *clasp, JSPrincipals *principals,
     else
         zone = ((JSObject *)options.zoneSpec)->zone();
 
-    AutoCompartmentRooter compartment(cx, NewCompartment(cx, zone, principals, options));
+    JSCompartment *compartment = NewCompartment(cx, zone, principals, options);
     if (!compartment)
         return NULL;
 
@@ -3227,6 +3218,8 @@ JS_NewGlobalObject(JSContext *cx, JSClass *clasp, JSPrincipals *principals,
         rt->systemZone->isSystem = true;
     }
 
+    AutoHoldZone hold(compartment->zone());
+
     Rooted<GlobalObject *> global(cx);
     {
         AutoCompartment ac(cx, compartment);
diff --git a/js/src/jscompartment.cpp b/js/src/jscompartment.cpp
index 2e66253..c448e10 100644
--- a/js/src/jscompartment.cpp
+++ b/js/src/jscompartment.cpp
@@ -488,7 +488,7 @@ JSCompartment::markAllCrossCompartmentWrappers(JSTracer *trc)
 }
 
 void
-JSCompartment::markRoots(JSTracer *trc)
+JSCompartment::mark(JSTracer *trc)
 {
 #ifdef JS_ION
     if (ionCompartment_)
diff --git a/js/src/jscompartment.h b/js/src/jscompartment.h
index 1ef2ed8..6cc1bc8 100644
--- a/js/src/jscompartment.h
+++ b/js/src/jscompartment.h
@@ -293,7 +293,7 @@ struct JSCompartment
         WrapperEnum(JSCompartment *c) : js::WrapperMap::Enum(c->crossCompartmentWrappers) {}
     };
 
-    void markRoots(JSTracer *trc);
+    void mark(JSTracer *trc);
     bool isDiscardingJitCode(JSTracer *trc);
     void sweep(js::FreeOp *fop, bool releaseTypes);
     void sweepCrossCompartmentWrappers();
diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp
index 3157861..53a636e 100644
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -2541,7 +2541,7 @@ SweepZones(FreeOp *fop, bool lastGC)
     while (read < end) {
         Zone *zone = *read++;
 
-        if (zone->wasGCStarted()) {
+        if (!zone->hold && zone->wasGCStarted()) {
             if (zone->allocator.arenas.arenaListsAreEmpty() || lastGC) {
                 zone->allocator.arenas.checkEmptyFreeLists();
                 if (callback)
@@ -2723,7 +2723,7 @@ BeginMarkPhase(JSRuntime *rt)
         }
 
         zone->scheduledForDestruction = false;
-        zone->maybeAlive = false;
+        zone->maybeAlive = zone->hold;
         zone->setPreservingCode(false);
     }
 





More information about the tbb-commits mailing list