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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // if context was disposed or if we are allowed to still do full garbage | 103 // if context was disposed or if we are allowed to still do full garbage |
104 // collections during this idle round or if we are not allowed to start | 104 // collections during this idle round or if we are not allowed to start |
105 // incremental marking. Otherwise we do not perform garbage collection to | 105 // incremental marking. Otherwise we do not perform garbage collection to |
106 // keep system utilization low. | 106 // keep system utilization low. |
107 // (4) If sweeping is in progress and we received a large enough idle time | 107 // (4) If sweeping is in progress and we received a large enough idle time |
108 // request, we finalize sweeping here. | 108 // request, we finalize sweeping here. |
109 // (5) If incremental marking is in progress, we perform a marking step. Note, | 109 // (5) If incremental marking is in progress, we perform a marking step. Note, |
110 // that this currently may trigger a full garbage collection. | 110 // that this currently may trigger a full garbage collection. |
111 GCIdleTimeAction GCIdleTimeHandler::Compute(size_t idle_time_in_ms, | 111 GCIdleTimeAction GCIdleTimeHandler::Compute(size_t idle_time_in_ms, |
112 HeapState heap_state) { | 112 HeapState heap_state) { |
113 if (ScavangeMayHappenSoon( | 113 if (idle_time_in_ms <= kMaxFrameRenderingIdleTime && |
| 114 ScavangeMayHappenSoon( |
114 heap_state.available_new_space_memory, | 115 heap_state.available_new_space_memory, |
115 heap_state.new_space_allocation_throughput_in_bytes_per_ms) && | 116 heap_state.new_space_allocation_throughput_in_bytes_per_ms) && |
116 idle_time_in_ms >= | 117 idle_time_in_ms >= |
117 EstimateScavengeTime(heap_state.new_space_capacity, | 118 EstimateScavengeTime(heap_state.new_space_capacity, |
118 heap_state.scavenge_speed_in_bytes_per_ms)) { | 119 heap_state.scavenge_speed_in_bytes_per_ms)) { |
119 return GCIdleTimeAction::Scavenge(); | 120 return GCIdleTimeAction::Scavenge(); |
120 } | 121 } |
121 if (IsMarkCompactIdleRoundFinished()) { | 122 if (IsMarkCompactIdleRoundFinished()) { |
122 if (EnoughGarbageSinceLastIdleRound() || heap_state.contexts_disposed > 0) { | 123 if (EnoughGarbageSinceLastIdleRound() || heap_state.contexts_disposed > 0) { |
123 StartIdleRound(); | 124 StartIdleRound(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 if (heap_state.incremental_marking_stopped && | 165 if (heap_state.incremental_marking_stopped && |
165 !heap_state.can_start_incremental_marking) { | 166 !heap_state.can_start_incremental_marking) { |
166 return GCIdleTimeAction::Nothing(); | 167 return GCIdleTimeAction::Nothing(); |
167 } | 168 } |
168 size_t step_size = EstimateMarkingStepSize( | 169 size_t step_size = EstimateMarkingStepSize( |
169 idle_time_in_ms, heap_state.incremental_marking_speed_in_bytes_per_ms); | 170 idle_time_in_ms, heap_state.incremental_marking_speed_in_bytes_per_ms); |
170 return GCIdleTimeAction::IncrementalMarking(step_size); | 171 return GCIdleTimeAction::IncrementalMarking(step_size); |
171 } | 172 } |
172 } | 173 } |
173 } | 174 } |
OLD | NEW |