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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 bool GCIdleTimeHandler::ShouldDoMarkCompact( | 153 bool GCIdleTimeHandler::ShouldDoMarkCompact( |
154 size_t idle_time_in_ms, size_t size_of_objects, | 154 size_t idle_time_in_ms, size_t size_of_objects, |
155 size_t mark_compact_speed_in_bytes_per_ms) { | 155 size_t mark_compact_speed_in_bytes_per_ms) { |
156 return idle_time_in_ms >= | 156 return idle_time_in_ms >= |
157 EstimateMarkCompactTime(size_of_objects, | 157 EstimateMarkCompactTime(size_of_objects, |
158 mark_compact_speed_in_bytes_per_ms); | 158 mark_compact_speed_in_bytes_per_ms); |
159 } | 159 } |
160 | 160 |
161 | 161 |
162 bool GCIdleTimeHandler::ShouldDoContextDisposalMarkCompact( | 162 bool GCIdleTimeHandler::ShouldDoContextDisposalMarkCompact( |
163 bool context_disposed, double contexts_disposal_rate) { | 163 int contexts_disposed, double contexts_disposal_rate) { |
164 return context_disposed && contexts_disposal_rate > 0 && | 164 return contexts_disposed > 0 && contexts_disposal_rate > 0 && |
165 contexts_disposal_rate < kHighContextDisposalRate; | 165 contexts_disposal_rate < kHighContextDisposalRate; |
166 } | 166 } |
167 | 167 |
168 | 168 |
169 bool GCIdleTimeHandler::ShouldDoFinalIncrementalMarkCompact( | 169 bool GCIdleTimeHandler::ShouldDoFinalIncrementalMarkCompact( |
170 size_t idle_time_in_ms, size_t size_of_objects, | 170 size_t idle_time_in_ms, size_t size_of_objects, |
171 size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { | 171 size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { |
172 return idle_time_in_ms >= | 172 return idle_time_in_ms >= |
173 EstimateFinalIncrementalMarkCompactTime( | 173 EstimateFinalIncrementalMarkCompactTime( |
174 size_of_objects, | 174 size_of_objects, |
(...skipping 14 matching lines...) Expand all Loading... |
189 // if we are allowed to still do full garbage collections during this idle | 189 // if we are allowed to still do full garbage collections during this idle |
190 // round or if we are not allowed to start incremental marking. Otherwise we | 190 // round or if we are not allowed to start incremental marking. Otherwise we |
191 // do not perform garbage collection to keep system utilization low. | 191 // do not perform garbage collection to keep system utilization low. |
192 // (5) If sweeping is in progress and we received a large enough idle time | 192 // (5) If sweeping is in progress and we received a large enough idle time |
193 // request, we finalize sweeping here. | 193 // request, we finalize sweeping here. |
194 // (6) If incremental marking is in progress, we perform a marking step. Note, | 194 // (6) If incremental marking is in progress, we perform a marking step. Note, |
195 // that this currently may trigger a full garbage collection. | 195 // that this currently may trigger a full garbage collection. |
196 GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms, | 196 GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms, |
197 HeapState heap_state) { | 197 HeapState heap_state) { |
198 if (static_cast<int>(idle_time_in_ms) <= 0) { | 198 if (static_cast<int>(idle_time_in_ms) <= 0) { |
| 199 if (heap_state.contexts_disposed > 0) { |
| 200 StartIdleRound(); |
| 201 } |
199 if (heap_state.incremental_marking_stopped) { | 202 if (heap_state.incremental_marking_stopped) { |
200 if (ShouldDoContextDisposalMarkCompact( | 203 if (ShouldDoContextDisposalMarkCompact( |
201 heap_state.contexts_disposed, | 204 heap_state.contexts_disposed, |
202 heap_state.contexts_disposal_rate)) { | 205 heap_state.contexts_disposal_rate)) { |
203 return GCIdleTimeAction::FullGC(); | 206 return GCIdleTimeAction::FullGC(); |
204 } | 207 } |
205 } | 208 } |
206 return GCIdleTimeAction::Nothing(); | 209 return GCIdleTimeAction::Nothing(); |
207 } | 210 } |
208 | 211 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 !heap_state.can_start_incremental_marking) { | 256 !heap_state.can_start_incremental_marking) { |
254 return GCIdleTimeAction::Nothing(); | 257 return GCIdleTimeAction::Nothing(); |
255 } | 258 } |
256 size_t step_size = EstimateMarkingStepSize( | 259 size_t step_size = EstimateMarkingStepSize( |
257 static_cast<size_t>(kIncrementalMarkingStepTimeInMs), | 260 static_cast<size_t>(kIncrementalMarkingStepTimeInMs), |
258 heap_state.incremental_marking_speed_in_bytes_per_ms); | 261 heap_state.incremental_marking_speed_in_bytes_per_ms); |
259 return GCIdleTimeAction::IncrementalMarking(step_size); | 262 return GCIdleTimeAction::IncrementalMarking(step_size); |
260 } | 263 } |
261 } | 264 } |
262 } | 265 } |
OLD | NEW |