| Index: src/heap/mark-compact.cc
|
| diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
|
| index 0e8014014dbd612bf68bcfe0236f668312b1d81b..65bfdd92d871a262e517452c8c14fe0989482d9b 100644
|
| --- a/src/heap/mark-compact.cc
|
| +++ b/src/heap/mark-compact.cc
|
| @@ -3484,6 +3484,7 @@ void MarkCompactCollector::RemoveObjectSlots(Address start_slot,
|
| }
|
| }
|
|
|
| +
|
| #ifdef VERIFY_HEAP
|
| static void VerifyAllBlackObjects(MemoryChunk* page) {
|
| LiveObjectIterator<kAllLiveObjects> it(page);
|
| @@ -3494,6 +3495,7 @@ static void VerifyAllBlackObjects(MemoryChunk* page) {
|
| }
|
| #endif // VERIFY_HEAP
|
|
|
| +
|
| bool MarkCompactCollector::VisitLiveObjects(MemoryChunk* page,
|
| HeapObjectVisitor* visitor,
|
| IterationMode mode) {
|
| @@ -3502,14 +3504,15 @@ bool MarkCompactCollector::VisitLiveObjects(MemoryChunk* page,
|
| #endif // VERIFY_HEAP
|
|
|
| LiveObjectIterator<kBlackObjects> it(page);
|
| - HeapObject* object = NULL;
|
| - while ((object = it.Next()) != NULL) {
|
| + HeapObject* object = nullptr;
|
| + while ((object = it.Next()) != nullptr) {
|
| DCHECK(Marking::IsBlack(Marking::MarkBitFrom(object)));
|
| if (!visitor->Visit(object)) {
|
| if (mode == kClearMarkbits) {
|
| page->markbits()->ClearRange(
|
| page->AddressToMarkbitIndex(page->area_start()),
|
| page->AddressToMarkbitIndex(object->address()));
|
| + RecomputeLiveBytes(page);
|
| }
|
| return false;
|
| }
|
| @@ -3521,6 +3524,17 @@ bool MarkCompactCollector::VisitLiveObjects(MemoryChunk* page,
|
| }
|
|
|
|
|
| +void MarkCompactCollector::RecomputeLiveBytes(MemoryChunk* page) {
|
| + LiveObjectIterator<kBlackObjects> it(page);
|
| + int new_live_size = 0;
|
| + HeapObject* object = nullptr;
|
| + while ((object = it.Next()) != nullptr) {
|
| + new_live_size += object->Size();
|
| + }
|
| + page->SetLiveBytes(new_live_size);
|
| +}
|
| +
|
| +
|
| void MarkCompactCollector::VisitLiveObjectsBody(Page* page,
|
| ObjectVisitor* visitor) {
|
| #ifdef VERIFY_HEAP
|
|
|