| 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/flags.h" | 5 #include "src/flags.h" |
| 6 #include "src/heap/gc-idle-time-handler.h" | 6 #include "src/heap/gc-idle-time-handler.h" |
| 7 #include "src/heap/gc-tracer.h" | 7 #include "src/heap/gc-tracer.h" |
| 8 #include "src/utils.h" | 8 #include "src/utils.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 kMaxScheduledIdleTime * scavenge_speed_in_bytes_per_ms; | 122 kMaxScheduledIdleTime * scavenge_speed_in_bytes_per_ms; |
| 123 | 123 |
| 124 // If the limit is larger than the new space size, then scavenging used to be | 124 // If the limit is larger than the new space size, then scavenging used to be |
| 125 // really fast. We can take advantage of the whole new space. | 125 // really fast. We can take advantage of the whole new space. |
| 126 if (new_space_allocation_limit > new_space_size) { | 126 if (new_space_allocation_limit > new_space_size) { |
| 127 new_space_allocation_limit = new_space_size; | 127 new_space_allocation_limit = new_space_size; |
| 128 } | 128 } |
| 129 | 129 |
| 130 // We do not know the allocation throughput before the first scavenge. | 130 // We do not know the allocation throughput before the first scavenge. |
| 131 // TODO(hpayer): Estimate allocation throughput before the first scavenge. | 131 // TODO(hpayer): Estimate allocation throughput before the first scavenge. |
| 132 if (new_space_allocation_throughput_in_bytes_per_ms == 0) { | 132 if (new_space_allocation_throughput_in_bytes_per_ms > 0) { |
| 133 new_space_allocation_limit = | |
| 134 static_cast<size_t>(new_space_size * kConservativeTimeRatio); | |
| 135 } else { | |
| 136 // We have to trigger scavenge before we reach the end of new space. | 133 // We have to trigger scavenge before we reach the end of new space. |
| 137 size_t adjust_limit = new_space_allocation_throughput_in_bytes_per_ms * | 134 size_t adjust_limit = new_space_allocation_throughput_in_bytes_per_ms * |
| 138 kTimeUntilNextIdleEvent; | 135 kTimeUntilNextIdleEvent; |
| 139 if (adjust_limit > new_space_allocation_limit) { | 136 if (adjust_limit > new_space_allocation_limit) { |
| 140 new_space_allocation_limit = 0; | 137 new_space_allocation_limit = 0; |
| 141 } else { | 138 } else { |
| 142 new_space_allocation_limit -= adjust_limit; | 139 new_space_allocation_limit -= adjust_limit; |
| 143 } | 140 } |
| 144 } | 141 } |
| 145 | 142 |
| 143 if (new_space_allocation_throughput_in_bytes_per_ms < |
| 144 kLowAllocationThroughput) { |
| 145 new_space_allocation_limit = |
| 146 Min(new_space_allocation_limit, |
| 147 static_cast<size_t>(new_space_size * kConservativeTimeRatio)); |
| 148 } |
| 149 |
| 146 // The allocated new space limit to trigger a scavange has to be at least | 150 // The allocated new space limit to trigger a scavange has to be at least |
| 147 // kMinimumNewSpaceSizeToPerformScavenge. | 151 // kMinimumNewSpaceSizeToPerformScavenge. |
| 148 if (new_space_allocation_limit < kMinimumNewSpaceSizeToPerformScavenge) { | 152 if (new_space_allocation_limit < kMinimumNewSpaceSizeToPerformScavenge) { |
| 149 new_space_allocation_limit = kMinimumNewSpaceSizeToPerformScavenge; | 153 new_space_allocation_limit = kMinimumNewSpaceSizeToPerformScavenge; |
| 150 } | 154 } |
| 151 | 155 |
| 152 if (scavenge_speed_in_bytes_per_ms == 0) { | 156 if (scavenge_speed_in_bytes_per_ms == 0) { |
| 153 scavenge_speed_in_bytes_per_ms = kInitialConservativeScavengeSpeed; | 157 scavenge_speed_in_bytes_per_ms = kInitialConservativeScavengeSpeed; |
| 154 } | 158 } |
| 155 | 159 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 268 |
| 265 size_t step_size = EstimateMarkingStepSize( | 269 size_t step_size = EstimateMarkingStepSize( |
| 266 static_cast<size_t>(kIncrementalMarkingStepTimeInMs), | 270 static_cast<size_t>(kIncrementalMarkingStepTimeInMs), |
| 267 heap_state.incremental_marking_speed_in_bytes_per_ms); | 271 heap_state.incremental_marking_speed_in_bytes_per_ms); |
| 268 return GCIdleTimeAction::IncrementalMarking(step_size); | 272 return GCIdleTimeAction::IncrementalMarking(step_size); |
| 269 } | 273 } |
| 270 | 274 |
| 271 | 275 |
| 272 } | 276 } |
| 273 } | 277 } |
| OLD | NEW |