Reset nursery position when it's disabled.

This commit is contained in:
Fedor 2019-05-20 09:01:15 +03:00
parent 01b53534c3
commit 66d7b35f08
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;