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

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

Issue 750813003: Use deadline in IdleNotification. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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/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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // new idle round if enough garbage was created. Otherwise we do not perform 159 // new idle round if enough garbage was created. Otherwise we do not perform
160 // garbage collection to keep system utilization low. 160 // garbage collection to keep system utilization low.
161 // (4) If incremental marking is done, we perform a full garbage collection 161 // (4) If incremental marking is done, we perform a full garbage collection
162 // if we are allowed to still do full garbage collections during this idle 162 // if we are allowed to still do full garbage collections during this idle
163 // round or if we are not allowed to start incremental marking. Otherwise we 163 // round or if we are not allowed to start incremental marking. Otherwise we
164 // do not perform garbage collection to keep system utilization low. 164 // do not perform garbage collection to keep system utilization low.
165 // (5) If sweeping is in progress and we received a large enough idle time 165 // (5) If sweeping is in progress and we received a large enough idle time
166 // request, we finalize sweeping here. 166 // request, we finalize sweeping here.
167 // (6) If incremental marking is in progress, we perform a marking step. Note, 167 // (6) If incremental marking is in progress, we perform a marking step. Note,
168 // that this currently may trigger a full garbage collection. 168 // that this currently may trigger a full garbage collection.
169 GCIdleTimeAction GCIdleTimeHandler::Compute(size_t idle_time_in_ms, 169 GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time,
rmcilroy 2014/11/25 14:28:06 nit - keep this as idle_time_in_ms
Hannes Payer (out of office) 2014/11/25 16:01:36 Done.
170 HeapState heap_state) { 170 HeapState heap_state) {
171 if (idle_time_in_ms == 0) { 171 if (idle_time <= 0.0) {
172 if (heap_state.incremental_marking_stopped) { 172 if (heap_state.incremental_marking_stopped) {
173 if (ShouldDoContextDisposalMarkCompact( 173 if (ShouldDoContextDisposalMarkCompact(
174 heap_state.contexts_disposed, 174 heap_state.contexts_disposed,
175 heap_state.contexts_disposal_rate)) { 175 heap_state.contexts_disposal_rate)) {
176 return GCIdleTimeAction::FullGC(); 176 return GCIdleTimeAction::FullGC();
177 } 177 }
178 } 178 }
179 return GCIdleTimeAction::Nothing(); 179 return GCIdleTimeAction::Nothing();
180 } 180 }
181 181
182 size_t idle_time_in_ms = static_cast<size_t>(idle_time);
183
182 if (ShouldDoScavenge( 184 if (ShouldDoScavenge(
183 idle_time_in_ms, heap_state.new_space_capacity, 185 idle_time_in_ms, heap_state.new_space_capacity,
184 heap_state.used_new_space_size, 186 heap_state.used_new_space_size,
185 heap_state.scavenge_speed_in_bytes_per_ms, 187 heap_state.scavenge_speed_in_bytes_per_ms,
186 heap_state.new_space_allocation_throughput_in_bytes_per_ms)) { 188 heap_state.new_space_allocation_throughput_in_bytes_per_ms)) {
187 return GCIdleTimeAction::Scavenge(); 189 return GCIdleTimeAction::Scavenge();
188 } 190 }
189 191
190 if (IsMarkCompactIdleRoundFinished()) { 192 if (IsMarkCompactIdleRoundFinished()) {
191 if (EnoughGarbageSinceLastIdleRound()) { 193 if (EnoughGarbageSinceLastIdleRound()) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 if (heap_state.incremental_marking_stopped && 226 if (heap_state.incremental_marking_stopped &&
225 !heap_state.can_start_incremental_marking) { 227 !heap_state.can_start_incremental_marking) {
226 return GCIdleTimeAction::Nothing(); 228 return GCIdleTimeAction::Nothing();
227 } 229 }
228 size_t step_size = EstimateMarkingStepSize( 230 size_t step_size = EstimateMarkingStepSize(
229 idle_time_in_ms, heap_state.incremental_marking_speed_in_bytes_per_ms); 231 idle_time_in_ms, heap_state.incremental_marking_speed_in_bytes_per_ms);
230 return GCIdleTimeAction::IncrementalMarking(step_size); 232 return GCIdleTimeAction::IncrementalMarking(step_size);
231 } 233 }
232 } 234 }
233 } 235 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698