Chromium Code Reviews| Index: src/heap/mark-compact.cc |
| diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc |
| index eca2880acd174b0bc7e6e620899ad17f6cd3d794..5d3f13bd91400a8b8f802ab57b7092bec0738f95 100644 |
| --- a/src/heap/mark-compact.cc |
| +++ b/src/heap/mark-compact.cc |
| @@ -104,8 +104,7 @@ static void VerifyMarking(Heap* heap, Address bottom, Address top) { |
| VerifyMarkingVisitor visitor(heap); |
| HeapObject* object; |
| Address next_object_must_be_here_or_later = bottom; |
| - |
| - for (Address current = bottom; current < top; current += kPointerSize) { |
| + for (Address current = bottom; current < top;) { |
| object = HeapObject::FromAddress(current); |
| if (MarkCompactCollector::IsMarked(object)) { |
| CHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(object))); |
| @@ -113,21 +112,13 @@ static void VerifyMarking(Heap* heap, Address bottom, Address top) { |
| object->Iterate(&visitor); |
| next_object_must_be_here_or_later = current + object->Size(); |
| // The next word for sure belongs to the current object, jump over it. |
| + current = next_object_must_be_here_or_later; |
|
ulan
2016/07/19 13:23:32
This is making verification less strict.
How abou
Hannes Payer (out of office)
2016/07/19 14:42:53
Good idea! Done.
|
| + } else { |
| current += kPointerSize; |
| } |
| } |
| } |
| -static void VerifyMarkingBlackPage(Heap* heap, Page* page) { |
| - CHECK(page->IsFlagSet(Page::BLACK_PAGE)); |
| - VerifyMarkingVisitor visitor(heap); |
| - HeapObjectIterator it(page); |
| - for (HeapObject* object = it.Next(); object != NULL; object = it.Next()) { |
| - CHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(object))); |
| - object->Iterate(&visitor); |
| - } |
| -} |
| - |
| static void VerifyMarking(NewSpace* space) { |
| Address end = space->top(); |
| // The bottom position is at the start of its page. Allows us to use |
| @@ -146,11 +137,7 @@ static void VerifyMarking(NewSpace* space) { |
| static void VerifyMarking(PagedSpace* space) { |
| for (Page* p : *space) { |
| - if (p->IsFlagSet(Page::BLACK_PAGE)) { |
| - VerifyMarkingBlackPage(space->heap(), p); |
| - } else { |
| - VerifyMarking(space->heap(), p->area_start(), p->area_end()); |
| - } |
| + VerifyMarking(space->heap(), p->area_start(), p->area_end()); |
| } |
| } |
| @@ -409,9 +396,6 @@ void MarkCompactCollector::VerifyOmittedMapChecks() { |
| static void ClearMarkbitsInPagedSpace(PagedSpace* space) { |
| for (Page* p : *space) { |
| p->ClearLiveness(); |
| - if (p->IsFlagSet(Page::BLACK_PAGE)) { |
| - p->ClearFlag(Page::BLACK_PAGE); |
| - } |
| } |
| } |
| @@ -435,9 +419,6 @@ void MarkCompactCollector::ClearMarkbits() { |
| MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address()); |
| chunk->ResetProgressBar(); |
| chunk->ResetLiveBytes(); |
| - if (chunk->IsFlagSet(Page::BLACK_PAGE)) { |
| - chunk->ClearFlag(Page::BLACK_PAGE); |
| - } |
| } |
| } |
| @@ -659,7 +640,6 @@ void MarkCompactCollector::CollectEvacuationCandidates(PagedSpace* space) { |
| for (Page* p : *space) { |
| if (p->NeverEvacuate()) continue; |
| - if (p->IsFlagSet(Page::BLACK_PAGE)) continue; |
| // Invariant: Evacuation candidates are just created when marking is |
| // started. This means that sweeping has finished. Furthermore, at the end |
| // of a GC all evacuation candidates are cleared and their slot buffers are |
| @@ -1913,9 +1893,7 @@ class MarkCompactCollector::EvacuateRecordOnlyVisitor final |
| void MarkCompactCollector::DiscoverGreyObjectsInSpace(PagedSpace* space) { |
| for (Page* p : *space) { |
| - if (!p->IsFlagSet(Page::BLACK_PAGE)) { |
| - DiscoverGreyObjectsOnPage(p); |
| - } |
| + DiscoverGreyObjectsOnPage(p); |
| if (marking_deque()->IsFull()) return; |
| } |
| } |
| @@ -2929,9 +2907,8 @@ bool MarkCompactCollector::IsSlotInBlackObject(MemoryChunk* p, Address slot) { |
| DCHECK(owner != heap_->lo_space() && owner != nullptr); |
| USE(owner); |
| - // If we are on a black page, we cannot find the actual object start |
| - // easiliy. We just return true but do not set the out_object. |
| - if (p->IsFlagSet(Page::BLACK_PAGE)) { |
| + // We may be part of a black area. |
| + if (Marking::IsBlackOrGrey(ObjectMarking::MarkBitFrom(slot))) { |
| return true; |
| } |
| @@ -3028,27 +3005,16 @@ HeapObject* MarkCompactCollector::FindBlackObjectBySlotSlow(Address slot) { |
| return nullptr; |
| } |
| - if (p->IsFlagSet(Page::BLACK_PAGE)) { |
| - HeapObjectIterator it(p); |
| - HeapObject* object = nullptr; |
| - while ((object = it.Next()) != nullptr) { |
| - int size = object->Size(); |
| - if (object->address() > slot) return nullptr; |
| - if (object->address() <= slot && slot < (object->address() + size)) { |
| - return object; |
| - } |
| - } |
| - } else { |
| - LiveObjectIterator<kBlackObjects> it(p); |
| - HeapObject* object = nullptr; |
| - while ((object = it.Next()) != nullptr) { |
| - int size = object->Size(); |
| - if (object->address() > slot) return nullptr; |
| - if (object->address() <= slot && slot < (object->address() + size)) { |
| - return object; |
| - } |
| + LiveObjectIterator<kBlackObjects> it(p); |
| + HeapObject* object = nullptr; |
| + while ((object = it.Next()) != nullptr) { |
| + int size = object->Size(); |
| + if (object->address() > slot) return nullptr; |
| + if (object->address() <= slot && slot < (object->address() + size)) { |
| + return object; |
| } |
| } |
| + |
| return nullptr; |
| } |
| @@ -3385,7 +3351,6 @@ int MarkCompactCollector::Sweeper::RawSweep( |
| DCHECK(free_list_mode == IGNORE_FREE_LIST || space->identity() == OLD_SPACE || |
| space->identity() == CODE_SPACE || space->identity() == MAP_SPACE); |
| DCHECK(!p->IsEvacuationCandidate() && !p->SweepingDone()); |
| - DCHECK(!p->IsFlagSet(Page::BLACK_PAGE)); |
| // Before we sweep objects on the page, we free dead array buffers which |
| // requires valid mark bits. |
| @@ -3938,7 +3903,6 @@ void MarkCompactCollector::Sweeper::AddSweepingPageSafe(AllocationSpace space, |
| } |
| void MarkCompactCollector::StartSweepSpace(PagedSpace* space) { |
| - Address space_top = space->top(); |
| space->ClearStats(); |
| int will_be_swept = 0; |
| @@ -3955,24 +3919,6 @@ void MarkCompactCollector::StartSweepSpace(PagedSpace* space) { |
| continue; |
| } |
| - // We can not sweep black pages, since all mark bits are set for these |
| - // pages. |
| - if (p->IsFlagSet(Page::BLACK_PAGE)) { |
| - p->ClearLiveness(); |
| - p->concurrent_sweeping_state().SetValue(Page::kSweepingDone); |
| - p->ClearFlag(Page::BLACK_PAGE); |
| - // Area above the high watermark is free. |
| - Address free_start = p->HighWaterMark(); |
| - // Check if the space top was in this page, which means that the |
| - // high watermark is not up-to-date. |
| - if (free_start < space_top && space_top <= p->area_end()) { |
| - free_start = space_top; |
| - } |
| - int size = static_cast<int>(p->area_end() - free_start); |
| - space->Free(free_start, size); |
| - continue; |
| - } |
| - |
| if (p->IsFlagSet(Page::NEVER_ALLOCATE_ON_PAGE)) { |
| // We need to sweep the page to get it into an iterable state again. Note |
| // that this adds unusable memory into the free list that is later on |