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-tracer.h" | 11 #include "src/heap/gc-tracer.h" |
11 #include "src/heap/mark-compact-inl.h" | 12 #include "src/heap/mark-compact-inl.h" |
12 #include "src/heap/objects-visiting.h" | 13 #include "src/heap/objects-visiting.h" |
13 #include "src/heap/objects-visiting-inl.h" | 14 #include "src/heap/objects-visiting-inl.h" |
14 #include "src/v8.h" | 15 #include "src/v8.h" |
15 | 16 |
16 namespace v8 { | 17 namespace v8 { |
17 namespace internal { | 18 namespace internal { |
18 | 19 |
19 | 20 |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 } | 809 } |
809 | 810 |
810 | 811 |
811 void IncrementalMarking::Epilogue() { | 812 void IncrementalMarking::Epilogue() { |
812 was_activated_ = false; | 813 was_activated_ = false; |
813 weak_closure_was_overapproximated_ = false; | 814 weak_closure_was_overapproximated_ = false; |
814 weak_closure_approximation_rounds_ = 0; | 815 weak_closure_approximation_rounds_ = 0; |
815 } | 816 } |
816 | 817 |
817 | 818 |
| 819 double IncrementalMarking::AdvanceIncrementalMarking( |
| 820 intptr_t step_size_in_bytes, double deadline_in_ms, |
| 821 IncrementalMarking::StepActions step_actions) { |
| 822 DCHECK(!IsStopped()); |
| 823 |
| 824 if (step_size_in_bytes == 0) { |
| 825 step_size_in_bytes = GCIdleTimeHandler::EstimateMarkingStepSize( |
| 826 static_cast<size_t>(GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs), |
| 827 static_cast<size_t>( |
| 828 heap() |
| 829 ->tracer() |
| 830 ->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond())); |
| 831 } |
| 832 |
| 833 double remaining_time_in_ms = 0.0; |
| 834 do { |
| 835 Step(step_size_in_bytes, step_actions.completion_action, |
| 836 step_actions.force_marking, step_actions.force_completion); |
| 837 remaining_time_in_ms = |
| 838 deadline_in_ms - heap()->MonotonicallyIncreasingTimeInMs(); |
| 839 } while (remaining_time_in_ms >= |
| 840 2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs && |
| 841 !IsComplete() && |
| 842 !heap()->mark_compact_collector()->marking_deque()->IsEmpty()); |
| 843 return remaining_time_in_ms; |
| 844 } |
| 845 |
| 846 |
818 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { | 847 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { |
819 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) { | 848 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) { |
820 heap()->StartIncrementalMarking(Heap::kNoGCFlags, kNoGCCallbackFlags, | 849 heap()->StartIncrementalMarking(Heap::kNoGCFlags, kNoGCCallbackFlags, |
821 "old space step"); | 850 "old space step"); |
822 } else { | 851 } else { |
823 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); | 852 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); |
824 } | 853 } |
825 } | 854 } |
826 | 855 |
827 | 856 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1046 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
1018 idle_marking_delay_counter_++; | 1047 idle_marking_delay_counter_++; |
1019 } | 1048 } |
1020 | 1049 |
1021 | 1050 |
1022 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1051 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1023 idle_marking_delay_counter_ = 0; | 1052 idle_marking_delay_counter_ = 0; |
1024 } | 1053 } |
1025 } // namespace internal | 1054 } // namespace internal |
1026 } // namespace v8 | 1055 } // namespace v8 |
OLD | NEW |