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.h

Issue 1023153002: Limit rate of full garbage collections triggered by idle notification. Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | src/heap/gc-idle-time-handler.cc » ('j') | src/heap/gc-idle-time-handler.cc » ('J')
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 #ifndef V8_HEAP_GC_IDLE_TIME_HANDLER_H_ 5 #ifndef V8_HEAP_GC_IDLE_TIME_HANDLER_H_
6 #define V8_HEAP_GC_IDLE_TIME_HANDLER_H_ 6 #define V8_HEAP_GC_IDLE_TIME_HANDLER_H_
7 7
8 #include "src/globals.h" 8 #include "src/globals.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // If we haven't recorded any scavenger events yet, we use a conservative 129 // If we haven't recorded any scavenger events yet, we use a conservative
130 // lower bound for the scavenger speed. 130 // lower bound for the scavenger speed.
131 static const size_t kInitialConservativeScavengeSpeed = 100 * KB; 131 static const size_t kInitialConservativeScavengeSpeed = 100 * KB;
132 132
133 // If contexts are disposed at a higher rate a full gc is triggered. 133 // If contexts are disposed at a higher rate a full gc is triggered.
134 static const double kHighContextDisposalRate; 134 static const double kHighContextDisposalRate;
135 135
136 // Incremental marking step time. 136 // Incremental marking step time.
137 static const size_t kIncrementalMarkingStepTimeInMs = 1; 137 static const size_t kIncrementalMarkingStepTimeInMs = 1;
138 138
139 // This is the minimum time required to perform over approximation of
140 // weak closure during idle notification.
139 static const size_t kMinTimeForOverApproximatingWeakClosureInMs; 141 static const size_t kMinTimeForOverApproximatingWeakClosureInMs;
140 142
143 // No full garbage collections are performed if the last full GC was done
144 // kMinTimeInBetweenMarkCompactsInMs milliseconds before. Idle times larger
145 // than kMaxScheduledIdleTime ignore that threshold.
146 static const size_t kMinTimeInBetweenMarkCompactsInMs = 1000;
rmcilroy 2015/03/20 14:56:08 Is 1000ms a guesstimation or is there any reason t
147
141 class HeapState { 148 class HeapState {
142 public: 149 public:
143 void Print(); 150 void Print();
144 151
145 int contexts_disposed; 152 int contexts_disposed;
146 double contexts_disposal_rate; 153 double contexts_disposal_rate;
147 size_t size_of_objects; 154 size_t size_of_objects;
148 bool incremental_marking_stopped; 155 bool incremental_marking_stopped;
149 bool can_start_incremental_marking; 156 bool can_start_incremental_marking;
150 bool sweeping_in_progress; 157 bool sweeping_in_progress;
151 size_t mark_compact_speed_in_bytes_per_ms; 158 size_t mark_compact_speed_in_bytes_per_ms;
152 size_t incremental_marking_speed_in_bytes_per_ms; 159 size_t incremental_marking_speed_in_bytes_per_ms;
153 size_t final_incremental_mark_compact_speed_in_bytes_per_ms; 160 size_t final_incremental_mark_compact_speed_in_bytes_per_ms;
154 size_t scavenge_speed_in_bytes_per_ms; 161 size_t scavenge_speed_in_bytes_per_ms;
155 size_t used_new_space_size; 162 size_t used_new_space_size;
156 size_t new_space_capacity; 163 size_t new_space_capacity;
157 size_t new_space_allocation_throughput_in_bytes_per_ms; 164 size_t new_space_allocation_throughput_in_bytes_per_ms;
165 size_t last_mark_compact_time;
166 size_t current_time;
158 }; 167 };
159 168
160 GCIdleTimeHandler() 169 GCIdleTimeHandler()
161 : mark_compacts_since_idle_round_started_(0), 170 : mark_compacts_since_idle_round_started_(0),
162 scavenges_since_last_idle_round_(0) {} 171 scavenges_since_last_idle_round_(0) {}
163 172
164 GCIdleTimeAction Compute(double idle_time_in_ms, HeapState heap_state); 173 GCIdleTimeAction Compute(double idle_time_in_ms, HeapState heap_state);
165 174
166 void NotifyIdleMarkCompact() { 175 void NotifyIdleMarkCompact() {
167 if (mark_compacts_since_idle_round_started_ < kMaxMarkCompactsInIdleRound) { 176 if (mark_compacts_since_idle_round_started_ < kMaxMarkCompactsInIdleRound) {
(...skipping 11 matching lines...) Expand all
179 size_t marking_speed_in_bytes_per_ms); 188 size_t marking_speed_in_bytes_per_ms);
180 189
181 static size_t EstimateMarkCompactTime( 190 static size_t EstimateMarkCompactTime(
182 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms); 191 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms);
183 192
184 static size_t EstimateFinalIncrementalMarkCompactTime( 193 static size_t EstimateFinalIncrementalMarkCompactTime(
185 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms); 194 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms);
186 195
187 static bool ShouldDoMarkCompact(size_t idle_time_in_ms, 196 static bool ShouldDoMarkCompact(size_t idle_time_in_ms,
188 size_t size_of_objects, 197 size_t size_of_objects,
189 size_t mark_compact_speed_in_bytes_per_ms); 198 size_t mark_compact_speed_in_bytes_per_ms,
199 size_t last_mark_compact_time_in_ms,
200 size_t current_time_in_ms);
190 201
191 static bool ShouldDoContextDisposalMarkCompact(int context_disposed, 202 static bool ShouldDoContextDisposalMarkCompact(int context_disposed,
192 double contexts_disposal_rate); 203 double contexts_disposal_rate);
193 204
194 static bool ShouldDoFinalIncrementalMarkCompact( 205 static bool ShouldDoFinalIncrementalMarkCompact(
195 size_t idle_time_in_ms, size_t size_of_objects, 206 size_t idle_time_in_ms, size_t size_of_objects,
196 size_t final_incremental_mark_compact_speed_in_bytes_per_ms); 207 size_t final_incremental_mark_compact_speed_in_bytes_per_ms);
197 208
198 static bool ShouldDoOverApproximateWeakClosure(size_t idle_time_in_ms); 209 static bool ShouldDoOverApproximateWeakClosure(size_t idle_time_in_ms);
199 210
(...skipping 15 matching lines...) Expand all
215 int mark_compacts_since_idle_round_started_; 226 int mark_compacts_since_idle_round_started_;
216 int scavenges_since_last_idle_round_; 227 int scavenges_since_last_idle_round_;
217 228
218 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); 229 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler);
219 }; 230 };
220 231
221 } // namespace internal 232 } // namespace internal
222 } // namespace v8 233 } // namespace v8
223 234
224 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ 235 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap/gc-idle-time-handler.cc » ('j') | src/heap/gc-idle-time-handler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698