| 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 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 | 1017 |
| 1018 double IncrementalMarking::AdvanceIncrementalMarking( | 1018 double IncrementalMarking::AdvanceIncrementalMarking( |
| 1019 double deadline_in_ms, IncrementalMarking::StepActions step_actions) { | 1019 double deadline_in_ms, IncrementalMarking::StepActions step_actions) { |
| 1020 DCHECK(!IsStopped()); | 1020 DCHECK(!IsStopped()); |
| 1021 | 1021 |
| 1022 intptr_t step_size_in_bytes = GCIdleTimeHandler::EstimateMarkingStepSize( | 1022 intptr_t step_size_in_bytes = GCIdleTimeHandler::EstimateMarkingStepSize( |
| 1023 GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs, | 1023 GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs, |
| 1024 heap() | 1024 heap() |
| 1025 ->tracer() | 1025 ->tracer() |
| 1026 ->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond()); | 1026 ->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond()); |
| 1027 double remaining_time_in_ms = | 1027 double remaining_time_in_ms = 0.0; |
| 1028 deadline_in_ms - heap()->MonotonicallyIncreasingTimeInMs(); | 1028 intptr_t bytes_processed = 0; |
| 1029 while (remaining_time_in_ms >= | 1029 |
| 1030 GCIdleTimeHandler::kMinIncrementalMarkingStepTimeInMs) { | 1030 do { |
| 1031 intptr_t bytes_processed = | 1031 bytes_processed = |
| 1032 Step(step_size_in_bytes, step_actions.completion_action, | 1032 Step(step_size_in_bytes, step_actions.completion_action, |
| 1033 step_actions.force_marking, step_actions.force_completion); | 1033 step_actions.force_marking, step_actions.force_completion); |
| 1034 remaining_time_in_ms = | 1034 remaining_time_in_ms = |
| 1035 deadline_in_ms - heap()->MonotonicallyIncreasingTimeInMs(); | 1035 deadline_in_ms - heap()->MonotonicallyIncreasingTimeInMs(); |
| 1036 if (bytes_processed == 0) break; | 1036 } while (bytes_processed > 0 && |
| 1037 } | 1037 remaining_time_in_ms >= |
| 1038 2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs && |
| 1039 !IsComplete() && |
| 1040 !heap()->mark_compact_collector()->marking_deque()->IsEmpty()); |
| 1038 return remaining_time_in_ms; | 1041 return remaining_time_in_ms; |
| 1039 } | 1042 } |
| 1040 | 1043 |
| 1041 | 1044 |
| 1042 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { | 1045 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { |
| 1043 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) { | 1046 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) { |
| 1044 heap()->StartIncrementalMarking(Heap::kNoGCFlags, kNoGCCallbackFlags, | 1047 heap()->StartIncrementalMarking(Heap::kNoGCFlags, kNoGCCallbackFlags, |
| 1045 "old space step"); | 1048 "old space step"); |
| 1046 } else { | 1049 } else { |
| 1047 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); | 1050 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1242 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
| 1240 idle_marking_delay_counter_++; | 1243 idle_marking_delay_counter_++; |
| 1241 } | 1244 } |
| 1242 | 1245 |
| 1243 | 1246 |
| 1244 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1247 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
| 1245 idle_marking_delay_counter_ = 0; | 1248 idle_marking_delay_counter_ = 0; |
| 1246 } | 1249 } |
| 1247 } // namespace internal | 1250 } // namespace internal |
| 1248 } // namespace v8 | 1251 } // namespace v8 |
| OLD | NEW |