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

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

Issue 563573002: Do full GC for small heaps in idle time handler. (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 | no next file » | 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 GCIdleTimeAction GCIdleTimeHandler::Compute(size_t idle_time_in_ms, 71 GCIdleTimeAction GCIdleTimeHandler::Compute(size_t idle_time_in_ms,
72 HeapState heap_state) { 72 HeapState heap_state) {
73 if (IsIdleRoundFinished()) { 73 if (IsIdleRoundFinished()) {
74 if (EnoughGarbageSinceLastIdleRound() || heap_state.contexts_disposed > 0) { 74 if (EnoughGarbageSinceLastIdleRound() || heap_state.contexts_disposed > 0) {
75 StartIdleRound(); 75 StartIdleRound();
76 } else { 76 } else {
77 return GCIdleTimeAction::Nothing(); 77 return GCIdleTimeAction::Nothing();
78 } 78 }
79 } 79 }
80 if (heap_state.incremental_marking_stopped) { 80 if (heap_state.incremental_marking_stopped) {
81 const size_t kSmallHeap = 2 * kPointerSize * MB;
Hannes Payer (out of office) 2014/09/11 09:21:59 please move this constant to the header file.
81 if (idle_time_in_ms >= EstimateMarkCompactTime( 82 if (idle_time_in_ms >= EstimateMarkCompactTime(
82 heap_state.size_of_objects, 83 heap_state.size_of_objects,
83 heap_state.mark_compact_speed_in_bytes_per_ms)) { 84 heap_state.mark_compact_speed_in_bytes_per_ms) ||
85 (heap_state.size_of_objects < kSmallHeap &&
86 heap_state.contexts_disposed > 0)) {
84 // If there are no more than two GCs left in this idle round and we are 87 // If there are no more than two GCs left in this idle round and we are
85 // allowed to do a full GC, then make those GCs full in order to compact 88 // allowed to do a full GC, then make those GCs full in order to compact
86 // the code space. 89 // the code space.
87 // TODO(ulan): Once we enable code compaction for incremental marking, we 90 // TODO(ulan): Once we enable code compaction for incremental marking, we
88 // can get rid of this special case and always start incremental marking. 91 // can get rid of this special case and always start incremental marking.
89 int remaining_mark_sweeps = 92 int remaining_mark_sweeps =
90 kMaxMarkCompactsInIdleRound - mark_compacts_since_idle_round_started_; 93 kMaxMarkCompactsInIdleRound - mark_compacts_since_idle_round_started_;
91 if (heap_state.contexts_disposed > 0 || remaining_mark_sweeps <= 2 || 94 if (heap_state.contexts_disposed > 0 || remaining_mark_sweeps <= 2 ||
92 !heap_state.can_start_incremental_marking) { 95 !heap_state.can_start_incremental_marking) {
93 return GCIdleTimeAction::FullGC(); 96 return GCIdleTimeAction::FullGC();
94 } 97 }
95 } 98 }
96 if (!heap_state.can_start_incremental_marking) { 99 if (!heap_state.can_start_incremental_marking) {
97 return GCIdleTimeAction::Nothing(); 100 return GCIdleTimeAction::Nothing();
98 } 101 }
99 } 102 }
100 // TODO(hpayer): Estimate finalize sweeping time. 103 // TODO(hpayer): Estimate finalize sweeping time.
101 if (heap_state.sweeping_in_progress && 104 if (heap_state.sweeping_in_progress &&
102 idle_time_in_ms >= kMinTimeForFinalizeSweeping) { 105 idle_time_in_ms >= kMinTimeForFinalizeSweeping) {
103 return GCIdleTimeAction::FinalizeSweeping(); 106 return GCIdleTimeAction::FinalizeSweeping();
104 } 107 }
105 108
106 size_t step_size = EstimateMarkingStepSize( 109 size_t step_size = EstimateMarkingStepSize(
107 idle_time_in_ms, heap_state.incremental_marking_speed_in_bytes_per_ms); 110 idle_time_in_ms, heap_state.incremental_marking_speed_in_bytes_per_ms);
108 return GCIdleTimeAction::IncrementalMarking(step_size); 111 return GCIdleTimeAction::IncrementalMarking(step_size);
109 } 112 }
110 } 113 }
111 } 114 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698