Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Side by Side Diff: src/heap/gc-idle-time-handler.cc

Issue 1272573006: When allocation rate is low and we are close to the new space limit, we should perform a scavenge d… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/gc-idle-time-handler.h ('k') | test/unittests/heap/gc-idle-time-handler-unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/heap/gc-idle-time-handler.h ('k') | test/unittests/heap/gc-idle-time-handler-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698