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/concurrent-marking.h" | 10 #include "src/heap/concurrent-marking.h" |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 } | 704 } |
705 } | 705 } |
706 | 706 |
707 void IncrementalMarking::FinalizeIncrementally() { | 707 void IncrementalMarking::FinalizeIncrementally() { |
708 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_INCREMENTAL_FINALIZE_BODY); | 708 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_INCREMENTAL_FINALIZE_BODY); |
709 DCHECK(!finalize_marking_completed_); | 709 DCHECK(!finalize_marking_completed_); |
710 DCHECK(IsMarking()); | 710 DCHECK(IsMarking()); |
711 | 711 |
712 double start = heap_->MonotonicallyIncreasingTimeInMs(); | 712 double start = heap_->MonotonicallyIncreasingTimeInMs(); |
713 | 713 |
714 int old_marking_deque_top = marking_deque()->top(); | |
715 | |
716 // After finishing incremental marking, we try to discover all unmarked | 714 // After finishing incremental marking, we try to discover all unmarked |
717 // objects to reduce the marking load in the final pause. | 715 // objects to reduce the marking load in the final pause. |
718 // 1) We scan and mark the roots again to find all changes to the root set. | 716 // 1) We scan and mark the roots again to find all changes to the root set. |
719 // 2) Age and retain maps embedded in optimized code. | 717 // 2) Age and retain maps embedded in optimized code. |
720 // 3) Remove weak cell with live values from the list of weak cells, they | 718 // 3) Remove weak cell with live values from the list of weak cells, they |
721 // do not need processing during GC. | 719 // do not need processing during GC. |
722 MarkRoots(); | 720 MarkRoots(); |
723 | 721 |
724 if (incremental_marking_finalization_rounds_ == 0) { | 722 if (incremental_marking_finalization_rounds_ == 0) { |
725 // Map retaining is needed for perfromance, not correctness, | 723 // Map retaining is needed for perfromance, not correctness, |
726 // so we can do it only once at the beginning of the finalization. | 724 // so we can do it only once at the beginning of the finalization. |
727 RetainMaps(); | 725 RetainMaps(); |
728 } | 726 } |
729 ProcessWeakCells(); | 727 ProcessWeakCells(); |
730 | 728 |
731 int marking_progress = abs(old_marking_deque_top - marking_deque()->top()); | 729 int marking_progress = |
732 | 730 heap_->mark_compact_collector()->marking_deque()->Size() + |
733 marking_progress += static_cast<int>( | 731 static_cast<int>( |
734 heap_->local_embedder_heap_tracer()->NumberOfCachedWrappersToTrace()); | 732 heap_->local_embedder_heap_tracer()->NumberOfCachedWrappersToTrace()); |
735 | 733 |
736 double end = heap_->MonotonicallyIncreasingTimeInMs(); | 734 double end = heap_->MonotonicallyIncreasingTimeInMs(); |
737 double delta = end - start; | 735 double delta = end - start; |
738 if (FLAG_trace_incremental_marking) { | 736 if (FLAG_trace_incremental_marking) { |
739 heap()->isolate()->PrintWithTimestamp( | 737 heap()->isolate()->PrintWithTimestamp( |
740 "[IncrementalMarking] Finalize incrementally round %d, " | 738 "[IncrementalMarking] Finalize incrementally round %d, " |
741 "spent %d ms, marking progress %d.\n", | 739 "spent %d ms, marking progress %d.\n", |
742 static_cast<int>(delta), incremental_marking_finalization_rounds_, | 740 static_cast<int>(delta), incremental_marking_finalization_rounds_, |
743 marking_progress); | 741 marking_progress); |
744 } | 742 } |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 idle_marking_delay_counter_++; | 1166 idle_marking_delay_counter_++; |
1169 } | 1167 } |
1170 | 1168 |
1171 | 1169 |
1172 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1170 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1173 idle_marking_delay_counter_ = 0; | 1171 idle_marking_delay_counter_ = 0; |
1174 } | 1172 } |
1175 | 1173 |
1176 } // namespace internal | 1174 } // namespace internal |
1177 } // namespace v8 | 1175 } // namespace v8 |
OLD | NEW |