Chromium Code Reviews| Index: src/incremental-marking.cc |
| diff --git a/src/incremental-marking.cc b/src/incremental-marking.cc |
| index 913dee79f6d52577b22af279f618e89ba0dae598..7ec570966b95b442bd0d576785c2ae540c773882 100644 |
| --- a/src/incremental-marking.cc |
| +++ b/src/incremental-marking.cc |
| @@ -135,12 +135,65 @@ class IncrementalMarkingRootMarkingVisitor : public ObjectVisitor { |
| }; |
| -void IncrementalMarking::ClearMarkbits(PagedSpace* space) { |
| +void IncrementalMarking::SetOldSpacePageFlags(MemoryChunk* chunk, |
| + bool is_marking) { |
| + if (is_marking) { |
| + chunk->SetFlag(MemoryChunk::CONTAINS_INTERESTING_VALUES); |
| + chunk->SetFlag(MemoryChunk::CONTAINS_INTERESTING_DESTINATIONS); |
| + } else if (chunk->owner()->identity() == CELL_SPACE || |
| + chunk->scan_on_scavenge()) { |
| + chunk->ClearFlag(MemoryChunk::CONTAINS_INTERESTING_VALUES); |
| + chunk->ClearFlag(MemoryChunk::CONTAINS_INTERESTING_DESTINATIONS); |
| + } else { |
| + chunk->ClearFlag(MemoryChunk::CONTAINS_INTERESTING_VALUES); |
| + chunk->SetFlag(MemoryChunk::CONTAINS_INTERESTING_DESTINATIONS); |
| + } |
| +} |
| + |
| + |
| +void IncrementalMarking::SetNewSpacePageFlags(MemoryChunk* chunk, |
| + bool is_marking) { |
| + chunk->SetFlag(MemoryChunk::CONTAINS_INTERESTING_VALUES); |
| + if (is_marking) { |
| + chunk->SetFlag(MemoryChunk::CONTAINS_INTERESTING_DESTINATIONS); |
| + } else { |
| + chunk->ClearFlag(MemoryChunk::CONTAINS_INTERESTING_DESTINATIONS); |
| + } |
| +} |
| + |
| + |
| +void IncrementalMarking::RevertWriteBarrierFlags(PagedSpace* space) { |
|
Erik Corry
2011/05/11 18:53:57
Revert doesn't convey a lot of meaning to me. Rev
Vyacheslav Egorov (Chromium)
2011/05/13 11:06:52
Done.
|
| PageIterator it(space); |
| + while (it.has_next()) { |
| + Page* p = it.next(); |
| + SetOldSpacePageFlags(p, false); |
| + } |
| +} |
| + |
| + |
| +void IncrementalMarking::RevertWriteBarrierFlags() { |
| + RevertWriteBarrierFlags(heap_->old_pointer_space()); |
| + RevertWriteBarrierFlags(heap_->old_data_space()); |
| + RevertWriteBarrierFlags(heap_->cell_space()); |
| + RevertWriteBarrierFlags(heap_->map_space()); |
| + RevertWriteBarrierFlags(heap_->code_space()); |
| + |
| + SetNewSpacePageFlags(heap_->new_space()->ActivePage(), false); |
| + |
| + LargePage* lop = heap_->lo_space()->first_page(); |
| + while (lop->is_valid()) { |
| + SetOldSpacePageFlags(lop, false); |
| + lop = lop->next_page(); |
| + } |
| +} |
| + |
| +void IncrementalMarking::ClearMarkbits(PagedSpace* space) { |
| + PageIterator it(space); |
| while (it.has_next()) { |
| Page* p = it.next(); |
| p->markbits()->Clear(); |
| + SetOldSpacePageFlags(p, true); |
| } |
| } |
| @@ -152,6 +205,14 @@ void IncrementalMarking::ClearMarkbits() { |
| ClearMarkbits(heap_->cell_space()); |
| ClearMarkbits(heap_->map_space()); |
| ClearMarkbits(heap_->code_space()); |
| + |
| + SetNewSpacePageFlags(heap_->new_space()->ActivePage(), true); |
| + |
| + LargePage* lop = heap_->lo_space()->first_page(); |
| + while (lop->is_valid()) { |
| + SetOldSpacePageFlags(lop, true); |
| + lop = lop->next_page(); |
| + } |
| } |
| @@ -368,7 +429,10 @@ void IncrementalMarking::Abort() { |
| heap_->new_space()->LowerInlineAllocationLimit(0); |
| IncrementalMarking::set_should_hurry(false); |
| ResetStepCounters(); |
| - if (IsMarking()) PatchIncrementalMarkingRecordWriteStubs(false); |
| + if (IsMarking()) { |
| + PatchIncrementalMarkingRecordWriteStubs(false); |
| + RevertWriteBarrierFlags(); |
| + } |
| heap_->isolate()->stack_guard()->Continue(GC_REQUEST); |
| state_ = STOPPED; |
| } |
| @@ -381,6 +445,7 @@ void IncrementalMarking::Finalize() { |
| IncrementalMarking::set_should_hurry(false); |
| ResetStepCounters(); |
| PatchIncrementalMarkingRecordWriteStubs(false); |
| + RevertWriteBarrierFlags(); |
| ASSERT(marking_deque_.IsEmpty()); |
| heap_->isolate()->stack_guard()->Continue(GC_REQUEST); |
| } |