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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 // Marking bits are cleared by the sweeper. | 546 // Marking bits are cleared by the sweeper. |
547 #ifdef VERIFY_HEAP | 547 #ifdef VERIFY_HEAP |
548 if (FLAG_verify_heap) { | 548 if (FLAG_verify_heap) { |
549 heap_->mark_compact_collector()->VerifyMarkbitsAreClean(); | 549 heap_->mark_compact_collector()->VerifyMarkbitsAreClean(); |
550 } | 550 } |
551 #endif | 551 #endif |
552 | 552 |
553 heap_->CompletelyClearInstanceofCache(); | 553 heap_->CompletelyClearInstanceofCache(); |
554 heap_->isolate()->compilation_cache()->MarkCompactPrologue(); | 554 heap_->isolate()->compilation_cache()->MarkCompactPrologue(); |
555 | 555 |
556 if (FLAG_cleanup_code_caches_at_gc) { | |
557 // We will mark cache black with a separate pass | |
558 // when we finish marking. | |
559 MarkObjectGreyDoNotEnqueue(heap_->polymorphic_code_cache()); | |
560 } | |
561 | |
562 // Mark strong roots grey. | 556 // Mark strong roots grey. |
563 IncrementalMarkingRootMarkingVisitor visitor(this); | 557 IncrementalMarkingRootMarkingVisitor visitor(this); |
564 heap_->IterateStrongRoots(&visitor, VISIT_ONLY_STRONG); | 558 heap_->IterateStrongRoots(&visitor, VISIT_ONLY_STRONG); |
565 | 559 |
566 if (FLAG_black_allocation) { | 560 if (FLAG_black_allocation) { |
567 StartBlackAllocation(); | 561 StartBlackAllocation(); |
568 } | 562 } |
569 | 563 |
570 // Ready to start incremental marking. | 564 // Ready to start incremental marking. |
571 if (FLAG_trace_incremental_marking) { | 565 if (FLAG_trace_incremental_marking) { |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 double end = heap_->MonotonicallyIncreasingTimeInMs(); | 912 double end = heap_->MonotonicallyIncreasingTimeInMs(); |
919 double delta = end - start; | 913 double delta = end - start; |
920 heap_->tracer()->AddMarkingTime(delta); | 914 heap_->tracer()->AddMarkingTime(delta); |
921 if (FLAG_trace_incremental_marking) { | 915 if (FLAG_trace_incremental_marking) { |
922 PrintF("[IncrementalMarking] Complete (hurry), spent %d ms.\n", | 916 PrintF("[IncrementalMarking] Complete (hurry), spent %d ms.\n", |
923 static_cast<int>(delta)); | 917 static_cast<int>(delta)); |
924 } | 918 } |
925 } | 919 } |
926 } | 920 } |
927 | 921 |
928 if (FLAG_cleanup_code_caches_at_gc) { | |
929 PolymorphicCodeCache* poly_cache = heap_->polymorphic_code_cache(); | |
930 Marking::GreyToBlack(Marking::MarkBitFrom(poly_cache)); | |
931 MemoryChunk::IncrementLiveBytesFromGC(poly_cache, | |
932 PolymorphicCodeCache::kSize); | |
933 } | |
934 | |
935 Object* context = heap_->native_contexts_list(); | 922 Object* context = heap_->native_contexts_list(); |
936 while (!context->IsUndefined()) { | 923 while (!context->IsUndefined()) { |
937 // GC can happen when the context is not fully initialized, | 924 // GC can happen when the context is not fully initialized, |
938 // so the cache can be undefined. | 925 // so the cache can be undefined. |
939 HeapObject* cache = HeapObject::cast( | 926 HeapObject* cache = HeapObject::cast( |
940 Context::cast(context)->get(Context::NORMALIZED_MAP_CACHE_INDEX)); | 927 Context::cast(context)->get(Context::NORMALIZED_MAP_CACHE_INDEX)); |
941 if (!cache->IsUndefined()) { | 928 if (!cache->IsUndefined()) { |
942 MarkBit mark_bit = Marking::MarkBitFrom(cache); | 929 MarkBit mark_bit = Marking::MarkBitFrom(cache); |
943 if (Marking::IsGrey(mark_bit)) { | 930 if (Marking::IsGrey(mark_bit)) { |
944 Marking::GreyToBlack(mark_bit); | 931 Marking::GreyToBlack(mark_bit); |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1229 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
1243 idle_marking_delay_counter_++; | 1230 idle_marking_delay_counter_++; |
1244 } | 1231 } |
1245 | 1232 |
1246 | 1233 |
1247 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1234 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1248 idle_marking_delay_counter_ = 0; | 1235 idle_marking_delay_counter_ = 0; |
1249 } | 1236 } |
1250 } // namespace internal | 1237 } // namespace internal |
1251 } // namespace v8 | 1238 } // namespace v8 |
OLD | NEW |