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 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 | 1004 |
1005 double IncrementalMarking::AdvanceIncrementalMarking( | 1005 double IncrementalMarking::AdvanceIncrementalMarking( |
1006 double deadline_in_ms, IncrementalMarking::StepActions step_actions) { | 1006 double deadline_in_ms, IncrementalMarking::StepActions step_actions) { |
1007 DCHECK(!IsStopped()); | 1007 DCHECK(!IsStopped()); |
1008 | 1008 |
1009 intptr_t step_size_in_bytes = GCIdleTimeHandler::EstimateMarkingStepSize( | 1009 intptr_t step_size_in_bytes = GCIdleTimeHandler::EstimateMarkingStepSize( |
1010 GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs, | 1010 GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs, |
1011 heap() | 1011 heap() |
1012 ->tracer() | 1012 ->tracer() |
1013 ->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond()); | 1013 ->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond()); |
1014 double remaining_time_in_ms = | 1014 double remaining_time_in_ms = 0.0; |
1015 deadline_in_ms - heap()->MonotonicallyIncreasingTimeInMs(); | 1015 intptr_t bytes_processed = 0; |
1016 while (remaining_time_in_ms >= | 1016 |
1017 GCIdleTimeHandler::kMinIncrementalMarkingStepTimeInMs) { | 1017 do { |
1018 intptr_t bytes_processed = | 1018 bytes_processed = |
1019 Step(step_size_in_bytes, step_actions.completion_action, | 1019 Step(step_size_in_bytes, step_actions.completion_action, |
1020 step_actions.force_marking, step_actions.force_completion); | 1020 step_actions.force_marking, step_actions.force_completion); |
1021 remaining_time_in_ms = | 1021 remaining_time_in_ms = |
1022 deadline_in_ms - heap()->MonotonicallyIncreasingTimeInMs(); | 1022 deadline_in_ms - heap()->MonotonicallyIncreasingTimeInMs(); |
1023 if (bytes_processed == 0) break; | 1023 } while (bytes_processed > 0 && |
1024 } | 1024 remaining_time_in_ms >= |
| 1025 2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs && |
| 1026 !IsComplete() && |
| 1027 !heap()->mark_compact_collector()->marking_deque()->IsEmpty()); |
1025 return remaining_time_in_ms; | 1028 return remaining_time_in_ms; |
1026 } | 1029 } |
1027 | 1030 |
1028 | 1031 |
1029 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { | 1032 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { |
1030 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) { | 1033 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) { |
1031 heap()->StartIncrementalMarking(Heap::kNoGCFlags, kNoGCCallbackFlags, | 1034 heap()->StartIncrementalMarking(Heap::kNoGCFlags, kNoGCCallbackFlags, |
1032 "old space step"); | 1035 "old space step"); |
1033 } else { | 1036 } else { |
1034 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); | 1037 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1229 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
1227 idle_marking_delay_counter_++; | 1230 idle_marking_delay_counter_++; |
1228 } | 1231 } |
1229 | 1232 |
1230 | 1233 |
1231 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1234 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1232 idle_marking_delay_counter_ = 0; | 1235 idle_marking_delay_counter_ = 0; |
1233 } | 1236 } |
1234 } // namespace internal | 1237 } // namespace internal |
1235 } // namespace v8 | 1238 } // namespace v8 |
OLD | NEW |