Bug 808067 - Fix needsBarrier for GC (r=sstangl,jonco)
authorBill McCloskey <wmccloskey@mozilla.com>
Wed, 07 Nov 2012 10:30:30 -0800
changeset 112669 bdd3bfd15630dca7e468e1b77081db88beb79a2a
parent 112668 b5d536720f2c5964272b1ed4bf0cf223866e36cf
child 112671 e0d7b394462b18bea7f70c5f6aa297800371d666
push id23833
push useremorley@mozilla.com
push dateThu, 08 Nov 2012 10:20:57 +0000
treeherdermozilla-central@e0d7b394462b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssstangl, jonco
bugs808067
milestone19.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 808067 - Fix needsBarrier for GC (r=sstangl,jonco)
js/src/jit-test/lib/prolog.js
js/src/jit-test/tests/basic/bug808067.js
js/src/jsgc.cpp
--- a/js/src/jit-test/lib/prolog.js
+++ b/js/src/jit-test/lib/prolog.js
@@ -27,10 +27,14 @@ if (!("selectforgc" in this)) {
 if (!("verifyprebarriers" in this)) {
   verifyprebarriers = function() { }
 }
 
 if (!("verifypostbarriers" in this)) {
   verifypostbarriers = function() { }
 }
 
+if (!("gcPreserveCode" in this)) {
+  gcPreserveCode = function() { }
+}
+
 if ("options" in this)
     options("allow_xml");
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/bug808067.js
@@ -0,0 +1,19 @@
+function TestCase(n, d, e, a)
+  this.reason = '';
+function reportCompare (expected, actual, description) {
+  var output = "";
+  var testcase = new TestCase("unknown-test-name", description, expected, actual);
+  testcase.reason = output;
+}
+gcPreserveCode();
+var summary = 'return with argument and lazy generator detection';
+expect = "generator function foo returns a value";
+actual = (function (j)  {}).message;
+reportCompare(expect, actual, summary + ": 1");
+reportCompare(expect, actual, summary + ": 2");
+gcslice(0);
+gcslice(1);
+gc();
+var strings = [ (0), ];
+for (var i = 0; i < strings.length; i++)
+  reportCompare(expect, actual, summary + (5e1) + strings[i]);
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -4078,17 +4078,17 @@ ResetIncrementalGC(JSRuntime *rt, const 
         return;
 
     /* Cancel and ongoing marking. */
     bool wasMarking = false;
     {
         AutoCopyFreeListToArenas copy(rt);
         for (GCCompartmentsIter c(rt); !c.done(); c.next()) {
             if (c->isGCMarking()) {
-                c->setNeedsBarrier(false, JSCompartment::DontUpdateIon);
+                c->setNeedsBarrier(false, JSCompartment::UpdateIon);
                 c->setGCState(JSCompartment::NoGC);
                 wasMarking = true;
             }
         }
     }
 
     if (wasMarking)
         rt->gcMarker.reset();
@@ -4153,22 +4153,22 @@ AutoGCSlice::AutoGCSlice(JSRuntime *rt)
         } else {
             JS_ASSERT(!c->needsBarrier());
         }
     }
 }
 
 AutoGCSlice::~AutoGCSlice()
 {
-    for (GCCompartmentsIter c(runtime); !c.done(); c.next()) {
+    /* We can't use GCCompartmentsIter if this is the end of the last slice. */
+    for (CompartmentsIter c(runtime); !c.done(); c.next()) {
         if (c->isGCMarking()) {
             c->setNeedsBarrier(true, JSCompartment::UpdateIon);
             c->arenas.prepareForIncrementalGC(runtime);
         } else {
-            JS_ASSERT(c->isGCSweeping());
             c->setNeedsBarrier(false, JSCompartment::UpdateIon);
         }
     }
 }
 
 static void
 PushZealSelectedObjects(JSRuntime *rt)
 {