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

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: Add tracing 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
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 {
11 namespace internal { 11 namespace internal {
12 12
13 const double GCIdleTimeHandler::kConservativeTimeRatio = 0.9; 13 const double GCIdleTimeHandler::kConservativeTimeRatio = 0.9;
14 const size_t GCIdleTimeHandler::kMaxMarkCompactTimeInMs = 1000; 14 const size_t GCIdleTimeHandler::kMaxMarkCompactTimeInMs = 1000;
15 const size_t GCIdleTimeHandler::kMaxFinalIncrementalMarkCompactTimeInMs = 1000; 15 const size_t GCIdleTimeHandler::kMaxFinalIncrementalMarkCompactTimeInMs = 1000;
16 const double GCIdleTimeHandler::kHighContextDisposalRate = 100; 16 const double GCIdleTimeHandler::kHighContextDisposalRate = 100;
17 const size_t GCIdleTimeHandler::kMinTimeForOverApproximatingWeakClosureInMs = 1; 17 const size_t GCIdleTimeHandler::kMinTimeForOverApproximatingWeakClosureInMs = 1;
18 18
19 19
20 void GCIdleTimeAction::Print() { 20 void GCIdleTimeAction::Print() {
21 switch (type) { 21 switch (type) {
22 case DONE: 22 case DONE:
23 PrintF("done"); 23 PrintF("done");
24 break; 24 break;
25 case DO_NOTHING: 25 case DO_NOTHING:
26 PrintF("no action"); 26 PrintF("no action");
27 break; 27 break;
28 case DO_INCREMENTAL_MARKING: 28 case DO_INCREMENTAL_STEP:
29 PrintF("incremental marking with step %" V8_PTR_PREFIX "d / ms", 29 PrintF("incremental step");
30 parameter);
31 if (additional_work) { 30 if (additional_work) {
32 PrintF("; finalized marking"); 31 PrintF("; finalized marking");
33 } 32 }
34 break; 33 break;
35 case DO_SCAVENGE: 34 case DO_SCAVENGE:
36 PrintF("scavenge"); 35 PrintF("scavenge");
37 break; 36 break;
38 case DO_FULL_GC: 37 case DO_FULL_GC:
39 PrintF("full GC"); 38 PrintF("full GC");
40 break; 39 break;
41 case DO_FINALIZE_SWEEPING:
42 PrintF("finalize sweeping");
43 break;
44 } 40 }
45 } 41 }
46 42
47 43
48 void GCIdleTimeHandler::HeapState::Print() { 44 void GCIdleTimeHandler::HeapState::Print() {
49 PrintF("contexts_disposed=%d ", contexts_disposed); 45 PrintF("contexts_disposed=%d ", contexts_disposed);
50 PrintF("contexts_disposal_rate=%f ", contexts_disposal_rate); 46 PrintF("contexts_disposal_rate=%f ", contexts_disposal_rate);
51 PrintF("size_of_objects=%" V8_PTR_PREFIX "d ", size_of_objects); 47 PrintF("size_of_objects=%" V8_PTR_PREFIX "d ", size_of_objects);
52 PrintF("incremental_marking_stopped=%d ", incremental_marking_stopped); 48 PrintF("incremental_marking_stopped=%d ", incremental_marking_stopped);
53 PrintF("sweeping_in_progress=%d ", sweeping_in_progress); 49 PrintF("sweeping_in_progress=%d ", sweeping_in_progress);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 } 239 }
244 240
245 if (ShouldDoScavenge( 241 if (ShouldDoScavenge(
246 static_cast<size_t>(idle_time_in_ms), heap_state.new_space_capacity, 242 static_cast<size_t>(idle_time_in_ms), heap_state.new_space_capacity,
247 heap_state.used_new_space_size, 243 heap_state.used_new_space_size,
248 heap_state.scavenge_speed_in_bytes_per_ms, 244 heap_state.scavenge_speed_in_bytes_per_ms,
249 heap_state.new_space_allocation_throughput_in_bytes_per_ms)) { 245 heap_state.new_space_allocation_throughput_in_bytes_per_ms)) {
250 return GCIdleTimeAction::Scavenge(); 246 return GCIdleTimeAction::Scavenge();
251 } 247 }
252 248
253 if (heap_state.sweeping_in_progress) { 249 if (heap_state.incremental_marking_stopped) return GCIdleTimeAction::Done();
Hannes Payer (out of office) 2015/08/05 12:35:44 !FLAG_incremental_marking ||
ulan 2015/08/05 12:45:40 Done.
254 if (heap_state.sweeping_completed) {
255 return GCIdleTimeAction::FinalizeSweeping();
256 } else {
257 return NothingOrDone(idle_time_in_ms);
258 }
259 }
260 250
261 if (!FLAG_incremental_marking || heap_state.incremental_marking_stopped) { 251 return GCIdleTimeAction::IncrementalStep();
262 return GCIdleTimeAction::Done();
263 }
264
265 size_t step_size = EstimateMarkingStepSize(
266 static_cast<size_t>(kIncrementalMarkingStepTimeInMs),
267 heap_state.incremental_marking_speed_in_bytes_per_ms);
268 return GCIdleTimeAction::IncrementalMarking(step_size);
269 } 252 }
270 253
271 254
272 } 255 }
273 } 256 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698