Index: src/heap/mark-compact.cc |
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc |
index bad3495bbe4befe1c583ff680b66bc8a845ff213..8b1c7085c0b2fdf8190b3193b69a6059bd54e223 100644 |
--- a/src/heap/mark-compact.cc |
+++ b/src/heap/mark-compact.cc |
@@ -133,7 +133,7 @@ |
// page->area_start() as start of range on all pages. |
CHECK_EQ(space->bottom(), Page::FromAddress(space->bottom())->area_start()); |
- PageRange range(space->bottom(), end); |
+ NewSpacePageRange range(space->bottom(), end); |
for (auto it = range.begin(); it != range.end();) { |
Page* page = *(it++); |
Address limit = it != range.end() ? page->area_end() : end; |
@@ -185,21 +185,29 @@ |
static void VerifyEvacuation(Page* page) { |
VerifyEvacuationVisitor visitor; |
HeapObjectIterator iterator(page); |
- for (HeapObject* heap_object = iterator.Next(); heap_object != nullptr; |
+ for (HeapObject* heap_object = iterator.Next(); heap_object != NULL; |
heap_object = iterator.Next()) { |
- CHECK(!heap_object->IsFiller()); |
- heap_object->Iterate(&visitor); |
+ // We skip free space objects. |
+ if (!heap_object->IsFiller()) { |
+ heap_object->Iterate(&visitor); |
+ } |
} |
} |
static void VerifyEvacuation(NewSpace* space) { |
VerifyEvacuationVisitor visitor; |
- HeapObjectIterator iterator(space); |
- for (HeapObject* heap_object = iterator.Next(); heap_object != nullptr; |
- heap_object = iterator.Next()) { |
- CHECK(!heap_object->IsFiller()); |
- heap_object->Iterate(&visitor); |
+ NewSpacePageRange range(space->bottom(), space->top()); |
+ for (auto it = range.begin(); it != range.end();) { |
+ Page* page = *(it++); |
+ Address current = page->area_start(); |
+ Address limit = it != range.end() ? page->area_end() : space->top(); |
+ CHECK(limit == space->top() || !page->Contains(space->top())); |
+ while (current < limit) { |
+ HeapObject* object = HeapObject::FromAddress(current); |
+ object->Iterate(&visitor); |
+ current += object->Size(); |
+ } |
} |
} |
@@ -324,7 +332,7 @@ |
void MarkCompactCollector::VerifyMarkbitsAreClean(NewSpace* space) { |
- for (Page* p : PageRange(space->bottom(), space->top())) { |
+ for (Page* p : NewSpacePageRange(space->bottom(), space->top())) { |
CHECK(p->markbits()->IsClean()); |
CHECK_EQ(0, p->LiveBytes()); |
} |
@@ -1956,7 +1964,7 @@ |
void MarkCompactCollector::DiscoverGreyObjectsInNewSpace() { |
NewSpace* space = heap()->new_space(); |
- for (Page* page : PageRange(space->bottom(), space->top())) { |
+ for (Page* page : NewSpacePageRange(space->bottom(), space->top())) { |
DiscoverGreyObjectsOnPage(page); |
if (marking_deque()->IsFull()) return; |
} |
@@ -3023,7 +3031,7 @@ |
void MarkCompactCollector::EvacuateNewSpacePrologue() { |
NewSpace* new_space = heap()->new_space(); |
// Append the list of new space pages to be processed. |
- for (Page* p : PageRange(new_space->bottom(), new_space->top())) { |
+ for (Page* p : NewSpacePageRange(new_space->bottom(), new_space->top())) { |
newspace_evacuation_candidates_.Add(p); |
} |
new_space->Flip(); |
@@ -3809,7 +3817,7 @@ |
heap, heap->isolate()->cancelable_task_manager(), semaphore); |
Address space_start = heap->new_space()->bottom(); |
Address space_end = heap->new_space()->top(); |
- for (Page* page : PageRange(space_start, space_end)) { |
+ for (Page* page : NewSpacePageRange(space_start, space_end)) { |
Address start = |
page->Contains(space_start) ? space_start : page->area_start(); |
Address end = page->Contains(space_end) ? space_end : page->area_end(); |