diff --git a/js/src/gc/Nursery.cpp b/js/src/gc/Nursery.cpp index 01b0ee9a86f9..ef7e88e63b0b 100644 --- a/js/src/gc/Nursery.cpp +++ b/js/src/gc/Nursery.cpp @@ -860,12 +860,6 @@ void js::Nursery::collect(JS::GCReason reason) { if (rt->gc.heapSize.gcBytes() >= tunables().gcMaxBytes()) { disable(); } - // Disable the nursery if the user changed the configuration setting. The - // nursery can only be re-enabled by resetting the configurationa and - // restarting firefox. - if (chunkCountLimit_ == 0) { - disable(); - } endProfile(ProfileKey::Total); rt->gc.incMinorGcNumber(); @@ -1219,6 +1213,14 @@ void js::Nursery::maybeResizeNursery(JS::GCReason reason) { } bool js::Nursery::maybeResizeExact(JS::GCReason reason) { + // Disable the nursery if the user changed the configuration setting. The + // nursery can only be re-enabled by resetting the configuration and + // restarting firefox. + if (tunables().gcMaxNurseryBytes() == 0) { + disable(); + return true; + } + // Shrink the nursery to its minimum size of we ran out of memory or // received a memory pressure event. if (gc::IsOOMReason(reason)) { diff --git a/js/src/jit-test/tests/gc/bug1538594.js b/js/src/jit-test/tests/gc/bug1538594.js new file mode 100644 index 000000000000..566add022866 --- /dev/null +++ b/js/src/jit-test/tests/gc/bug1538594.js @@ -0,0 +1,9 @@ + +// This disables the nursery. +gcparam('maxNurseryBytes', 0); + +assertEq(gcparam('maxNurseryBytes'), 0); +gc(); + + +