| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 // (4) If incremental marking is done, we perform a full garbage collection | 184 // (4) If incremental marking is done, we perform a full garbage collection |
| 185 // if we are allowed to still do full garbage collections during this idle | 185 // if we are allowed to still do full garbage collections during this idle |
| 186 // round or if we are not allowed to start incremental marking. Otherwise we | 186 // round or if we are not allowed to start incremental marking. Otherwise we |
| 187 // do not perform garbage collection to keep system utilization low. | 187 // do not perform garbage collection to keep system utilization low. |
| 188 // (5) If sweeping is in progress and we received a large enough idle time | 188 // (5) If sweeping is in progress and we received a large enough idle time |
| 189 // request, we finalize sweeping here. | 189 // request, we finalize sweeping here. |
| 190 // (6) If incremental marking is in progress, we perform a marking step. Note, | 190 // (6) If incremental marking is in progress, we perform a marking step. Note, |
| 191 // that this currently may trigger a full garbage collection. | 191 // that this currently may trigger a full garbage collection. |
| 192 GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms, | 192 GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms, |
| 193 HeapState heap_state) { | 193 HeapState heap_state) { |
| 194 if (idle_time_in_ms <= 0.0) { | 194 if (static_cast<int>(idle_time_in_ms) <= 0) { |
| 195 if (heap_state.incremental_marking_stopped) { | 195 if (heap_state.incremental_marking_stopped) { |
| 196 if (ShouldDoContextDisposalMarkCompact( | 196 if (ShouldDoContextDisposalMarkCompact( |
| 197 heap_state.contexts_disposed, | 197 heap_state.contexts_disposed, |
| 198 heap_state.contexts_disposal_rate)) { | 198 heap_state.contexts_disposal_rate)) { |
| 199 return GCIdleTimeAction::FullGC(); | 199 return GCIdleTimeAction::FullGC(); |
| 200 } | 200 } |
| 201 } | 201 } |
| 202 return GCIdleTimeAction::Nothing(); | 202 return GCIdleTimeAction::Nothing(); |
| 203 } | 203 } |
| 204 | 204 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 !heap_state.can_start_incremental_marking) { | 249 !heap_state.can_start_incremental_marking) { |
| 250 return GCIdleTimeAction::Nothing(); | 250 return GCIdleTimeAction::Nothing(); |
| 251 } | 251 } |
| 252 size_t step_size = EstimateMarkingStepSize( | 252 size_t step_size = EstimateMarkingStepSize( |
| 253 static_cast<size_t>(idle_time_in_ms), | 253 static_cast<size_t>(idle_time_in_ms), |
| 254 heap_state.incremental_marking_speed_in_bytes_per_ms); | 254 heap_state.incremental_marking_speed_in_bytes_per_ms); |
| 255 return GCIdleTimeAction::IncrementalMarking(step_size); | 255 return GCIdleTimeAction::IncrementalMarking(step_size); |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 } | 258 } |
| OLD | NEW |