Bug 994281. r=sfink
authorTerrence Cole <terrence@mozilla.com>
Mon, 21 Apr 2014 15:20:08 -0700
changeset 197971 988725fe5c1cc3986221e7a379ff00fcf31f8dcc
parent 197970 0c0a5a6b57d96b88c8de42268ed43137f4f249fb
child 197972 5ad5f92387a2887c6681a631d66a538e94d1a92b
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs994281
milestone31.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 994281. r=sfink
js/src/gc/Marking.cpp
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -351,42 +351,46 @@ IsMarked(T **thingp)
 
 template <typename T>
 static bool
 IsAboutToBeFinalized(T **thingp)
 {
     JS_ASSERT(thingp);
     JS_ASSERT(*thingp);
 
+    T *thing = *thingp;
+    JSRuntime *rt = thing->runtimeFromAnyThread();
+
     /* Permanent atoms are never finalized by non-owning runtimes. */
-    if (ThingIsPermanentAtom(*thingp) &&
-        !TlsPerThreadData.get()->associatedWith((*thingp)->runtimeFromAnyThread()))
-    {
+    if (ThingIsPermanentAtom(thing) && !TlsPerThreadData.get()->associatedWith(rt))
+        return false;
+
+#ifdef JSGC_GENERATIONAL
+    Nursery &nursery = rt->gcNursery;
+    JS_ASSERT_IF(!rt->isHeapMinorCollecting(), !nursery.isInside(thing));
+    if (rt->isHeapMinorCollecting()) {
+        if (nursery.isInside(thing))
+            return !nursery.getForwardedPointer(thingp);
         return false;
     }
+#endif
 
-#ifdef JSGC_GENERATIONAL
-    Nursery &nursery = (*thingp)->runtimeFromMainThread()->gcNursery;
-    if (nursery.isInside(*thingp))
-        return !nursery.getForwardedPointer(thingp);
-#endif
-    if (!(*thingp)->tenuredZone()->isGCSweeping())
+    if (!thing->tenuredZone()->isGCSweeping())
         return false;
 
     /*
      * We should return false for things that have been allocated during
      * incremental sweeping, but this possibility doesn't occur at the moment
      * because this function is only called at the very start of the sweeping a
      * compartment group and during minor gc. Rather than do the extra check,
      * we just assert that it's not necessary.
      */
-    JS_ASSERT_IF(!(*thingp)->runtimeFromAnyThread()->isHeapMinorCollecting(),
-                 !(*thingp)->arenaHeader()->allocatedDuringIncremental);
+    JS_ASSERT_IF(!rt->isHeapMinorCollecting(), !thing->arenaHeader()->allocatedDuringIncremental);
 
-    return !(*thingp)->isMarked();
+    return !thing->isMarked();
 }
 
 template <typename T>
 T *
 UpdateIfRelocated(JSRuntime *rt, T **thingp)
 {
     JS_ASSERT(thingp);
 #ifdef JSGC_GENERATIONAL