Bug 1397314 - Revert to original calculation for sizing the nursery. r=jonco
authorPaul Bone <pbone@mozilla.com>
Fri, 08 Sep 2017 12:22:49 +1000
changeset 661554 7ac52205995fc6bc4f2d1439d8941f964c526771
parent 661553 ab6b3bbeb98b28bf35a6d374c78802ad4b1d3f72
child 661555 6ee4de08ac3767c4d15338f830dc3763d5da769a
push id78830
push userasasaki@mozilla.com
push dateFri, 08 Sep 2017 19:44:43 +0000
reviewersjonco
bugs1397314
milestone57.0a1
Bug 1397314 - Revert to original calculation for sizing the nursery. r=jonco
js/src/gc/Nursery.cpp
--- a/js/src/gc/Nursery.cpp
+++ b/js/src/gc/Nursery.cpp
@@ -969,37 +969,38 @@ js::Nursery::maybeResizeNursery(JS::gcre
     }
 
 #ifdef JS_GC_ZEAL
     // This zeal mode disabled nursery resizing.
     if (runtime()->hasZealMode(ZealMode::GenerationalGC))
         return;
 #endif
 
-    bool canUsePromotionRate;
-    const float promotionRate = calcPromotionRate(&canUsePromotionRate);
+    /*
+     * This incorrect promotion rate results in better nursery sizing
+     * decisions, however we should to better tuning based on the real
+     * promotion rate in the future.
+     */
+    const float promotionRate =
+        float(previousGC.tenuredBytes) / float(previousGC.nurseryCapacity);
 
     newMaxNurseryChunks = runtime()->gc.tunables.gcMaxNurseryBytes() >> ChunkShift;
     if (newMaxNurseryChunks != maxNurseryChunks_) {
         maxNurseryChunks_ = newMaxNurseryChunks;
         /* The configured maximum nursery size is changing */
         const int extraChunks = numChunks() - newMaxNurseryChunks;
         if (extraChunks > 0) {
             /* We need to shrink the nursery */
             shrinkAllocableSpace(extraChunks);
 
-            if (canUsePromotionRate)
-                previousPromotionRate_ = promotionRate;
+            previousPromotionRate_ = promotionRate;
             return;
         }
     }
 
-    if (!canUsePromotionRate)
-        return;
-
     if (promotionRate > GrowThreshold)
         growAllocableSpace();
     else if (promotionRate < ShrinkThreshold && previousPromotionRate_ < ShrinkThreshold)
         shrinkAllocableSpace(1);
 
     previousPromotionRate_ = promotionRate;
 }