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

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

Issue 2321553002: [heap] Do more incremental marking work in tasks. (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
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"
11 #include "src/heap/incremental-marking-job.h" 11 #include "src/heap/incremental-marking-job.h"
12 #include "src/heap/mark-compact.h" 12 #include "src/heap/mark-compact.h"
13 #include "src/heap/spaces.h" 13 #include "src/heap/spaces.h"
14 #include "src/objects.h" 14 #include "src/objects.h"
15 15
16 namespace v8 { 16 namespace v8 {
17 namespace internal { 17 namespace internal {
18 18
19 // Forward declarations. 19 // Forward declarations.
20 class MarkBit; 20 class MarkBit;
21 class PagedSpace; 21 class PagedSpace;
22 22
23 enum class StepOrigin { kV8, kTask };
24
23 class IncrementalMarking { 25 class IncrementalMarking {
24 public: 26 public:
25 enum State { STOPPED, SWEEPING, MARKING, COMPLETE }; 27 enum State { STOPPED, SWEEPING, MARKING, COMPLETE };
26 28
27 enum CompletionAction { GC_VIA_STACK_GUARD, NO_GC_VIA_STACK_GUARD }; 29 enum CompletionAction { GC_VIA_STACK_GUARD, NO_GC_VIA_STACK_GUARD };
28 30
29 enum ForceCompletionAction { FORCE_COMPLETION, DO_NOT_FORCE_COMPLETION }; 31 enum ForceCompletionAction { FORCE_COMPLETION, DO_NOT_FORCE_COMPLETION };
30 32
31 enum GCRequestType { NONE, COMPLETE_MARKING, FINALIZATION }; 33 enum GCRequestType { NONE, COMPLETE_MARKING, FINALIZATION };
32 34
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 92
91 void MarkingComplete(CompletionAction action); 93 void MarkingComplete(CompletionAction action);
92 94
93 void Epilogue(); 95 void Epilogue();
94 96
95 // Performs incremental marking steps until deadline_in_ms is reached. It 97 // Performs incremental marking steps until deadline_in_ms is reached. It
96 // returns the remaining time that cannot be used for incremental marking 98 // returns the remaining time that cannot be used for incremental marking
97 // anymore because a single step would exceed the deadline. 99 // anymore because a single step would exceed the deadline.
98 double AdvanceIncrementalMarking(double deadline_in_ms, 100 double AdvanceIncrementalMarking(double deadline_in_ms,
99 CompletionAction completion_action, 101 CompletionAction completion_action,
100 ForceCompletionAction force_completion); 102 ForceCompletionAction force_completion,
103 StepOrigin step_origin);
101 104
102 // It's hard to know how much work the incremental marker should do to make 105 // It's hard to know how much work the incremental marker should do to make
103 // progress in the face of the mutator creating new work for it. We start 106 // progress in the face of the mutator creating new work for it. We start
104 // of at a moderate rate of work and gradually increase the speed of the 107 // of at a moderate rate of work and gradually increase the speed of the
105 // incremental marker until it completes. 108 // incremental marker until it completes.
106 // Do some marking every time this much memory has been allocated or that many 109 // Do some marking every time this much memory has been allocated or that many
107 // heavy (color-checking) write barriers have been invoked. 110 // heavy (color-checking) write barriers have been invoked.
108 static const intptr_t kAllocatedThreshold = 65536; 111 static const intptr_t kAllocatedThreshold = 65536;
109 static const intptr_t kWriteBarriersInvokedThreshold = 32768; 112 static const intptr_t kWriteBarriersInvokedThreshold = 32768;
110 // Start off by marking this many times more memory than has been allocated. 113 // Start off by marking this many times more memory than has been allocated.
(...skipping 11 matching lines...) Expand all
122 125
123 // This is the upper bound for how many times we allow finalization of 126 // This is the upper bound for how many times we allow finalization of
124 // incremental marking to be postponed. 127 // incremental marking to be postponed.
125 static const size_t kMaxIdleMarkingDelayCounter = 3; 128 static const size_t kMaxIdleMarkingDelayCounter = 3;
126 129
127 void FinalizeSweeping(); 130 void FinalizeSweeping();
128 131
129 void NotifyAllocatedBytes(intptr_t allocated_bytes); 132 void NotifyAllocatedBytes(intptr_t allocated_bytes);
130 133
131 void Step(intptr_t bytes_to_process, CompletionAction action, 134 void Step(intptr_t bytes_to_process, CompletionAction action,
132 ForceCompletionAction completion); 135 ForceCompletionAction completion, StepOrigin origin);
133 136
134 inline void RestartIfNotMarking(); 137 inline void RestartIfNotMarking();
135 138
136 static void RecordWriteFromCode(HeapObject* obj, Object** slot, 139 static void RecordWriteFromCode(HeapObject* obj, Object** slot,
137 Isolate* isolate); 140 Isolate* isolate);
138 141
139 static void RecordWriteOfCodeEntryFromCode(JSFunction* host, Object** slot, 142 static void RecordWriteOfCodeEntryFromCode(JSFunction* host, Object** slot,
140 Isolate* isolate); 143 Isolate* isolate);
141 144
142 // Record a slot for compaction. Returns false for objects that are 145 // Record a slot for compaction. Returns false for objects that are
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 290
288 int steps_count_; 291 int steps_count_;
289 int64_t old_generation_space_available_at_start_of_incremental_; 292 int64_t old_generation_space_available_at_start_of_incremental_;
290 int64_t old_generation_space_used_at_start_of_incremental_; 293 int64_t old_generation_space_used_at_start_of_incremental_;
291 int64_t bytes_rescanned_; 294 int64_t bytes_rescanned_;
292 bool should_hurry_; 295 bool should_hurry_;
293 int marking_speed_; 296 int marking_speed_;
294 intptr_t bytes_scanned_; 297 intptr_t bytes_scanned_;
295 intptr_t allocated_; 298 intptr_t allocated_;
296 intptr_t write_barriers_invoked_since_last_step_; 299 intptr_t write_barriers_invoked_since_last_step_;
300 intptr_t bytes_marked_ahead_of_schedule_;
297 size_t idle_marking_delay_counter_; 301 size_t idle_marking_delay_counter_;
298 302
299 int unscanned_bytes_of_large_object_; 303 int unscanned_bytes_of_large_object_;
300 304
301 bool was_activated_; 305 bool was_activated_;
302 306
303 bool black_allocation_; 307 bool black_allocation_;
304 308
305 bool finalize_marking_completed_; 309 bool finalize_marking_completed_;
306 310
307 int incremental_marking_finalization_rounds_; 311 int incremental_marking_finalization_rounds_;
308 312
309 GCRequestType request_type_; 313 GCRequestType request_type_;
310 314
311 IncrementalMarkingJob incremental_marking_job_; 315 IncrementalMarkingJob incremental_marking_job_;
312 316
313 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); 317 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking);
314 }; 318 };
315 } // namespace internal 319 } // namespace internal
316 } // namespace v8 320 } // namespace v8
317 321
318 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ 322 #endif // V8_HEAP_INCREMENTAL_MARKING_H_
OLDNEW
« src/heap/heap.cc ('K') | « 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