Commit 5376bc25 authored by Wez's avatar Wez Committed by Commit Bot

[heap] Fix Commit() and GrowTo() not to call RewindPages() with zero.

Commit() and GrowTo() iterate allocating pages, and call RewindPages()
if an iteration fails. This is true even if the first iteration fails,
in which case there are no pages to rewind, and RewindPages() DCHECKs.

Only call RewindPages() if we are on the second or later iteration.

Bug: chromium:851626
Change-Id: Ifb644416331b5129c679983bc6af0d21c3ce14d8
Reviewed-on: https://chromium-review.googlesource.com/1099605
Commit-Queue: Wez <wez@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53724}
parent 80ec11d2
......@@ -2415,7 +2415,7 @@ bool SemiSpace::Commit() {
heap()->memory_allocator()->AllocatePage<MemoryAllocator::kPooled>(
Page::kAllocatableMemory, this, NOT_EXECUTABLE);
if (new_page == nullptr) {
RewindPages(pages_added);
if (pages_added) RewindPages(pages_added);
return false;
}
memory_chunk_list_.PushBack(new_page);
......@@ -2472,7 +2472,7 @@ bool SemiSpace::GrowTo(size_t new_capacity) {
heap()->memory_allocator()->AllocatePage<MemoryAllocator::kPooled>(
Page::kAllocatableMemory, this, NOT_EXECUTABLE);
if (new_page == nullptr) {
RewindPages(pages_added);
if (pages_added) RewindPages(pages_added);
return false;
}
memory_chunk_list_.PushBack(new_page);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment