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

Side by Side Diff: src/heap/incremental-marking.h

Issue 2304613002: Revert of [heap] Simplify heuristics for incremental step size. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/incremental-marking.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_INCREMENTAL_MARKING_H_ 5 #ifndef V8_HEAP_INCREMENTAL_MARKING_H_
6 #define V8_HEAP_INCREMENTAL_MARKING_H_ 6 #define V8_HEAP_INCREMENTAL_MARKING_H_
7 7
8 #include "src/cancelable-task.h" 8 #include "src/cancelable-task.h"
9 #include "src/execution.h" 9 #include "src/execution.h"
10 #include "src/heap/heap.h" 10 #include "src/heap/heap.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 StepActions step_actions); 116 StepActions step_actions);
117 117
118 // It's hard to know how much work the incremental marker should do to make 118 // It's hard to know how much work the incremental marker should do to make
119 // progress in the face of the mutator creating new work for it. We start 119 // progress in the face of the mutator creating new work for it. We start
120 // of at a moderate rate of work and gradually increase the speed of the 120 // of at a moderate rate of work and gradually increase the speed of the
121 // incremental marker until it completes. 121 // incremental marker until it completes.
122 // Do some marking every time this much memory has been allocated or that many 122 // Do some marking every time this much memory has been allocated or that many
123 // heavy (color-checking) write barriers have been invoked. 123 // heavy (color-checking) write barriers have been invoked.
124 static const intptr_t kAllocatedThreshold = 65536; 124 static const intptr_t kAllocatedThreshold = 65536;
125 static const intptr_t kWriteBarriersInvokedThreshold = 32768; 125 static const intptr_t kWriteBarriersInvokedThreshold = 32768;
126 // Cap the write barrier counter to avoid overflows. 126 // Start off by marking this many times more memory than has been allocated.
127 static const intptr_t kMaxWriteBarrierCounter = 1 << 20; 127 static const intptr_t kInitialMarkingSpeed = 1;
128 // These constants are arbitrary and chosen based on benchmarks. 128 // But if we are promoting a lot of data we need to mark faster to keep up
129 static const intptr_t kBytesToMarkPerAllocatedByte = 3; 129 // with the data that is entering the old space through promotion.
130 static const intptr_t kBytesToMarkPerWriteBarrier = 10; 130 static const intptr_t kFastMarking = 3;
131 static const intptr_t kMinIncrementalStepDurationInMs = 1; 131 // After this many steps we increase the marking/allocating factor.
132 static const intptr_t kMarkingSpeedAccellerationInterval = 1024;
133 // This is how much we increase the marking/allocating factor by.
134 static const intptr_t kMarkingSpeedAccelleration = 2;
135 static const intptr_t kMaxMarkingSpeed = 1000;
132 136
133 // This is the upper bound for how many times we allow finalization of 137 // This is the upper bound for how many times we allow finalization of
134 // incremental marking to be postponed. 138 // incremental marking to be postponed.
135 static const size_t kMaxIdleMarkingDelayCounter = 3; 139 static const size_t kMaxIdleMarkingDelayCounter = 3;
136 140
137 void FinalizeSweeping(); 141 void FinalizeSweeping();
138 142
139 void OldSpaceStep(intptr_t allocated); 143 void OldSpaceStep(intptr_t allocated);
140 144
141 intptr_t Step(intptr_t allocated, CompletionAction action, 145 intptr_t Step(intptr_t allocated, CompletionAction action,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 } 180 }
177 181
178 inline void SetNewSpacePageFlags(Page* chunk) { 182 inline void SetNewSpacePageFlags(Page* chunk) {
179 SetNewSpacePageFlags(chunk, IsMarking()); 183 SetNewSpacePageFlags(chunk, IsMarking());
180 } 184 }
181 185
182 bool IsCompacting() { return IsMarking() && is_compacting_; } 186 bool IsCompacting() { return IsMarking() && is_compacting_; }
183 187
184 void ActivateGeneratedStub(Code* stub); 188 void ActivateGeneratedStub(Code* stub);
185 189
190 void NotifyOfHighPromotionRate();
191
186 void NotifyIncompleteScanOfObject(int unscanned_bytes) { 192 void NotifyIncompleteScanOfObject(int unscanned_bytes) {
187 unscanned_bytes_of_large_object_ = unscanned_bytes; 193 unscanned_bytes_of_large_object_ = unscanned_bytes;
188 } 194 }
189 195
190 void ClearIdleMarkingDelayCounter(); 196 void ClearIdleMarkingDelayCounter();
191 197
192 bool IsIdleMarkingDelayCounterLimitReached(); 198 bool IsIdleMarkingDelayCounterLimitReached();
193 199
194 static void MarkGrey(Heap* heap, HeapObject* object); 200 static void MarkGrey(Heap* heap, HeapObject* object);
195 201
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 incremental_marking_.Step(bytes_allocated, 248 incremental_marking_.Step(bytes_allocated,
243 IncrementalMarking::GC_VIA_STACK_GUARD); 249 IncrementalMarking::GC_VIA_STACK_GUARD);
244 } 250 }
245 251
246 private: 252 private:
247 IncrementalMarking& incremental_marking_; 253 IncrementalMarking& incremental_marking_;
248 }; 254 };
249 255
250 int64_t SpaceLeftInOldSpace(); 256 int64_t SpaceLeftInOldSpace();
251 257
258 void SpeedUp();
259
252 void ResetStepCounters(); 260 void ResetStepCounters();
253 261
254 void StartMarking(); 262 void StartMarking();
255 263
256 void StartBlackAllocation(); 264 void StartBlackAllocation();
257 void FinishBlackAllocation(); 265 void FinishBlackAllocation();
258 266
259 void MarkRoots(); 267 void MarkRoots();
260 void MarkObjectGroups(); 268 void MarkObjectGroups();
261 void ProcessWeakCells(); 269 void ProcessWeakCells();
(...skipping 24 matching lines...) Expand all
286 294
287 void IncrementIdleMarkingDelayCounter(); 295 void IncrementIdleMarkingDelayCounter();
288 296
289 Heap* heap_; 297 Heap* heap_;
290 298
291 Observer observer_; 299 Observer observer_;
292 300
293 State state_; 301 State state_;
294 bool is_compacting_; 302 bool is_compacting_;
295 303
304 int steps_count_;
305 int64_t old_generation_space_available_at_start_of_incremental_;
306 int64_t old_generation_space_used_at_start_of_incremental_;
307 int64_t bytes_rescanned_;
296 bool should_hurry_; 308 bool should_hurry_;
309 int marking_speed_;
310 intptr_t bytes_scanned_;
297 intptr_t allocated_; 311 intptr_t allocated_;
298 intptr_t write_barriers_invoked_since_last_step_; 312 intptr_t write_barriers_invoked_since_last_step_;
299 size_t idle_marking_delay_counter_; 313 size_t idle_marking_delay_counter_;
300 314
301 int unscanned_bytes_of_large_object_; 315 int unscanned_bytes_of_large_object_;
302 316
303 bool was_activated_; 317 bool was_activated_;
304 318
305 bool black_allocation_; 319 bool black_allocation_;
306 320
307 bool finalize_marking_completed_; 321 bool finalize_marking_completed_;
308 322
309 int incremental_marking_finalization_rounds_; 323 int incremental_marking_finalization_rounds_;
310 324
311 GCRequestType request_type_; 325 GCRequestType request_type_;
312 326
313 IncrementalMarkingJob incremental_marking_job_; 327 IncrementalMarkingJob incremental_marking_job_;
314 328
315 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); 329 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking);
316 }; 330 };
317 } // namespace internal 331 } // namespace internal
318 } // namespace v8 332 } // namespace v8
319 333
320 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ 334 #endif // V8_HEAP_INCREMENTAL_MARKING_H_
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/incremental-marking.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698