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 |
29 explicit IncrementalMarking(Heap* heap); | 44 explicit IncrementalMarking(Heap* heap); |
30 | 45 |
31 static void Initialize(); | 46 static void Initialize(); |
32 | 47 |
33 State state() { | 48 State state() { |
34 DCHECK(state_ == STOPPED || FLAG_incremental_marking); | 49 DCHECK(state_ == STOPPED || FLAG_incremental_marking); |
35 return state_; | 50 return state_; |
36 } | 51 } |
37 | 52 |
38 bool should_hurry() { return should_hurry_; } | 53 bool should_hurry() { return should_hurry_; } |
(...skipping 21 matching lines...) Expand all Loading... |
60 } | 75 } |
61 | 76 |
62 GCRequestType request_type() const { return request_type_; } | 77 GCRequestType request_type() const { return request_type_; } |
63 | 78 |
64 bool CanBeActivated(); | 79 bool CanBeActivated(); |
65 | 80 |
66 bool ShouldActivateEvenWithoutIdleNotification(); | 81 bool ShouldActivateEvenWithoutIdleNotification(); |
67 | 82 |
68 bool WasActivated(); | 83 bool WasActivated(); |
69 | 84 |
70 void Start(int mark_compact_flags); | 85 void Start(int mark_compact_flags, |
| 86 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags, |
| 87 const char* reason = nullptr); |
71 | 88 |
72 void Stop(); | 89 void Stop(); |
73 | 90 |
74 void MarkObjectGroups(); | 91 void MarkObjectGroups(); |
75 | 92 |
76 void UpdateMarkingDequeAfterScavenge(); | 93 void UpdateMarkingDequeAfterScavenge(); |
77 | 94 |
78 void Hurry(); | 95 void Hurry(); |
79 | 96 |
80 void Finalize(); | 97 void Finalize(); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } | 195 } |
179 | 196 |
180 void ClearIdleMarkingDelayCounter(); | 197 void ClearIdleMarkingDelayCounter(); |
181 | 198 |
182 bool IsIdleMarkingDelayCounterLimitReached(); | 199 bool IsIdleMarkingDelayCounterLimitReached(); |
183 | 200 |
184 INLINE(static void MarkObject(Heap* heap, HeapObject* object)); | 201 INLINE(static void MarkObject(Heap* heap, HeapObject* object)); |
185 | 202 |
186 Heap* heap() const { return heap_; } | 203 Heap* heap() const { return heap_; } |
187 | 204 |
| 205 GCCallbackFlags CallbackFlags() const { return gc_callback_flags_; } |
| 206 |
188 private: | 207 private: |
189 int64_t SpaceLeftInOldSpace(); | 208 int64_t SpaceLeftInOldSpace(); |
190 | 209 |
191 void SpeedUp(); | 210 void SpeedUp(); |
192 | 211 |
193 void ResetStepCounters(); | 212 void ResetStepCounters(); |
194 | 213 |
195 void StartMarking(); | 214 void StartMarking(); |
196 | 215 |
197 void ActivateIncrementalWriteBarrier(PagedSpace* space); | 216 void ActivateIncrementalWriteBarrier(PagedSpace* space); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 int unscanned_bytes_of_large_object_; | 255 int unscanned_bytes_of_large_object_; |
237 | 256 |
238 bool was_activated_; | 257 bool was_activated_; |
239 | 258 |
240 bool weak_closure_was_overapproximated_; | 259 bool weak_closure_was_overapproximated_; |
241 | 260 |
242 int weak_closure_approximation_rounds_; | 261 int weak_closure_approximation_rounds_; |
243 | 262 |
244 GCRequestType request_type_; | 263 GCRequestType request_type_; |
245 | 264 |
| 265 GCCallbackFlags gc_callback_flags_; |
| 266 |
246 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); | 267 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); |
247 }; | 268 }; |
248 } | 269 } |
249 } // namespace v8::internal | 270 } // namespace v8::internal |
250 | 271 |
251 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ | 272 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ |
OLD | NEW |