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

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

Issue 1071503002: Version 4.3.61.2 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.3
Patch Set: Created 5 years, 8 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/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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 } 177 }
178 178
179 179
180 bool GCIdleTimeHandler::ShouldDoOverApproximateWeakClosure( 180 bool GCIdleTimeHandler::ShouldDoOverApproximateWeakClosure(
181 size_t idle_time_in_ms) { 181 size_t idle_time_in_ms) {
182 // TODO(jochen): Estimate the time it will take to build the object groups. 182 // TODO(jochen): Estimate the time it will take to build the object groups.
183 return idle_time_in_ms >= kMinTimeForOverApproximatingWeakClosureInMs; 183 return idle_time_in_ms >= kMinTimeForOverApproximatingWeakClosureInMs;
184 } 184 }
185 185
186 186
187 GCIdleTimeAction GCIdleTimeHandler::NothingOrDone() {
188 if (idle_times_which_made_no_progress_since_last_idle_round_ >=
189 kMaxNoProgressIdleTimesPerIdleRound) {
190 return GCIdleTimeAction::Done();
191 } else {
192 idle_times_which_made_no_progress_since_last_idle_round_++;
193 return GCIdleTimeAction::Nothing();
194 }
195 }
196
197
187 // The following logic is implemented by the controller: 198 // The following logic is implemented by the controller:
188 // (1) If we don't have any idle time, do nothing, unless a context was 199 // (1) If we don't have any idle time, do nothing, unless a context was
189 // disposed, incremental marking is stopped, and the heap is small. Then do 200 // disposed, incremental marking is stopped, and the heap is small. Then do
190 // a full GC. 201 // a full GC.
191 // (2) If the new space is almost full and we can affort a Scavenge or if the 202 // (2) If the new space is almost full and we can afford a Scavenge or if the
192 // next Scavenge will very likely take long, then a Scavenge is performed. 203 // next Scavenge will very likely take long, then a Scavenge is performed.
193 // (3) If there is currently no MarkCompact idle round going on, we start a 204 // (3) If there is currently no MarkCompact idle round going on, we start a
194 // new idle round if enough garbage was created. Otherwise we do not perform 205 // new idle round if enough garbage was created. Otherwise we do not perform
195 // garbage collection to keep system utilization low. 206 // garbage collection to keep system utilization low.
196 // (4) If incremental marking is done, we perform a full garbage collection 207 // (4) If incremental marking is done, we perform a full garbage collection
197 // if we are allowed to still do full garbage collections during this idle 208 // if we are allowed to still do full garbage collections during this idle
198 // round or if we are not allowed to start incremental marking. Otherwise we 209 // round or if we are not allowed to start incremental marking. Otherwise we
199 // do not perform garbage collection to keep system utilization low. 210 // do not perform garbage collection to keep system utilization low.
200 // (5) If sweeping is in progress and we received a large enough idle time 211 // (5) If sweeping is in progress and we received a large enough idle time
201 // request, we finalize sweeping here. 212 // request, we finalize sweeping here.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 } 253 }
243 254
244 // TODO(hpayer): Estimate finalize sweeping time. 255 // TODO(hpayer): Estimate finalize sweeping time.
245 if (heap_state.sweeping_in_progress && 256 if (heap_state.sweeping_in_progress &&
246 static_cast<size_t>(idle_time_in_ms) >= kMinTimeForFinalizeSweeping) { 257 static_cast<size_t>(idle_time_in_ms) >= kMinTimeForFinalizeSweeping) {
247 return GCIdleTimeAction::FinalizeSweeping(); 258 return GCIdleTimeAction::FinalizeSweeping();
248 } 259 }
249 260
250 if (heap_state.incremental_marking_stopped && 261 if (heap_state.incremental_marking_stopped &&
251 !heap_state.can_start_incremental_marking) { 262 !heap_state.can_start_incremental_marking) {
252 return GCIdleTimeAction::Nothing(); 263 return NothingOrDone();
253 } 264 }
265
254 size_t step_size = EstimateMarkingStepSize( 266 size_t step_size = EstimateMarkingStepSize(
255 static_cast<size_t>(kIncrementalMarkingStepTimeInMs), 267 static_cast<size_t>(kIncrementalMarkingStepTimeInMs),
256 heap_state.incremental_marking_speed_in_bytes_per_ms); 268 heap_state.incremental_marking_speed_in_bytes_per_ms);
257 return GCIdleTimeAction::IncrementalMarking(step_size); 269 return GCIdleTimeAction::IncrementalMarking(step_size);
258 } 270 }
259 } 271 }
260 } 272 }
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