Reset nursery position when it's disabled.

This commit is contained in:
Jon Coppeard 2019-03-22 13:17:31 +01:00 committed by Roy Tam
commit 4105e6bba4
2 changed files with 2 additions and 0 deletions

View file

@ -210,6 +210,7 @@ js::Nursery::disable()
return;
updateNumChunks(0);
currentEnd_ = 0;
position_ = 0;
runtime()->gc.storeBuffer.disable();
}

View file

@ -245,6 +245,7 @@ class Nursery
// Free space remaining, not counting chunk trailers.
MOZ_ALWAYS_INLINE size_t freeSpace() const {
MOZ_ASSERT(isEnabled());
MOZ_ASSERT(currentEnd_ - position_ <= NurseryChunkUsableSize);
return (currentEnd_ - position_) +
(numChunks() - currentChunk_ - 1) * NurseryChunkUsableSize;