Chromium Code Reviews| Index: src/incremental-marking.cc |
| diff --git a/src/incremental-marking.cc b/src/incremental-marking.cc |
| index 5f10f95b2b5c0be68dc1ba5f3fa56f6a32e3fd43..4301505b49e0e3f31d88fdde25e8c56f4ed24c13 100644 |
| --- a/src/incremental-marking.cc |
| +++ b/src/incremental-marking.cc |
| @@ -38,6 +38,7 @@ namespace internal { |
| IncrementalMarking::IncrementalMarking(Heap* heap) |
| : heap_(heap), |
| state_(STOPPED), |
| + marking_deque_memory_(NULL), |
| steps_count_(0), |
| steps_took_(0), |
| should_hurry_(false), |
| @@ -46,6 +47,11 @@ IncrementalMarking::IncrementalMarking(Heap* heap) |
| } |
| +void IncrementalMarking::TearDown() { |
| + delete marking_deque_memory_; |
| +} |
| + |
| + |
| void IncrementalMarking::RecordWriteFromCode(HeapObject* obj, |
| Object* value, |
| Isolate* isolate) { |
| @@ -271,15 +277,12 @@ static void PatchIncrementalMarkingRecordWriteStubs(bool enable) { |
| } |
| -static VirtualMemory* marking_deque_memory = NULL; |
| - |
| - |
| -static void EnsureMarkingDequeIsCommitted() { |
| - if (marking_deque_memory == NULL) { |
| - marking_deque_memory = new VirtualMemory(4 * MB); |
| - marking_deque_memory->Commit( |
| - reinterpret_cast<Address>(marking_deque_memory->address()), |
| - marking_deque_memory->size(), |
| +void IncrementalMarking::EnsureMarkingDequeIsCommitted() { |
| + if (marking_deque_memory_ == NULL) { |
| + marking_deque_memory_ = new VirtualMemory(4 * MB); |
| + marking_deque_memory_->Commit( |
| + reinterpret_cast<Address>(marking_deque_memory_->address()), |
| + marking_deque_memory_->size(), |
| false); // Not executable. |
| } |
| } |
| @@ -320,8 +323,8 @@ void IncrementalMarking::StartMarking() { |
| EnsureMarkingDequeIsCommitted(); |
| // Initialize marking stack. |
| - Address addr = static_cast<Address>(marking_deque_memory->address()); |
| - int size = marking_deque_memory->size(); |
| + Address addr = static_cast<Address>(marking_deque_memory_->address()); |
| + int size = marking_deque_memory_->size(); |
| if (FLAG_force_marking_deque_overflows) size = 64 * kPointerSize; |
| marking_deque_.Initialize(addr, addr + size); |
| @@ -358,6 +361,8 @@ void IncrementalMarking::UpdateMarkingDequeAfterScavenge() { |
| HeapObject** array = marking_deque_.array(); |
| intptr_t new_top = current; |
| + Map* filler_map = heap_->one_pointer_filler_map(); |
| + |
| while (current != limit) { |
| HeapObject* obj = array[current]; |
| current = ((current + 1) & mask); |
| @@ -368,12 +373,13 @@ void IncrementalMarking::UpdateMarkingDequeAfterScavenge() { |
| array[new_top] = dest; |
| new_top = ((new_top + 1) & mask); |
| ASSERT(new_top != marking_deque_.bottom()); |
| - ASSERT(Marking::Color(obj) == Marking::Color(dest)); |
| + ASSERT(Marking::IsGrey(Marking::MarkBitFrom(obj))); |
| } |
| - } else { |
| + } else if (obj->map() != filler_map) { |
|
Erik Corry
2011/06/06 10:27:39
It would be nice with a comment as to how these gr
|
| array[new_top] = obj; |
| new_top = ((new_top + 1) & mask); |
| ASSERT(new_top != marking_deque_.bottom()); |
| + ASSERT(Marking::IsGrey(Marking::MarkBitFrom(obj))); |
| } |
| } |
| marking_deque_.set_top(new_top); |