| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/gc-idle-time-handler.h" | 5 #include "src/heap/gc-idle-time-handler.h" |
| 6 #include "src/heap/gc-tracer.h" | 6 #include "src/heap/gc-tracer.h" |
| 7 #include "src/utils.h" | 7 #include "src/utils.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // (4) If incremental marking is done, we perform a full garbage collection | 210 // (4) If incremental marking is done, we perform a full garbage collection |
| 211 // if we are allowed to still do full garbage collections during this idle | 211 // if we are allowed to still do full garbage collections during this idle |
| 212 // round or if we are not allowed to start incremental marking. Otherwise we | 212 // round or if we are not allowed to start incremental marking. Otherwise we |
| 213 // do not perform garbage collection to keep system utilization low. | 213 // do not perform garbage collection to keep system utilization low. |
| 214 // (5) If sweeping is in progress and we received a large enough idle time | 214 // (5) If sweeping is in progress and we received a large enough idle time |
| 215 // request, we finalize sweeping here. | 215 // request, we finalize sweeping here. |
| 216 // (6) If incremental marking is in progress, we perform a marking step. Note, | 216 // (6) If incremental marking is in progress, we perform a marking step. Note, |
| 217 // that this currently may trigger a full garbage collection. | 217 // that this currently may trigger a full garbage collection. |
| 218 GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms, | 218 GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms, |
| 219 HeapState heap_state) { | 219 HeapState heap_state) { |
| 220 if (heap_state.contexts_disposed > 0) { |
| 221 StartIdleRound(); |
| 222 } |
| 220 if (static_cast<int>(idle_time_in_ms) <= 0) { | 223 if (static_cast<int>(idle_time_in_ms) <= 0) { |
| 221 if (heap_state.contexts_disposed > 0) { | |
| 222 StartIdleRound(); | |
| 223 } | |
| 224 if (heap_state.incremental_marking_stopped) { | 224 if (heap_state.incremental_marking_stopped) { |
| 225 if (ShouldDoContextDisposalMarkCompact( | 225 if (ShouldDoContextDisposalMarkCompact( |
| 226 heap_state.contexts_disposed, | 226 heap_state.contexts_disposed, |
| 227 heap_state.contexts_disposal_rate)) { | 227 heap_state.contexts_disposal_rate)) { |
| 228 return GCIdleTimeAction::FullGC(); | 228 return GCIdleTimeAction::FullGC(); |
| 229 } | 229 } |
| 230 } | 230 } |
| 231 return GCIdleTimeAction::Nothing(); | 231 return GCIdleTimeAction::Nothing(); |
| 232 } | 232 } |
| 233 | 233 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 return NothingOrDone(); | 266 return NothingOrDone(); |
| 267 } | 267 } |
| 268 | 268 |
| 269 size_t step_size = EstimateMarkingStepSize( | 269 size_t step_size = EstimateMarkingStepSize( |
| 270 static_cast<size_t>(kIncrementalMarkingStepTimeInMs), | 270 static_cast<size_t>(kIncrementalMarkingStepTimeInMs), |
| 271 heap_state.incremental_marking_speed_in_bytes_per_ms); | 271 heap_state.incremental_marking_speed_in_bytes_per_ms); |
| 272 return GCIdleTimeAction::IncrementalMarking(step_size); | 272 return GCIdleTimeAction::IncrementalMarking(step_size); |
| 273 } | 273 } |
| 274 } | 274 } |
| 275 } | 275 } |
| OLD | NEW |