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