[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: Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/master@{#53724}
This commit is contained in:
parent
80ec11d20d
commit
5376bc2534
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user