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

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

Issue 1265423002: Use idle task to perform incremental marking steps. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: More test fixes Created 5 years, 3 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') | src/heap/heap.h » ('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 6
7 #include "src/flags.h" 7 #include "src/flags.h"
8 #include "src/heap/gc-tracer.h" 8 #include "src/heap/gc-tracer.h"
9 #include "src/utils.h" 9 #include "src/utils.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 13
14 const double GCIdleTimeHandler::kConservativeTimeRatio = 0.9; 14 const double GCIdleTimeHandler::kConservativeTimeRatio = 0.9;
15 const size_t GCIdleTimeHandler::kMaxMarkCompactTimeInMs = 1000; 15 const size_t GCIdleTimeHandler::kMaxMarkCompactTimeInMs = 1000;
16 const size_t GCIdleTimeHandler::kMaxFinalIncrementalMarkCompactTimeInMs = 1000; 16 const size_t GCIdleTimeHandler::kMaxFinalIncrementalMarkCompactTimeInMs = 1000;
17 const double GCIdleTimeHandler::kHighContextDisposalRate = 100; 17 const double GCIdleTimeHandler::kHighContextDisposalRate = 100;
18 const size_t GCIdleTimeHandler::kMinTimeForOverApproximatingWeakClosureInMs = 1; 18 const size_t GCIdleTimeHandler::kMinTimeForOverApproximatingWeakClosureInMs = 1;
19 19
20 20
21 void GCIdleTimeAction::Print() { 21 void GCIdleTimeAction::Print() {
22 switch (type) { 22 switch (type) {
23 case DONE: 23 case DONE:
24 PrintF("done"); 24 PrintF("done");
25 break; 25 break;
26 case DO_NOTHING: 26 case DO_NOTHING:
27 PrintF("no action"); 27 PrintF("no action");
28 break; 28 break;
29 case DO_INCREMENTAL_MARKING: 29 case DO_INCREMENTAL_STEP:
30 PrintF("incremental marking with step %" V8_PTR_PREFIX "d / ms", 30 PrintF("incremental step");
31 parameter);
32 if (additional_work) { 31 if (additional_work) {
33 PrintF("; finalized marking"); 32 PrintF("; finalized marking");
34 } 33 }
35 break; 34 break;
36 case DO_SCAVENGE: 35 case DO_SCAVENGE:
37 PrintF("scavenge"); 36 PrintF("scavenge");
38 break; 37 break;
39 case DO_FULL_GC: 38 case DO_FULL_GC:
40 PrintF("full GC"); 39 PrintF("full GC");
41 break; 40 break;
42 case DO_FINALIZE_SWEEPING:
43 PrintF("finalize sweeping");
44 break;
45 } 41 }
46 } 42 }
47 43
48 44
49 void GCIdleTimeHandler::HeapState::Print() { 45 void GCIdleTimeHandler::HeapState::Print() {
50 PrintF("contexts_disposed=%d ", contexts_disposed); 46 PrintF("contexts_disposed=%d ", contexts_disposed);
51 PrintF("contexts_disposal_rate=%f ", contexts_disposal_rate); 47 PrintF("contexts_disposal_rate=%f ", contexts_disposal_rate);
52 PrintF("size_of_objects=%" V8_PTR_PREFIX "d ", size_of_objects); 48 PrintF("size_of_objects=%" V8_PTR_PREFIX "d ", size_of_objects);
53 PrintF("incremental_marking_stopped=%d ", incremental_marking_stopped); 49 PrintF("incremental_marking_stopped=%d ", incremental_marking_stopped);
54 PrintF("sweeping_in_progress=%d ", sweeping_in_progress); 50 PrintF("sweeping_in_progress=%d ", sweeping_in_progress);
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 } 260 }
265 261
266 if (ShouldDoScavenge( 262 if (ShouldDoScavenge(
267 static_cast<size_t>(idle_time_in_ms), heap_state.new_space_capacity, 263 static_cast<size_t>(idle_time_in_ms), heap_state.new_space_capacity,
268 heap_state.used_new_space_size, 264 heap_state.used_new_space_size,
269 heap_state.scavenge_speed_in_bytes_per_ms, 265 heap_state.scavenge_speed_in_bytes_per_ms,
270 heap_state.new_space_allocation_throughput_in_bytes_per_ms)) { 266 heap_state.new_space_allocation_throughput_in_bytes_per_ms)) {
271 return GCIdleTimeAction::Scavenge(); 267 return GCIdleTimeAction::Scavenge();
272 } 268 }
273 269
274 if (heap_state.sweeping_in_progress) {
275 if (heap_state.sweeping_completed) {
276 return GCIdleTimeAction::FinalizeSweeping();
277 } else {
278 return NothingOrDone(idle_time_in_ms);
279 }
280 }
281
282 if (!FLAG_incremental_marking || heap_state.incremental_marking_stopped) { 270 if (!FLAG_incremental_marking || heap_state.incremental_marking_stopped) {
283 return GCIdleTimeAction::Done(); 271 return GCIdleTimeAction::Done();
284 } 272 }
285 273
286 size_t step_size = EstimateMarkingStepSize( 274 return GCIdleTimeAction::IncrementalStep();
287 static_cast<size_t>(kIncrementalMarkingStepTimeInMs),
288 heap_state.incremental_marking_speed_in_bytes_per_ms);
289 return GCIdleTimeAction::IncrementalMarking(step_size);
290 } 275 }
291 276
292 277
293 } 278 }
294 } 279 }
OLDNEW
« no previous file with comments | « src/heap/gc-idle-time-handler.h ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698