Bug 1264300 - Don't evict the nursery unnecessarily in ZoneCellIter r=sfink a=abillings FIREFOX_47_0b8_BUILD1 FIREFOX_47_0b8_RELEASE
authorJon Coppeard <jcoppeard@mozilla.com>
Thu, 05 May 2016 11:01:11 +0100
changeset 324457 cb27eacbe04abc5f91a0379c23617715aab432ec
parent 324456 c21d7a173aa1fb9de39f0b90d8c357749115236a
child 324458 de10e990d8610a329bc4905acd6d1408e73983db
child 324460 a112e55fc5e008fad91fc0aeea92cbc37bd23476
push id6018
push userkwierso@gmail.com
push dateMon, 23 May 2016 18:31:32 +0000
treeherdermozilla-beta@cb27eacbe04a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink, abillings
bugs1264300
milestone47.0
Bug 1264300 - Don't evict the nursery unnecessarily in ZoneCellIter r=sfink a=abillings
js/src/jsgcinlines.h
--- a/js/src/jsgcinlines.h
+++ b/js/src/jsgcinlines.h
@@ -190,17 +190,17 @@ class ZoneCellIterImpl
 {
     ArenaIter arenaIter;
     ArenaCellIterImpl cellIter;
 
   public:
     ZoneCellIterImpl(JS::Zone* zone, AllocKind kind) {
         JSRuntime* rt = zone->runtimeFromAnyThread();
         MOZ_ASSERT(zone);
-        MOZ_ASSERT(rt->gc.nursery.isEmpty());
+        MOZ_ASSERT_IF(IsNurseryAllocable(kind), rt->gc.nursery.isEmpty());
 
         // We have a single-threaded runtime, so there's no need to protect
         // against other threads iterating or allocating. However, we do have
         // background finalization; we may have to wait for this to finish if
         // it's currently active.
         if (IsBackgroundFinalized(kind) && zone->arenas.needBackgroundFinalizeWait(kind))
             rt->gc.waitBackgroundSweepEnd();
 
@@ -251,18 +251,20 @@ class ZoneCellIter
     JS::AutoAssertNoAlloc noAlloc;
 
   public:
     ZoneCellIter(JS::Zone* zone, AllocKind kind) {
         // If called from outside a GC, ensure that the heap is in a state
         // that allows us to iterate.
         JSRuntime* rt = zone->runtimeFromMainThread();
         if (!rt->isHeapBusy()) {
-            // Evict the nursery before iterating so we can see all things.
-            rt->gc.evictNursery();
+            // If we are iterating a nursery-allocated kind then we need to
+            // evict first so that we can see all things.
+            if (IsNurseryAllocable(kind))
+                rt->gc.evictNursery();
 
             // Assert that no GCs can occur while a ZoneCellIter is live.
             noAlloc.disallowAlloc(rt);
         }
 
         impl.emplace(zone, kind);
     }