OLD | NEW |
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 | 8 |
9 #include "src/execution.h" | 9 #include "src/execution.h" |
10 #include "src/heap/mark-compact.h" | 10 #include "src/heap/mark-compact.h" |
11 #include "src/objects.h" | 11 #include "src/objects.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 | 16 |
17 class IncrementalMarking { | 17 class IncrementalMarking { |
18 public: | 18 public: |
19 enum State { STOPPED, SWEEPING, MARKING, COMPLETE }; | 19 enum State { STOPPED, SWEEPING, MARKING, COMPLETE }; |
20 | 20 |
21 enum CompletionAction { GC_VIA_STACK_GUARD, NO_GC_VIA_STACK_GUARD }; | 21 enum CompletionAction { GC_VIA_STACK_GUARD, NO_GC_VIA_STACK_GUARD }; |
22 | 22 |
23 enum ForceMarkingAction { FORCE_MARKING, DO_NOT_FORCE_MARKING }; | 23 enum ForceMarkingAction { FORCE_MARKING, DO_NOT_FORCE_MARKING }; |
24 | 24 |
25 enum ForceCompletionAction { FORCE_COMPLETION, DO_NOT_FORCE_COMPLETION }; | 25 enum ForceCompletionAction { FORCE_COMPLETION, DO_NOT_FORCE_COMPLETION }; |
26 | 26 |
27 enum GCRequestType { COMPLETE_MARKING, OVERAPPROXIMATION }; | 27 enum GCRequestType { COMPLETE_MARKING, OVERAPPROXIMATION }; |
28 | 28 |
29 struct StepActions { | |
30 StepActions(CompletionAction complete_action_, | |
31 ForceMarkingAction force_marking_, | |
32 ForceCompletionAction force_completion_) | |
33 : completion_action(complete_action_), | |
34 force_marking(force_marking_), | |
35 force_completion(force_completion_) {} | |
36 | |
37 CompletionAction completion_action; | |
38 ForceMarkingAction force_marking; | |
39 ForceCompletionAction force_completion; | |
40 }; | |
41 | |
42 static StepActions NoForcedStepActions(); | |
43 | |
44 explicit IncrementalMarking(Heap* heap); | 29 explicit IncrementalMarking(Heap* heap); |
45 | 30 |
46 static void Initialize(); | 31 static void Initialize(); |
47 | 32 |
48 State state() { | 33 State state() { |
49 DCHECK(state_ == STOPPED || FLAG_incremental_marking); | 34 DCHECK(state_ == STOPPED || FLAG_incremental_marking); |
50 return state_; | 35 return state_; |
51 } | 36 } |
52 | 37 |
53 bool should_hurry() { return should_hurry_; } | 38 bool should_hurry() { return should_hurry_; } |
(...skipping 21 matching lines...) Expand all Loading... |
75 } | 60 } |
76 | 61 |
77 GCRequestType request_type() const { return request_type_; } | 62 GCRequestType request_type() const { return request_type_; } |
78 | 63 |
79 bool CanBeActivated(); | 64 bool CanBeActivated(); |
80 | 65 |
81 bool ShouldActivateEvenWithoutIdleNotification(); | 66 bool ShouldActivateEvenWithoutIdleNotification(); |
82 | 67 |
83 bool WasActivated(); | 68 bool WasActivated(); |
84 | 69 |
85 void Start(int mark_compact_flags, | 70 void Start(int mark_compact_flags); |
86 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags, | |
87 const char* reason = nullptr); | |
88 | 71 |
89 void Stop(); | 72 void Stop(); |
90 | 73 |
91 void MarkObjectGroups(); | 74 void MarkObjectGroups(); |
92 | 75 |
93 void UpdateMarkingDequeAfterScavenge(); | 76 void UpdateMarkingDequeAfterScavenge(); |
94 | 77 |
95 void Hurry(); | 78 void Hurry(); |
96 | 79 |
97 void Finalize(); | 80 void Finalize(); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 } | 178 } |
196 | 179 |
197 void ClearIdleMarkingDelayCounter(); | 180 void ClearIdleMarkingDelayCounter(); |
198 | 181 |
199 bool IsIdleMarkingDelayCounterLimitReached(); | 182 bool IsIdleMarkingDelayCounterLimitReached(); |
200 | 183 |
201 INLINE(static void MarkObject(Heap* heap, HeapObject* object)); | 184 INLINE(static void MarkObject(Heap* heap, HeapObject* object)); |
202 | 185 |
203 Heap* heap() const { return heap_; } | 186 Heap* heap() const { return heap_; } |
204 | 187 |
205 GCCallbackFlags CallbackFlags() const { return gc_callback_flags_; } | |
206 | |
207 private: | 188 private: |
208 int64_t SpaceLeftInOldSpace(); | 189 int64_t SpaceLeftInOldSpace(); |
209 | 190 |
210 void SpeedUp(); | 191 void SpeedUp(); |
211 | 192 |
212 void ResetStepCounters(); | 193 void ResetStepCounters(); |
213 | 194 |
214 void StartMarking(); | 195 void StartMarking(); |
215 | 196 |
216 void ActivateIncrementalWriteBarrier(PagedSpace* space); | 197 void ActivateIncrementalWriteBarrier(PagedSpace* space); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 int unscanned_bytes_of_large_object_; | 236 int unscanned_bytes_of_large_object_; |
256 | 237 |
257 bool was_activated_; | 238 bool was_activated_; |
258 | 239 |
259 bool weak_closure_was_overapproximated_; | 240 bool weak_closure_was_overapproximated_; |
260 | 241 |
261 int weak_closure_approximation_rounds_; | 242 int weak_closure_approximation_rounds_; |
262 | 243 |
263 GCRequestType request_type_; | 244 GCRequestType request_type_; |
264 | 245 |
265 GCCallbackFlags gc_callback_flags_; | |
266 | |
267 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); | 246 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); |
268 }; | 247 }; |
269 } | 248 } |
270 } // namespace v8::internal | 249 } // namespace v8::internal |
271 | 250 |
272 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ | 251 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ |
OLD | NEW |