Bug 1585159 - Don't grow nursery in a last-ditch GC r=jonco

Differential Revision: https://phabricator.services.mozilla.com/D48292

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Paul Bone 2019-10-08 23:51:22 +00:00
parent 32fc4906ae
commit b6d24ade18
2 changed files with 22 additions and 0 deletions

View File

@ -1552,6 +1552,17 @@ void js::Nursery::shrinkAllocableSpace(size_t newCapacity) {
}
void js::Nursery::minimizeAllocableSpace() {
if (capacity_ < roundSize(tunables().gcMinNurseryBytes())) {
// The nursery is already smaller than the minimum size. This can happen
// because changing parameters (like an increase in minimum size) can only
// occur after a minor GC. See Bug 1585159.
//
// We could either do the /correct/ thing and increase the size to the
// configured minimum size. Or do nothing, keeping the nursery smaller. We
// do nothing because this can be executed as a last-ditch GC and we don't
// want to add memory pressure then.
return;
}
shrinkAllocableSpace(roundSize(tunables().gcMinNurseryBytes()));
}

View File

@ -0,0 +1,11 @@
// Set a nursery size larger than the current nursery size.
gcparam("minNurseryBytes", 1024 * 1024);
gcparam("maxBytes", gcparam("gcBytes") + 4096);
// Allocate something in the nursery.
let obj = {'foo': 38, 'bar': "A string"};
// Trigger a last-ditch GC.
print(gc(0, "last-ditch"));