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