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

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

Issue 568023002: Use the regular start incremental marking strategy in the idle notification. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/heap/gc-idle-time-handler.h ('k') | src/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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 GCIdleTimeAction GCIdleTimeHandler::Compute(size_t idle_time_in_ms, 74 GCIdleTimeAction GCIdleTimeHandler::Compute(size_t idle_time_in_ms,
75 HeapState heap_state) { 75 HeapState heap_state) {
76 if (IsIdleRoundFinished()) { 76 if (IsIdleRoundFinished()) {
77 if (EnoughGarbageSinceLastIdleRound() || heap_state.contexts_disposed > 0) { 77 if (EnoughGarbageSinceLastIdleRound() || heap_state.contexts_disposed > 0) {
78 StartIdleRound(); 78 StartIdleRound();
79 } else { 79 } else {
80 return GCIdleTimeAction::Done(); 80 return GCIdleTimeAction::Done();
81 } 81 }
82 } 82 }
83
83 if (heap_state.incremental_marking_stopped) { 84 if (heap_state.incremental_marking_stopped) {
84 size_t estimated_time_in_ms = 85 size_t estimated_time_in_ms =
85 EstimateMarkCompactTime(heap_state.size_of_objects, 86 EstimateMarkCompactTime(heap_state.size_of_objects,
86 heap_state.mark_compact_speed_in_bytes_per_ms); 87 heap_state.mark_compact_speed_in_bytes_per_ms);
87 if (idle_time_in_ms >= estimated_time_in_ms || 88 if (idle_time_in_ms >= estimated_time_in_ms ||
88 (heap_state.size_of_objects < kSmallHeapSize && 89 (heap_state.size_of_objects < kSmallHeapSize &&
89 heap_state.contexts_disposed > 0)) { 90 heap_state.contexts_disposed > 0)) {
90 // If there are no more than two GCs left in this idle round and we are 91 // If there are no more than two GCs left in this idle round and we are
91 // allowed to do a full GC, then make those GCs full in order to compact 92 // allowed to do a full GC, then make those GCs full in order to compact
92 // the code space. 93 // the code space.
93 // TODO(ulan): Once we enable code compaction for incremental marking, we 94 // TODO(ulan): Once we enable code compaction for incremental marking, we
94 // can get rid of this special case and always start incremental marking. 95 // can get rid of this special case and always start incremental marking.
95 int remaining_mark_sweeps = 96 int remaining_mark_sweeps =
96 kMaxMarkCompactsInIdleRound - mark_compacts_since_idle_round_started_; 97 kMaxMarkCompactsInIdleRound - mark_compacts_since_idle_round_started_;
97 if (heap_state.contexts_disposed > 0 || remaining_mark_sweeps <= 2 || 98 if (heap_state.contexts_disposed > 0 ||
98 !heap_state.can_start_incremental_marking) { 99 (idle_time_in_ms > kMaxFrameRenderingIdleTime &&
100 (remaining_mark_sweeps <= 2 ||
101 !heap_state.can_start_incremental_marking))) {
99 return GCIdleTimeAction::FullGC(); 102 return GCIdleTimeAction::FullGC();
100 } 103 }
101 } 104 }
102 if (!heap_state.can_start_incremental_marking) { 105 if (!heap_state.can_start_incremental_marking) {
103 return GCIdleTimeAction::Nothing(); 106 return GCIdleTimeAction::Nothing();
104 } 107 }
105 } 108 }
106 // TODO(hpayer): Estimate finalize sweeping time. 109 // TODO(hpayer): Estimate finalize sweeping time.
107 if (heap_state.sweeping_in_progress && 110 if (heap_state.sweeping_in_progress &&
108 idle_time_in_ms >= kMinTimeForFinalizeSweeping) { 111 idle_time_in_ms >= kMinTimeForFinalizeSweeping) {
109 return GCIdleTimeAction::FinalizeSweeping(); 112 return GCIdleTimeAction::FinalizeSweeping();
110 } 113 }
111 114
115 if (heap_state.incremental_marking_stopped &&
116 !heap_state.can_start_incremental_marking) {
117 return GCIdleTimeAction::Nothing();
118 }
112 size_t step_size = EstimateMarkingStepSize( 119 size_t step_size = EstimateMarkingStepSize(
113 idle_time_in_ms, heap_state.incremental_marking_speed_in_bytes_per_ms); 120 idle_time_in_ms, heap_state.incremental_marking_speed_in_bytes_per_ms);
114 return GCIdleTimeAction::IncrementalMarking(step_size); 121 return GCIdleTimeAction::IncrementalMarking(step_size);
115 } 122 }
116 } 123 }
117 } 124 }
OLDNEW
« no previous file with comments | « src/heap/gc-idle-time-handler.h ('k') | src/heap/gc-idle-time-handler-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698