[vm] Fix missing null check in FLAG_force_evacuation.

Bug: https://github.com/dart-lang/sdk/issues/37772
Change-Id: I4e62dd0355fe0ebc7716de05a093142389067191
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112403
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Samir Jindel 2019-08-09 20:51:41 +00:00 committed by commit-bot@chromium.org
parent 271ad96813
commit 4ebde3fa9b

View file

@ -213,11 +213,19 @@ void GCCompactor::Compact(HeapPage* pages,
// objects move and all pages that used to have an object are released.
// This can be helpful for finding untracked pointers because it prevents
// an untracked pointer from getting lucky with its target not moving.
for (intptr_t task_index = 0; task_index < num_tasks; task_index++) {
bool oom = false;
for (intptr_t task_index = 0; task_index < num_tasks && !oom;
task_index++) {
const intptr_t pages_per_task = num_pages / num_tasks;
for (intptr_t j = 0; j < pages_per_task; j++) {
HeapPage* page = heap_->old_space()->AllocatePage(HeapPage::kData,
/* link */ false);
if (page == nullptr) {
oom = true;
break;
}
FreeListElement::AsElement(page->object_start(),
page->object_end() - page->object_start());