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