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 | 6 |
7 #include "src/flags.h" | 7 #include "src/flags.h" |
8 #include "src/heap/gc-tracer.h" | 8 #include "src/heap/gc-tracer.h" |
9 #include "src/utils.h" | 9 #include "src/utils.h" |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 case DO_SCAVENGE: | 35 case DO_SCAVENGE: |
36 PrintF("scavenge"); | 36 PrintF("scavenge"); |
37 break; | 37 break; |
38 case DO_FULL_GC: | 38 case DO_FULL_GC: |
39 PrintF("full GC"); | 39 PrintF("full GC"); |
40 break; | 40 break; |
41 } | 41 } |
42 } | 42 } |
43 | 43 |
44 | 44 |
45 void GCIdleTimeHandler::HeapState::Print() { | 45 void GCIdleTimeHeapState::Print() { |
46 PrintF("contexts_disposed=%d ", contexts_disposed); | 46 PrintF("contexts_disposed=%d ", contexts_disposed); |
47 PrintF("contexts_disposal_rate=%f ", contexts_disposal_rate); | 47 PrintF("contexts_disposal_rate=%f ", contexts_disposal_rate); |
48 PrintF("size_of_objects=%" V8_PTR_PREFIX "d ", size_of_objects); | 48 PrintF("size_of_objects=%" V8_PTR_PREFIX "d ", size_of_objects); |
49 PrintF("incremental_marking_stopped=%d ", incremental_marking_stopped); | 49 PrintF("incremental_marking_stopped=%d ", incremental_marking_stopped); |
50 PrintF("sweeping_in_progress=%d ", sweeping_in_progress); | 50 PrintF("sweeping_in_progress=%d ", sweeping_in_progress); |
51 PrintF("has_low_allocation_rate=%d", has_low_allocation_rate); | 51 PrintF("has_low_allocation_rate=%d", has_low_allocation_rate); |
52 PrintF("mark_compact_speed=%" V8_PTR_PREFIX "d ", | 52 PrintF("mark_compact_speed=%" V8_PTR_PREFIX "d ", |
53 mark_compact_speed_in_bytes_per_ms); | 53 mark_compact_speed_in_bytes_per_ms); |
54 PrintF("incremental_marking_speed=%" V8_PTR_PREFIX "d ", | 54 PrintF("incremental_marking_speed=%" V8_PTR_PREFIX "d ", |
55 incremental_marking_speed_in_bytes_per_ms); | 55 incremental_marking_speed_in_bytes_per_ms); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 // a full GC. | 233 // a full GC. |
234 // (2) If the context disposal rate is high and we cannot perform a full GC, | 234 // (2) If the context disposal rate is high and we cannot perform a full GC, |
235 // we do nothing until the context disposal rate becomes lower. | 235 // we do nothing until the context disposal rate becomes lower. |
236 // (3) If the new space is almost full and we can affort a scavenge or if the | 236 // (3) If the new space is almost full and we can affort a scavenge or if the |
237 // next scavenge will very likely take long, then a scavenge is performed. | 237 // next scavenge will very likely take long, then a scavenge is performed. |
238 // (4) If sweeping is in progress and we received a large enough idle time | 238 // (4) If sweeping is in progress and we received a large enough idle time |
239 // request, we finalize sweeping here. | 239 // request, we finalize sweeping here. |
240 // (5) If incremental marking is in progress, we perform a marking step. Note, | 240 // (5) If incremental marking is in progress, we perform a marking step. Note, |
241 // that this currently may trigger a full garbage collection. | 241 // that this currently may trigger a full garbage collection. |
242 GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms, | 242 GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms, |
243 HeapState heap_state) { | 243 GCIdleTimeHeapState heap_state) { |
244 if (static_cast<int>(idle_time_in_ms) <= 0) { | 244 if (static_cast<int>(idle_time_in_ms) <= 0) { |
245 if (heap_state.incremental_marking_stopped) { | 245 if (heap_state.incremental_marking_stopped) { |
246 if (ShouldDoContextDisposalMarkCompact( | 246 if (ShouldDoContextDisposalMarkCompact( |
247 heap_state.contexts_disposed, | 247 heap_state.contexts_disposed, |
248 heap_state.contexts_disposal_rate)) { | 248 heap_state.contexts_disposal_rate)) { |
249 return GCIdleTimeAction::FullGC(); | 249 return GCIdleTimeAction::FullGC(); |
250 } | 250 } |
251 } | 251 } |
252 return GCIdleTimeAction::Nothing(); | 252 return GCIdleTimeAction::Nothing(); |
253 } | 253 } |
(...skipping 16 matching lines...) Expand all Loading... |
270 if (!FLAG_incremental_marking || heap_state.incremental_marking_stopped) { | 270 if (!FLAG_incremental_marking || heap_state.incremental_marking_stopped) { |
271 return GCIdleTimeAction::Done(); | 271 return GCIdleTimeAction::Done(); |
272 } | 272 } |
273 | 273 |
274 return GCIdleTimeAction::IncrementalStep(); | 274 return GCIdleTimeAction::IncrementalStep(); |
275 } | 275 } |
276 | 276 |
277 | 277 |
278 } | 278 } |
279 } | 279 } |
OLD | NEW |