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

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

Issue 580083002: Avoid idle times smaller than 1ms. (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 | « no previous file | 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 return GCIdleTimeAction::Scavenge(); 119 return GCIdleTimeAction::Scavenge();
120 } 120 }
121 if (IsMarkCompactIdleRoundFinished()) { 121 if (IsMarkCompactIdleRoundFinished()) {
122 if (EnoughGarbageSinceLastIdleRound() || heap_state.contexts_disposed > 0) { 122 if (EnoughGarbageSinceLastIdleRound() || heap_state.contexts_disposed > 0) {
123 StartIdleRound(); 123 StartIdleRound();
124 } else { 124 } else {
125 return GCIdleTimeAction::Done(); 125 return GCIdleTimeAction::Done();
126 } 126 }
127 } 127 }
128 128
129 if (idle_time_in_ms == 0) {
130 return GCIdleTimeAction::Nothing();
131 }
132
129 if (heap_state.incremental_marking_stopped) { 133 if (heap_state.incremental_marking_stopped) {
130 size_t estimated_time_in_ms = 134 size_t estimated_time_in_ms =
131 EstimateMarkCompactTime(heap_state.size_of_objects, 135 EstimateMarkCompactTime(heap_state.size_of_objects,
132 heap_state.mark_compact_speed_in_bytes_per_ms); 136 heap_state.mark_compact_speed_in_bytes_per_ms);
133 if (idle_time_in_ms >= estimated_time_in_ms || 137 if (idle_time_in_ms >= estimated_time_in_ms ||
134 (heap_state.size_of_objects < kSmallHeapSize && 138 (heap_state.size_of_objects < kSmallHeapSize &&
135 heap_state.contexts_disposed > 0)) { 139 heap_state.contexts_disposed > 0)) {
136 // If there are no more than two GCs left in this idle round and we are 140 // If there are no more than two GCs left in this idle round and we are
137 // allowed to do a full GC, then make those GCs full in order to compact 141 // allowed to do a full GC, then make those GCs full in order to compact
138 // the code space. 142 // the code space.
(...skipping 21 matching lines...) Expand all
160 if (heap_state.incremental_marking_stopped && 164 if (heap_state.incremental_marking_stopped &&
161 !heap_state.can_start_incremental_marking) { 165 !heap_state.can_start_incremental_marking) {
162 return GCIdleTimeAction::Nothing(); 166 return GCIdleTimeAction::Nothing();
163 } 167 }
164 size_t step_size = EstimateMarkingStepSize( 168 size_t step_size = EstimateMarkingStepSize(
165 idle_time_in_ms, heap_state.incremental_marking_speed_in_bytes_per_ms); 169 idle_time_in_ms, heap_state.incremental_marking_speed_in_bytes_per_ms);
166 return GCIdleTimeAction::IncrementalMarking(step_size); 170 return GCIdleTimeAction::IncrementalMarking(step_size);
167 } 171 }
168 } 172 }
169 } 173 }
OLDNEW
« no previous file with comments | « no previous file | src/heap/gc-idle-time-handler-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698