Chromium Code Reviews| 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 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1023 | 1023 |
| 1024 if (step_size_in_bytes == 0) { | 1024 if (step_size_in_bytes == 0) { |
| 1025 step_size_in_bytes = GCIdleTimeHandler::EstimateMarkingStepSize( | 1025 step_size_in_bytes = GCIdleTimeHandler::EstimateMarkingStepSize( |
| 1026 GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs, | 1026 GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs, |
| 1027 heap() | 1027 heap() |
| 1028 ->tracer() | 1028 ->tracer() |
| 1029 ->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond()); | 1029 ->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond()); |
| 1030 } | 1030 } |
| 1031 | 1031 |
| 1032 double remaining_time_in_ms = 0.0; | 1032 double remaining_time_in_ms = 0.0; |
| 1033 intptr_t bytes_processed = 0; | |
| 1033 do { | 1034 do { |
| 1034 Step(step_size_in_bytes, step_actions.completion_action, | 1035 bytes_processed = |
| 1035 step_actions.force_marking, step_actions.force_completion); | 1036 Step(step_size_in_bytes, step_actions.completion_action, |
| 1037 step_actions.force_marking, step_actions.force_completion); | |
| 1036 remaining_time_in_ms = | 1038 remaining_time_in_ms = |
| 1037 deadline_in_ms - heap()->MonotonicallyIncreasingTimeInMs(); | 1039 deadline_in_ms - heap()->MonotonicallyIncreasingTimeInMs(); |
| 1038 } while (remaining_time_in_ms >= | 1040 } while (bytes_processed > 0 && |
| 1041 remaining_time_in_ms >= | |
| 1039 2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs && | 1042 2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs && |
| 1040 !IsComplete() && | 1043 !IsComplete() && |
| 1041 !heap()->mark_compact_collector()->marking_deque()->IsEmpty()); | 1044 !heap()->mark_compact_collector()->marking_deque()->IsEmpty()); |
| 1042 return remaining_time_in_ms; | 1045 return remaining_time_in_ms; |
| 1043 } | 1046 } |
| 1044 | 1047 |
| 1045 | 1048 |
| 1046 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { | 1049 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { |
| 1047 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) { | 1050 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) { |
| 1048 heap()->StartIncrementalMarking(Heap::kNoGCFlags, kNoGCCallbackFlags, | 1051 heap()->StartIncrementalMarking(Heap::kNoGCFlags, kNoGCCallbackFlags, |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1176 if (state_ == SWEEPING) { | 1179 if (state_ == SWEEPING) { |
| 1177 if (heap_->mark_compact_collector()->sweeping_in_progress() && | 1180 if (heap_->mark_compact_collector()->sweeping_in_progress() && |
| 1178 (heap_->mark_compact_collector()->IsSweepingCompleted() || | 1181 (heap_->mark_compact_collector()->IsSweepingCompleted() || |
| 1179 !FLAG_concurrent_sweeping)) { | 1182 !FLAG_concurrent_sweeping)) { |
| 1180 heap_->mark_compact_collector()->EnsureSweepingCompleted(); | 1183 heap_->mark_compact_collector()->EnsureSweepingCompleted(); |
| 1181 } | 1184 } |
| 1182 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { | 1185 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { |
| 1183 bytes_scanned_ = 0; | 1186 bytes_scanned_ = 0; |
| 1184 StartMarking(); | 1187 StartMarking(); |
| 1185 } | 1188 } |
| 1186 } else if (state_ == MARKING) { | 1189 } |
|
Hannes Payer (out of office)
2016/04/01 12:48:24
This is a slight policy change. However, I don't t
| |
| 1190 if (state_ == MARKING) { | |
| 1187 bytes_processed = ProcessMarkingDeque(bytes_to_process); | 1191 bytes_processed = ProcessMarkingDeque(bytes_to_process); |
| 1188 if (heap_->mark_compact_collector()->marking_deque()->IsEmpty()) { | 1192 if (heap_->mark_compact_collector()->marking_deque()->IsEmpty()) { |
| 1189 if (completion == FORCE_COMPLETION || | 1193 if (completion == FORCE_COMPLETION || |
| 1190 IsIdleMarkingDelayCounterLimitReached()) { | 1194 IsIdleMarkingDelayCounterLimitReached()) { |
| 1191 if (!finalize_marking_completed_) { | 1195 if (!finalize_marking_completed_) { |
| 1192 FinalizeMarking(action); | 1196 FinalizeMarking(action); |
| 1193 } else { | 1197 } else { |
| 1194 MarkingComplete(action); | 1198 MarkingComplete(action); |
| 1195 } | 1199 } |
| 1196 } else { | 1200 } else { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1242 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1246 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
| 1243 idle_marking_delay_counter_++; | 1247 idle_marking_delay_counter_++; |
| 1244 } | 1248 } |
| 1245 | 1249 |
| 1246 | 1250 |
| 1247 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1251 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
| 1248 idle_marking_delay_counter_ = 0; | 1252 idle_marking_delay_counter_ = 0; |
| 1249 } | 1253 } |
| 1250 } // namespace internal | 1254 } // namespace internal |
| 1251 } // namespace v8 | 1255 } // namespace v8 |
| OLD | NEW |