Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/heap/incremental-marking.h" | 5 #include "src/heap/incremental-marking.h" |
| 6 | 6 |
| 7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
| 8 #include "src/compilation-cache.h" | 8 #include "src/compilation-cache.h" |
| 9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
| 10 #include "src/heap/gc-idle-time-handler.h" | 10 #include "src/heap/gc-idle-time-handler.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 // Object is not going to be rescanned. We need to record the slot. | 114 // Object is not going to be rescanned. We need to record the slot. |
| 115 heap_->mark_compact_collector()->RecordRelocSlot(host, rinfo, value); | 115 heap_->mark_compact_collector()->RecordRelocSlot(host, rinfo, value); |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 | 118 |
| 119 void IncrementalMarking::WhiteToGreyAndPush(HeapObject* obj) { | 119 void IncrementalMarking::WhiteToGreyAndPush(HeapObject* obj) { |
| 120 ObjectMarking::WhiteToGrey(obj); | 120 ObjectMarking::WhiteToGrey(obj); |
| 121 heap_->mark_compact_collector()->marking_deque()->Push(obj); | 121 heap_->mark_compact_collector()->marking_deque()->Push(obj); |
| 122 } | 122 } |
| 123 | 123 |
| 124 | 124 static void WhiteToGreyIfWhiteDoNotEnqueue(Object* obj) { |
| 125 static void MarkObjectGreyDoNotEnqueue(Object* obj) { | |
| 126 if (obj->IsHeapObject()) { | 125 if (obj->IsHeapObject()) { |
|
ulan
2017/03/03 12:53:13
Can we just inline this at the callsite? Looks lik
Hannes Payer (out of office)
2017/03/03 13:07:08
Done.
| |
| 127 HeapObject* heap_obj = HeapObject::cast(obj); | 126 HeapObject* heap_obj = HeapObject::cast(obj); |
| 128 ObjectMarking::AnyToGrey(heap_obj); | 127 if (ObjectMarking::IsWhite(heap_obj)) { |
| 128 ObjectMarking::WhiteToGrey(heap_obj); | |
| 129 } | |
| 129 } | 130 } |
| 130 } | 131 } |
| 131 | 132 |
| 132 void IncrementalMarking::TransferMark(Heap* heap, HeapObject* from, | 133 void IncrementalMarking::TransferMark(Heap* heap, HeapObject* from, |
| 133 HeapObject* to) { | 134 HeapObject* to) { |
| 134 DCHECK(MemoryChunk::FromAddress(from->address())->SweepingDone()); | 135 DCHECK(MemoryChunk::FromAddress(from->address())->SweepingDone()); |
| 135 // This is only used when resizing an object. | 136 // This is only used when resizing an object. |
| 136 DCHECK(MemoryChunk::FromAddress(from->address()) == | 137 DCHECK(MemoryChunk::FromAddress(from->address()) == |
| 137 MemoryChunk::FromAddress(to->address())); | 138 MemoryChunk::FromAddress(to->address())); |
| 138 | 139 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 } | 221 } |
| 221 | 222 |
| 222 static void VisitNativeContextIncremental(Map* map, HeapObject* object) { | 223 static void VisitNativeContextIncremental(Map* map, HeapObject* object) { |
| 223 Context* context = Context::cast(object); | 224 Context* context = Context::cast(object); |
| 224 | 225 |
| 225 // We will mark cache black with a separate pass when we finish marking. | 226 // We will mark cache black with a separate pass when we finish marking. |
| 226 // Note that GC can happen when the context is not fully initialized, | 227 // Note that GC can happen when the context is not fully initialized, |
| 227 // so the cache can be undefined. | 228 // so the cache can be undefined. |
| 228 Object* cache = context->get(Context::NORMALIZED_MAP_CACHE_INDEX); | 229 Object* cache = context->get(Context::NORMALIZED_MAP_CACHE_INDEX); |
| 229 if (!cache->IsUndefined(map->GetIsolate())) { | 230 if (!cache->IsUndefined(map->GetIsolate())) { |
| 230 MarkObjectGreyDoNotEnqueue(cache); | 231 WhiteToGreyIfWhiteDoNotEnqueue(cache); |
| 231 } | 232 } |
| 232 VisitNativeContext(map, context); | 233 VisitNativeContext(map, context); |
| 233 } | 234 } |
| 234 | 235 |
| 235 INLINE(static void VisitPointer(Heap* heap, HeapObject* object, Object** p)) { | 236 INLINE(static void VisitPointer(Heap* heap, HeapObject* object, Object** p)) { |
| 236 Object* target = *p; | 237 Object* target = *p; |
| 237 if (target->IsHeapObject()) { | 238 if (target->IsHeapObject()) { |
| 238 heap->mark_compact_collector()->RecordSlot(object, p, target); | 239 heap->mark_compact_collector()->RecordSlot(object, p, target); |
| 239 MarkObject(heap, target); | 240 MarkObject(heap, target); |
| 240 } | 241 } |
| (...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1169 idle_marking_delay_counter_++; | 1170 idle_marking_delay_counter_++; |
| 1170 } | 1171 } |
| 1171 | 1172 |
| 1172 | 1173 |
| 1173 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1174 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
| 1174 idle_marking_delay_counter_ = 0; | 1175 idle_marking_delay_counter_ = 0; |
| 1175 } | 1176 } |
| 1176 | 1177 |
| 1177 } // namespace internal | 1178 } // namespace internal |
| 1178 } // namespace v8 | 1179 } // namespace v8 |
| OLD | NEW |