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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 static void VisitNativeContextIncremental(Map* map, HeapObject* object) { | 231 static void VisitNativeContextIncremental(Map* map, HeapObject* object) { |
232 Context* context = Context::cast(object); | 232 Context* context = Context::cast(object); |
233 | 233 |
234 // We will mark cache black with a separate pass when we finish marking. | 234 // We will mark cache black with a separate pass when we finish marking. |
235 // Note that GC can happen when the context is not fully initialized, | 235 // Note that GC can happen when the context is not fully initialized, |
236 // so the cache can be undefined. | 236 // so the cache can be undefined. |
237 Object* cache = context->get(Context::NORMALIZED_MAP_CACHE_INDEX); | 237 Object* cache = context->get(Context::NORMALIZED_MAP_CACHE_INDEX); |
238 if (!cache->IsUndefined()) { | 238 if (!cache->IsUndefined(map->GetIsolate())) { |
239 MarkObjectGreyDoNotEnqueue(cache); | 239 MarkObjectGreyDoNotEnqueue(cache); |
240 } | 240 } |
241 VisitNativeContext(map, context); | 241 VisitNativeContext(map, context); |
242 } | 242 } |
243 | 243 |
244 INLINE(static void VisitPointer(Heap* heap, HeapObject* object, Object** p)) { | 244 INLINE(static void VisitPointer(Heap* heap, HeapObject* object, Object** p)) { |
245 Object* target = *p; | 245 Object* target = *p; |
246 if (target->IsHeapObject()) { | 246 if (target->IsHeapObject()) { |
247 heap->mark_compact_collector()->RecordSlot(object, p, target); | 247 heap->mark_compact_collector()->RecordSlot(object, p, target); |
248 MarkObject(heap, target); | 248 MarkObject(heap, target); |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 double delta = end - start; | 927 double delta = end - start; |
928 heap_->tracer()->AddMarkingTime(delta); | 928 heap_->tracer()->AddMarkingTime(delta); |
929 if (FLAG_trace_incremental_marking) { | 929 if (FLAG_trace_incremental_marking) { |
930 PrintF("[IncrementalMarking] Complete (hurry), spent %d ms.\n", | 930 PrintF("[IncrementalMarking] Complete (hurry), spent %d ms.\n", |
931 static_cast<int>(delta)); | 931 static_cast<int>(delta)); |
932 } | 932 } |
933 } | 933 } |
934 } | 934 } |
935 | 935 |
936 Object* context = heap_->native_contexts_list(); | 936 Object* context = heap_->native_contexts_list(); |
937 while (!context->IsUndefined()) { | 937 while (!context->IsUndefined(heap_->isolate())) { |
938 // GC can happen when the context is not fully initialized, | 938 // GC can happen when the context is not fully initialized, |
939 // so the cache can be undefined. | 939 // so the cache can be undefined. |
940 HeapObject* cache = HeapObject::cast( | 940 HeapObject* cache = HeapObject::cast( |
941 Context::cast(context)->get(Context::NORMALIZED_MAP_CACHE_INDEX)); | 941 Context::cast(context)->get(Context::NORMALIZED_MAP_CACHE_INDEX)); |
942 if (!cache->IsUndefined()) { | 942 if (!cache->IsUndefined(heap_->isolate())) { |
943 MarkBit mark_bit = Marking::MarkBitFrom(cache); | 943 MarkBit mark_bit = Marking::MarkBitFrom(cache); |
944 if (Marking::IsGrey(mark_bit)) { | 944 if (Marking::IsGrey(mark_bit)) { |
945 Marking::GreyToBlack(mark_bit); | 945 Marking::GreyToBlack(mark_bit); |
946 MemoryChunk::IncrementLiveBytesFromGC(cache, cache->Size()); | 946 MemoryChunk::IncrementLiveBytesFromGC(cache, cache->Size()); |
947 } | 947 } |
948 } | 948 } |
949 context = Context::cast(context)->next_context_link(); | 949 context = Context::cast(context)->next_context_link(); |
950 } | 950 } |
951 } | 951 } |
952 | 952 |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1249 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1249 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
1250 idle_marking_delay_counter_++; | 1250 idle_marking_delay_counter_++; |
1251 } | 1251 } |
1252 | 1252 |
1253 | 1253 |
1254 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1254 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1255 idle_marking_delay_counter_ = 0; | 1255 idle_marking_delay_counter_ = 0; |
1256 } | 1256 } |
1257 } // namespace internal | 1257 } // namespace internal |
1258 } // namespace v8 | 1258 } // namespace v8 |
OLD | NEW |