Bug 1390087 - Ignore zones that we can't collect when scheduling zones for GC r=sfink a=gchang
authorJon Coppeard <jcoppeard@mozilla.com>
Tue, 15 Aug 2017 10:31:12 +0100
changeset 423602 594c90fb0183968b0d4ffe3ea2a5a5a0578be3bb
parent 423601 36f2da27aa91c72fb93505a13089e78d7bdb1dd6
child 423603 933e3d98fb65f36c129ed3dc625c84636c42581c
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink, gchang
bugs1390087
milestone56.0
Bug 1390087 - Ignore zones that we can't collect when scheduling zones for GC r=sfink a=gchang
js/src/jit-test/tests/gc/bug-1390087.js
js/src/jsgc.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/gc/bug-1390087.js
@@ -0,0 +1,11 @@
+if (helperThreadCount() === 0)
+    quit();
+
+setGCCallback({
+    action: "majorGC"
+});
+gcparam("allocationThreshold", 1);
+offThreadCompileScript("");
+for (let i = 0; i < 40000; i++)
+    Symbol.for(i);
+eval(0);
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -6786,16 +6786,19 @@ GCRuntime::budgetIncrementalGC(bool noni
 
     if (isTooMuchMalloc()) {
         budget.makeUnlimited();
         stats().nonincremental(AbortReason::MallocBytesTrigger);
     }
 
     bool reset = false;
     for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) {
+        if (!zone->canCollect())
+            continue;
+
         if (zone->usage.gcBytes() >= zone->threshold.gcTriggerBytes()) {
             MOZ_ASSERT(zone->isGCScheduled());
             budget.makeUnlimited();
             stats().nonincremental(AbortReason::GCBytesTrigger);
         }
 
         if (zone->isTooMuchMalloc()) {
             MOZ_ASSERT(zone->isGCScheduled());
@@ -6817,16 +6820,19 @@ namespace {
 
 class AutoScheduleZonesForGC
 {
     JSRuntime* rt_;
 
   public:
     explicit AutoScheduleZonesForGC(JSRuntime* rt) : rt_(rt) {
         for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) {
+            if (!zone->canCollect())
+                continue;
+
             if (rt->gc.gcMode() == JSGC_MODE_GLOBAL)
                 zone->scheduleGC();
 
             // This is a heuristic to avoid resets.
             if (rt->gc.isIncrementalGCInProgress() && zone->needsIncrementalBarrier())
                 zone->scheduleGC();
 
             // This is a heuristic to reduce the total number of collections.