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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // round or if we are not allowed to start incremental marking. Otherwise we | 137 // round or if we are not allowed to start incremental marking. Otherwise we |
138 // do not perform garbage collection to keep system utilization low. | 138 // do not perform garbage collection to keep system utilization low. |
139 // (5) If sweeping is in progress and we received a large enough idle time | 139 // (5) If sweeping is in progress and we received a large enough idle time |
140 // request, we finalize sweeping here. | 140 // request, we finalize sweeping here. |
141 // (6) If incremental marking is in progress, we perform a marking step. Note, | 141 // (6) If incremental marking is in progress, we perform a marking step. Note, |
142 // that this currently may trigger a full garbage collection. | 142 // that this currently may trigger a full garbage collection. |
143 GCIdleTimeAction GCIdleTimeHandler::Compute(size_t idle_time_in_ms, | 143 GCIdleTimeAction GCIdleTimeHandler::Compute(size_t idle_time_in_ms, |
144 HeapState heap_state) { | 144 HeapState heap_state) { |
145 if (idle_time_in_ms == 0) { | 145 if (idle_time_in_ms == 0) { |
146 if (heap_state.incremental_marking_stopped) { | 146 if (heap_state.incremental_marking_stopped) { |
147 if (heap_state.size_of_objects < kSmallHeapSize && | 147 if (heap_state.contexts_disposed > 0 && |
148 heap_state.contexts_disposed > 0 && | |
149 heap_state.contexts_disposal_rate < kHighContextDisposalRate) { | 148 heap_state.contexts_disposal_rate < kHighContextDisposalRate) { |
150 return GCIdleTimeAction::FullGC(); | 149 return GCIdleTimeAction::FullGC(); |
151 } | 150 } |
152 } | 151 } |
153 return GCIdleTimeAction::Nothing(); | 152 return GCIdleTimeAction::Nothing(); |
154 } | 153 } |
155 | 154 |
156 if (ShouldDoScavenge( | 155 if (ShouldDoScavenge( |
157 idle_time_in_ms, heap_state.new_space_capacity, | 156 idle_time_in_ms, heap_state.new_space_capacity, |
158 heap_state.used_new_space_size, | 157 heap_state.used_new_space_size, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 if (heap_state.incremental_marking_stopped && | 197 if (heap_state.incremental_marking_stopped && |
199 !heap_state.can_start_incremental_marking) { | 198 !heap_state.can_start_incremental_marking) { |
200 return GCIdleTimeAction::Nothing(); | 199 return GCIdleTimeAction::Nothing(); |
201 } | 200 } |
202 size_t step_size = EstimateMarkingStepSize( | 201 size_t step_size = EstimateMarkingStepSize( |
203 idle_time_in_ms, heap_state.incremental_marking_speed_in_bytes_per_ms); | 202 idle_time_in_ms, heap_state.incremental_marking_speed_in_bytes_per_ms); |
204 return GCIdleTimeAction::IncrementalMarking(step_size); | 203 return GCIdleTimeAction::IncrementalMarking(step_size); |
205 } | 204 } |
206 } | 205 } |
207 } | 206 } |
OLD | NEW |