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 { |
11 | 11 |
12 const double GCIdleTimeHandler::kConservativeTimeRatio = 0.9; | 12 const double GCIdleTimeHandler::kConservativeTimeRatio = 0.9; |
13 const size_t GCIdleTimeHandler::kMaxMarkCompactTimeInMs = 1000; | 13 const size_t GCIdleTimeHandler::kMaxMarkCompactTimeInMs = 1000; |
14 const size_t GCIdleTimeHandler::kMaxFinalIncrementalMarkCompactTimeInMs = 1000; | 14 const size_t GCIdleTimeHandler::kMaxFinalIncrementalMarkCompactTimeInMs = 1000; |
15 const size_t GCIdleTimeHandler::kMinTimeForFinalizeSweeping = 100; | |
16 const int GCIdleTimeHandler::kMaxMarkCompactsInIdleRound = 2; | 15 const int GCIdleTimeHandler::kMaxMarkCompactsInIdleRound = 2; |
17 const int GCIdleTimeHandler::kIdleScavengeThreshold = 5; | 16 const int GCIdleTimeHandler::kIdleScavengeThreshold = 5; |
18 const double GCIdleTimeHandler::kHighContextDisposalRate = 100; | 17 const double GCIdleTimeHandler::kHighContextDisposalRate = 100; |
19 const size_t GCIdleTimeHandler::kMinTimeForOverApproximatingWeakClosureInMs = 1; | 18 const size_t GCIdleTimeHandler::kMinTimeForOverApproximatingWeakClosureInMs = 1; |
20 | 19 |
21 | 20 |
22 void GCIdleTimeAction::Print() { | 21 void GCIdleTimeAction::Print() { |
23 switch (type) { | 22 switch (type) { |
24 case DONE: | 23 case DONE: |
25 PrintF("done"); | 24 PrintF("done"); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 } | 233 } |
235 | 234 |
236 if (heap_state.incremental_marking_stopped) { | 235 if (heap_state.incremental_marking_stopped) { |
237 if (ShouldDoMarkCompact(static_cast<size_t>(idle_time_in_ms), | 236 if (ShouldDoMarkCompact(static_cast<size_t>(idle_time_in_ms), |
238 heap_state.size_of_objects, | 237 heap_state.size_of_objects, |
239 heap_state.mark_compact_speed_in_bytes_per_ms)) { | 238 heap_state.mark_compact_speed_in_bytes_per_ms)) { |
240 return GCIdleTimeAction::FullGC(); | 239 return GCIdleTimeAction::FullGC(); |
241 } | 240 } |
242 } | 241 } |
243 | 242 |
244 // TODO(hpayer): Estimate finalize sweeping time. | 243 if (heap_state.sweeping_in_progress && heap_state.sweeping_completed) { |
245 if (heap_state.sweeping_in_progress && | |
246 static_cast<size_t>(idle_time_in_ms) >= kMinTimeForFinalizeSweeping) { | |
247 return GCIdleTimeAction::FinalizeSweeping(); | 244 return GCIdleTimeAction::FinalizeSweeping(); |
248 } | 245 } |
249 | 246 |
250 if (heap_state.incremental_marking_stopped && | 247 if (heap_state.incremental_marking_stopped && |
251 !heap_state.can_start_incremental_marking) { | 248 !heap_state.can_start_incremental_marking) { |
252 return GCIdleTimeAction::Nothing(); | 249 return GCIdleTimeAction::Nothing(); |
253 } | 250 } |
254 size_t step_size = EstimateMarkingStepSize( | 251 size_t step_size = EstimateMarkingStepSize( |
255 static_cast<size_t>(kIncrementalMarkingStepTimeInMs), | 252 static_cast<size_t>(kIncrementalMarkingStepTimeInMs), |
256 heap_state.incremental_marking_speed_in_bytes_per_ms); | 253 heap_state.incremental_marking_speed_in_bytes_per_ms); |
257 return GCIdleTimeAction::IncrementalMarking(step_size); | 254 return GCIdleTimeAction::IncrementalMarking(step_size); |
258 } | 255 } |
259 } | 256 } |
260 } | 257 } |
OLD | NEW |