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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 new_space_allocation_limit = new_space_size; | 125 new_space_allocation_limit = new_space_size; |
126 } | 126 } |
127 | 127 |
128 // We do not know the allocation throughput before the first Scavenge. | 128 // We do not know the allocation throughput before the first Scavenge. |
129 // TODO(hpayer): Estimate allocation throughput before the first Scavenge. | 129 // TODO(hpayer): Estimate allocation throughput before the first Scavenge. |
130 if (new_space_allocation_throughput_in_bytes_per_ms == 0) { | 130 if (new_space_allocation_throughput_in_bytes_per_ms == 0) { |
131 new_space_allocation_limit = | 131 new_space_allocation_limit = |
132 static_cast<size_t>(new_space_size * kConservativeTimeRatio); | 132 static_cast<size_t>(new_space_size * kConservativeTimeRatio); |
133 } else { | 133 } else { |
134 // We have to trigger scavenge before we reach the end of new space. | 134 // We have to trigger scavenge before we reach the end of new space. |
135 new_space_allocation_limit -= | 135 size_t adjust_limit = new_space_allocation_throughput_in_bytes_per_ms * |
136 new_space_allocation_throughput_in_bytes_per_ms * kMaxScheduledIdleTime; | 136 kTimeUntilNextIdleEvent; |
| 137 if (adjust_limit > new_space_allocation_limit) |
| 138 new_space_allocation_limit = 0; |
| 139 else |
| 140 new_space_allocation_limit -= adjust_limit; |
137 } | 141 } |
138 | 142 |
139 if (scavenge_speed_in_bytes_per_ms == 0) { | 143 if (scavenge_speed_in_bytes_per_ms == 0) { |
140 scavenge_speed_in_bytes_per_ms = kInitialConservativeScavengeSpeed; | 144 scavenge_speed_in_bytes_per_ms = kInitialConservativeScavengeSpeed; |
141 } | 145 } |
142 | 146 |
143 if (new_space_allocation_limit <= used_new_space_size) { | 147 if (new_space_allocation_limit <= used_new_space_size) { |
144 if (used_new_space_size / scavenge_speed_in_bytes_per_ms <= | 148 if (used_new_space_size / scavenge_speed_in_bytes_per_ms <= |
145 idle_time_in_ms) { | 149 idle_time_in_ms) { |
146 return true; | 150 return true; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 !heap_state.can_start_incremental_marking) { | 255 !heap_state.can_start_incremental_marking) { |
252 return GCIdleTimeAction::Nothing(); | 256 return GCIdleTimeAction::Nothing(); |
253 } | 257 } |
254 size_t step_size = EstimateMarkingStepSize( | 258 size_t step_size = EstimateMarkingStepSize( |
255 static_cast<size_t>(kIncrementalMarkingStepTimeInMs), | 259 static_cast<size_t>(kIncrementalMarkingStepTimeInMs), |
256 heap_state.incremental_marking_speed_in_bytes_per_ms); | 260 heap_state.incremental_marking_speed_in_bytes_per_ms); |
257 return GCIdleTimeAction::IncrementalMarking(step_size); | 261 return GCIdleTimeAction::IncrementalMarking(step_size); |
258 } | 262 } |
259 } | 263 } |
260 } | 264 } |
OLD | NEW |