| 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 #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/incremental-marking-job.h" | 10 #include "src/heap/incremental-marking-job.h" |
| 11 #include "src/heap/mark-compact.h" |
| 11 #include "src/objects.h" | 12 #include "src/objects.h" |
| 12 | 13 |
| 13 namespace v8 { | 14 namespace v8 { |
| 14 namespace internal { | 15 namespace internal { |
| 15 | 16 |
| 16 // Forward declarations. | |
| 17 class MarkBit; | |
| 18 class PagedSpace; | |
| 19 | |
| 20 class IncrementalMarking { | 17 class IncrementalMarking { |
| 21 public: | 18 public: |
| 22 enum State { STOPPED, SWEEPING, MARKING, COMPLETE }; | 19 enum State { STOPPED, SWEEPING, MARKING, COMPLETE }; |
| 23 | 20 |
| 24 enum CompletionAction { GC_VIA_STACK_GUARD, NO_GC_VIA_STACK_GUARD }; | 21 enum CompletionAction { GC_VIA_STACK_GUARD, NO_GC_VIA_STACK_GUARD }; |
| 25 | 22 |
| 26 enum ForceMarkingAction { FORCE_MARKING, DO_NOT_FORCE_MARKING }; | 23 enum ForceMarkingAction { FORCE_MARKING, DO_NOT_FORCE_MARKING }; |
| 27 | 24 |
| 28 enum ForceCompletionAction { FORCE_COMPLETION, DO_NOT_FORCE_COMPLETION }; | 25 enum ForceCompletionAction { FORCE_COMPLETION, DO_NOT_FORCE_COMPLETION }; |
| 29 | 26 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 void RecordWrites(HeapObject* obj); | 174 void RecordWrites(HeapObject* obj); |
| 178 | 175 |
| 179 void BlackToGreyAndUnshift(HeapObject* obj, MarkBit mark_bit); | 176 void BlackToGreyAndUnshift(HeapObject* obj, MarkBit mark_bit); |
| 180 | 177 |
| 181 void WhiteToGreyAndPush(HeapObject* obj, MarkBit mark_bit); | 178 void WhiteToGreyAndPush(HeapObject* obj, MarkBit mark_bit); |
| 182 | 179 |
| 183 inline void SetOldSpacePageFlags(MemoryChunk* chunk) { | 180 inline void SetOldSpacePageFlags(MemoryChunk* chunk) { |
| 184 SetOldSpacePageFlags(chunk, IsMarking(), IsCompacting()); | 181 SetOldSpacePageFlags(chunk, IsMarking(), IsCompacting()); |
| 185 } | 182 } |
| 186 | 183 |
| 187 inline void SetNewSpacePageFlags(MemoryChunk* chunk) { | 184 inline void SetNewSpacePageFlags(NewSpacePage* chunk) { |
| 188 SetNewSpacePageFlags(chunk, IsMarking()); | 185 SetNewSpacePageFlags(chunk, IsMarking()); |
| 189 } | 186 } |
| 190 | 187 |
| 191 bool IsCompacting() { return IsMarking() && is_compacting_; } | 188 bool IsCompacting() { return IsMarking() && is_compacting_; } |
| 192 | 189 |
| 193 void ActivateGeneratedStub(Code* stub); | 190 void ActivateGeneratedStub(Code* stub); |
| 194 | 191 |
| 195 void NotifyOfHighPromotionRate(); | 192 void NotifyOfHighPromotionRate(); |
| 196 | 193 |
| 197 void EnterNoMarkingScope() { no_marking_scope_depth_++; } | 194 void EnterNoMarkingScope() { no_marking_scope_depth_++; } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 227 static void ActivateIncrementalWriteBarrier(NewSpace* space); | 224 static void ActivateIncrementalWriteBarrier(NewSpace* space); |
| 228 void ActivateIncrementalWriteBarrier(); | 225 void ActivateIncrementalWriteBarrier(); |
| 229 | 226 |
| 230 static void DeactivateIncrementalWriteBarrierForSpace(PagedSpace* space); | 227 static void DeactivateIncrementalWriteBarrierForSpace(PagedSpace* space); |
| 231 static void DeactivateIncrementalWriteBarrierForSpace(NewSpace* space); | 228 static void DeactivateIncrementalWriteBarrierForSpace(NewSpace* space); |
| 232 void DeactivateIncrementalWriteBarrier(); | 229 void DeactivateIncrementalWriteBarrier(); |
| 233 | 230 |
| 234 static void SetOldSpacePageFlags(MemoryChunk* chunk, bool is_marking, | 231 static void SetOldSpacePageFlags(MemoryChunk* chunk, bool is_marking, |
| 235 bool is_compacting); | 232 bool is_compacting); |
| 236 | 233 |
| 237 static void SetNewSpacePageFlags(MemoryChunk* chunk, bool is_marking); | 234 static void SetNewSpacePageFlags(NewSpacePage* chunk, bool is_marking); |
| 238 | 235 |
| 239 INLINE(void ProcessMarkingDeque()); | 236 INLINE(void ProcessMarkingDeque()); |
| 240 | 237 |
| 241 INLINE(intptr_t ProcessMarkingDeque(intptr_t bytes_to_process)); | 238 INLINE(intptr_t ProcessMarkingDeque(intptr_t bytes_to_process)); |
| 242 | 239 |
| 243 INLINE(void VisitObject(Map* map, HeapObject* obj, int size)); | 240 INLINE(void VisitObject(Map* map, HeapObject* obj, int size)); |
| 244 | 241 |
| 245 void IncrementIdleMarkingDelayCounter(); | 242 void IncrementIdleMarkingDelayCounter(); |
| 246 | 243 |
| 247 Heap* heap_; | 244 Heap* heap_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 273 GCRequestType request_type_; | 270 GCRequestType request_type_; |
| 274 | 271 |
| 275 IncrementalMarkingJob incremental_marking_job_; | 272 IncrementalMarkingJob incremental_marking_job_; |
| 276 | 273 |
| 277 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); | 274 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); |
| 278 }; | 275 }; |
| 279 } // namespace internal | 276 } // namespace internal |
| 280 } // namespace v8 | 277 } // namespace v8 |
| 281 | 278 |
| 282 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ | 279 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ |
| OLD | NEW |