Bug 1346874 - Skip gray mark check stack walk on DEBUG Android, r=mccr8
authorSteve Fink <sfink@mozilla.com>
Mon, 13 Mar 2017 10:43:09 -0700
changeset 347478 42720d7bd306f4a700a28ed2c78ad32381777570
parent 347477 950180909fd0e5031a04fcd4cb8f94ff4be72ae6
child 347479 22874b29ac930217a734d5adcb61d34011328124
push id31497
push usercbook@mozilla.com
push dateTue, 14 Mar 2017 13:23:16 +0000
treeherdermozilla-central@08f709c14bf7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1346874
milestone55.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 1346874 - Skip gray mark check stack walk on DEBUG Android, r=mccr8
js/src/jsgc.cpp
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -7933,21 +7933,29 @@ js::gc::detail::CellIsNotGray(const Cell
 
     if (!CanCheckGrayBits(cell))
         return true;
 
     auto tc = &cell->asTenured();
     if (!detail::CellIsMarkedGray(tc))
         return true;
 
+    // The cell is gray, but may eventually be marked black if we are in an
+    // incremental GC and the cell is reachable by something on the mark stack.
+
     auto rt = tc->runtimeFromAnyThread();
-    Zone* sourceZone = nullptr;
-    if (rt->gc.isIncrementalGCInProgress() &&
-        !tc->zone()->wasGCStarted() &&
-        (sourceZone = rt->gc.marker.stackContainsCrossZonePointerTo(tc)) &&
-        sourceZone->wasGCStarted())
-    {
+    if (!rt->gc.isIncrementalGCInProgress() || tc->zone()->wasGCStarted())
+        return false;
+
+    // Bug 1346874 - The stack check is expensive. Android tests are already
+    // slow enough that this check can easily push them over the threshold to a
+    // timeout. So always assume the best on Android.
+# ifdef ANDROID
+    return true;
+# else
+    Zone* sourceZone = rt->gc.marker.stackContainsCrossZonePointerTo(tc);
+    if (sourceZone && sourceZone->wasGCStarted())
         return true;
-    }
 
     return false;
+# endif
 }
 #endif