Bug 1380387 - Only repeat shutdown GCs for removed roots r=sfink
authorJon Coppeard <jcoppeard@mozilla.com>
Fri, 14 Jul 2017 19:01:49 +0100
changeset 369251 eb92b29f5500e747424882769b72d8d4770ae338
parent 369250 bc861f3448315ffe829b3b800838ac8ed2b90a0b
child 369252 baa7949eb81f019e2caa44a8d7302a9c5a2208b8
push id46631
push userkwierso@gmail.com
push dateTue, 18 Jul 2017 00:38:28 +0000
treeherderautoland@216a5bf264b2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1380387
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 1380387 - Only repeat shutdown GCs for removed roots r=sfink
js/src/jsgc.cpp
js/src/tests/js1_8_5/extensions/collect-gray.js
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -6983,26 +6983,25 @@ GCRuntime::collect(bool nonincrementalBy
             MOZ_ASSERT(!isIncrementalGCInProgress());
             break;
         }
 
         /*
          * Sometimes when we finish a GC we need to immediately start a new one.
          * This happens in the following cases:
          *  - when we reset the current GC
-         *  - when finalizers drop roots during shutdown (the cleanUpEverything
-         *    case)
+         *  - when finalizers drop roots during shutdown
          *  - when zones that we thought were dead at the start of GC are
          *    not collected (see the large comment in beginMarkPhase)
          */
         repeat = false;
         if (!isIncrementalGCInProgress()) {
             if (wasReset) {
                 repeat = true;
-            } else if (rootsRemoved && cleanUpEverything) {
+            } else if (rootsRemoved && IsShutdownGC(reason)) {
                 /* Need to re-schedule all zones for GC. */
                 JS::PrepareForFullGC(rt->activeContextFromOwnThread());
                 repeat = true;
                 reason = JS::gcreason::ROOTS_REMOVED;
             } else if (shouldRepeatForDeadZone(reason)) {
                 repeat = true;
                 reason = JS::gcreason::COMPARTMENT_REVIVED;
             }
--- a/js/src/tests/js1_8_5/extensions/collect-gray.js
+++ b/js/src/tests/js1_8_5/extensions/collect-gray.js
@@ -63,16 +63,19 @@ assertEq(marks[3], 'gray', 'black map, g
 
 // Test edges from map&delegate => key and map&key => value.
 //
 // In general, when a&b => x, then if both a and b are black, then x must be
 // black. If either is gray and the other is marked (gray or black), then x
 // must be gray (unless otherwise reachable from black.) If neither a nor b is
 // marked at all, then they will not keep x alive.
 
+if (typeof gczeal !== 'undefined')
+    gczeal(0);
+
 clearMarkObservers();
 
 // Black map, gray delegate => gray key
 
 // wm is in a variable, so is black.
 wm = new WeakMap();
 
 let key = Object.create(null);