Commit 5d67af1e authored by hpayer@chromium.org's avatar hpayer@chromium.org

Enable object evacuation verifier. Perform verification of evacuation...

Enable object evacuation verifier. Perform verification of evacuation candidates when sweeping is done.

BUG=
R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/407893004

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22508 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 1bebc590
...@@ -167,19 +167,14 @@ class VerifyEvacuationVisitor: public ObjectVisitor { ...@@ -167,19 +167,14 @@ class VerifyEvacuationVisitor: public ObjectVisitor {
}; };
static void VerifyEvacuation(Address bottom, Address top) { static void VerifyEvacuation(Page* page) {
VerifyEvacuationVisitor visitor; VerifyEvacuationVisitor visitor;
HeapObject* object; HeapObjectIterator iterator(page, NULL);
Address next_object_must_be_here_or_later = bottom; for (HeapObject* heap_object = iterator.Next(); heap_object != NULL;
heap_object = iterator.Next()) {
for (Address current = bottom; // We skip free space objects.
current < top; if (!heap_object->IsFiller()) {
current += kPointerSize) { heap_object->Iterate(&visitor);
object = HeapObject::FromAddress(current);
if (MarkCompactCollector::IsMarked(object)) {
CHECK(current >= next_object_must_be_here_or_later);
object->Iterate(&visitor);
next_object_must_be_here_or_later = current + object->Size();
} }
} }
} }
...@@ -203,28 +198,29 @@ static void VerifyEvacuation(NewSpace* space) { ...@@ -203,28 +198,29 @@ static void VerifyEvacuation(NewSpace* space) {
} }
static void VerifyEvacuation(PagedSpace* space) { static void VerifyEvacuation(Heap* heap, PagedSpace* space) {
// TODO(hpayer): Bring back VerifyEvacuation for parallel-concurrently if (!space->swept_precisely()) return;
// swept pages. if (FLAG_use_allocation_folding &&
if ((FLAG_concurrent_sweeping || FLAG_parallel_sweeping) && (space == heap->old_pointer_space() || space == heap->old_data_space())) {
!space->swept_precisely()) return; return;
}
PageIterator it(space); PageIterator it(space);
while (it.has_next()) { while (it.has_next()) {
Page* p = it.next(); Page* p = it.next();
if (p->IsEvacuationCandidate()) continue; if (p->IsEvacuationCandidate()) continue;
VerifyEvacuation(p->area_start(), p->area_end()); VerifyEvacuation(p);
} }
} }
static void VerifyEvacuation(Heap* heap) { static void VerifyEvacuation(Heap* heap) {
VerifyEvacuation(heap->old_pointer_space()); VerifyEvacuation(heap, heap->old_pointer_space());
VerifyEvacuation(heap->old_data_space()); VerifyEvacuation(heap, heap->old_data_space());
VerifyEvacuation(heap->code_space()); VerifyEvacuation(heap, heap->code_space());
VerifyEvacuation(heap->cell_space()); VerifyEvacuation(heap, heap->cell_space());
VerifyEvacuation(heap->property_cell_space()); VerifyEvacuation(heap, heap->property_cell_space());
VerifyEvacuation(heap->map_space()); VerifyEvacuation(heap, heap->map_space());
VerifyEvacuation(heap->new_space()); VerifyEvacuation(heap->new_space());
VerifyEvacuationVisitor visitor; VerifyEvacuationVisitor visitor;
...@@ -610,6 +606,12 @@ void MarkCompactCollector::EnsureSweepingCompleted() { ...@@ -610,6 +606,12 @@ void MarkCompactCollector::EnsureSweepingCompleted() {
RefillFreeList(heap()->paged_space(OLD_POINTER_SPACE)); RefillFreeList(heap()->paged_space(OLD_POINTER_SPACE));
heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes(); heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes();
heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes(); heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes();
#ifdef VERIFY_HEAP
if (FLAG_verify_heap) {
VerifyEvacuation(heap_);
}
#endif
} }
...@@ -3655,12 +3657,6 @@ void MarkCompactCollector::EvacuateNewSpaceAndCandidates() { ...@@ -3655,12 +3657,6 @@ void MarkCompactCollector::EvacuateNewSpaceAndCandidates() {
heap_->isolate()->inner_pointer_to_code_cache()->Flush(); heap_->isolate()->inner_pointer_to_code_cache()->Flush();
#ifdef VERIFY_HEAP
if (FLAG_verify_heap) {
VerifyEvacuation(heap_);
}
#endif
slots_buffer_allocator_.DeallocateChain(&migration_slots_buffer_); slots_buffer_allocator_.DeallocateChain(&migration_slots_buffer_);
ASSERT(migration_slots_buffer_ == NULL); ASSERT(migration_slots_buffer_ == NULL);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment