Bug 1384047 - Relax assertion that zones are empty when they are deleted r=jandem
authorJon Coppeard <jcoppeard@mozilla.com>
Thu, 27 Jul 2017 11:09:53 +0100
changeset 420094 5f396e8e22faa2852a29f3e1bfda22018f5aa3ca
parent 420093 6ed95396bdb623610e88b4d59ed267d513ae2886
child 420095 0739667c02050d60fec1f965307a8a85f8c40b8b
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1384047
milestone56.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 1384047 - Relax assertion that zones are empty when they are deleted r=jandem
js/src/gc/Zone.cpp
js/src/jit-test/tests/gc/bug-1384047.js
js/src/jsgc.cpp
--- a/js/src/gc/Zone.cpp
+++ b/js/src/gc/Zone.cpp
@@ -69,18 +69,16 @@ JS::Zone::Zone(JSRuntime* rt, ZoneGroup*
     AutoLockGC lock(rt);
     threshold.updateAfterGC(8192, GC_NORMAL, rt->gc.tunables, rt->gc.schedulingState, lock);
     setGCMaxMallocBytes(rt->gc.maxMallocBytesAllocated() * 0.9);
     jitCodeCounter.setMax(jit::MaxCodeBytesPerProcess * 0.8);
 }
 
 Zone::~Zone()
 {
-    MOZ_ASSERT(compartments_.ref().empty());
-
     JSRuntime* rt = runtimeFromAnyThread();
     if (this == rt->gc.systemZone)
         rt->gc.systemZone = nullptr;
 
     js_delete(debuggers.ref());
     js_delete(jitZone_.ref());
 
 #ifdef DEBUG
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/gc/bug-1384047.js
@@ -0,0 +1,5 @@
+if (!('oomTest' in this))
+    quit();
+
+newGlobal();
+evalcx("oomTest(newGlobal);", newGlobal());
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -3457,16 +3457,17 @@ JSCompartment::destroy(FreeOp* fop)
         JS_DropPrincipals(TlsContext.get(), principals());
     fop->delete_(this);
     rt->gc.stats().sweptCompartment();
 }
 
 void
 Zone::destroy(FreeOp* fop)
 {
+    MOZ_ASSERT(compartments().empty());
     fop->delete_(this);
     fop->runtime()->gc.stats().sweptZone();
 }
 
 /*
  * It's simpler if we preserve the invariant that every zone has at least one
  * compartment. If we know we're deleting the entire zone, then
  * SweepCompartments is allowed to delete all compartments. In this case,