Bug 1584181 - Evict the nursery before entering zeal mode r=jonco
authorPaul Bone <pbone@mozilla.com>
Thu, 10 Oct 2019 09:43:08 +0000
changeset 497203 960a7e198846fecdfe46663bd04e1480e46f2399
parent 497202 01862196080a8155c6300278166b40ce9169976a
child 497204 94ab8abd4d3a1be6568b84cc9eb93a12b514c4f3
push id36679
push userdluca@mozilla.com
push dateFri, 11 Oct 2019 09:30:10 +0000
treeherdermozilla-central@a7ca5ad33f3d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1584181
milestone71.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 1584181 - Evict the nursery before entering zeal mode r=jonco Entering generational zeal mode can reduce the nursery size which causes this assertion failure when the maximum size becomes smaller than the current size. This patch evicts the nursery before entering generational zeal mode. Note that we already do this when leaving generational zeal mode. The assumption was that zeal mode is at least as large as any normal configuration. Differential Revision: https://phabricator.services.mozilla.com/D48801
js/src/gc/GC.cpp
js/src/gc/Nursery.cpp
--- a/js/src/gc/GC.cpp
+++ b/js/src/gc/GC.cpp
@@ -1013,16 +1013,17 @@ void GCRuntime::setZeal(uint8_t zeal, ui
 
     if (isIncrementalGCInProgress()) {
       finishGC(JS::GCReason::DEBUG_GC);
     }
   }
 
   ZealMode zealMode = ZealMode(zeal);
   if (zealMode == ZealMode::GenerationalGC) {
+    evictNursery(JS::GCReason::DEBUG_GC);
     nursery().enterZealMode();
   }
 
   // Some modes are mutually exclusive. If we're setting one of those, we
   // first reset all of them.
   if (IncrementalSliceZealModes.contains(zealMode)) {
     for (auto mode : IncrementalSliceZealModes) {
       clearZealMode(mode);
--- a/js/src/gc/Nursery.cpp
+++ b/js/src/gc/Nursery.cpp
@@ -360,16 +360,17 @@ bool js::Nursery::isEmpty() const {
     MOZ_ASSERT(currentStartPosition_ == chunk(0).start());
   }
   return position() == currentStartPosition_;
 }
 
 #ifdef JS_GC_ZEAL
 void js::Nursery::enterZealMode() {
   if (isEnabled()) {
+    MOZ_ASSERT(isEmpty());
     if (isSubChunkMode()) {
       // The poisoning call below must not race with background decommit,
       // which could be attempting to decommit the currently-unused part of this
       // chunk.
       decommitTask.join();
       {
         AutoEnterOOMUnsafeRegion oomUnsafe;
         if (!chunk(0).markPagesInUseHard(ChunkSize - ArenaSize)) {