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_MARK_COMPACT_H_ | 5 #ifndef V8_HEAP_MARK_COMPACT_H_ |
6 #define V8_HEAP_MARK_COMPACT_H_ | 6 #define V8_HEAP_MARK_COMPACT_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 114 } |
115 | 115 |
116 template <MarkingMode mode = MarkingMode::FULL> | 116 template <MarkingMode mode = MarkingMode::FULL> |
117 V8_INLINE static void GreyToBlack(HeapObject* obj) { | 117 V8_INLINE static void GreyToBlack(HeapObject* obj) { |
118 DCHECK(IsGrey<mode>(obj)); | 118 DCHECK(IsGrey<mode>(obj)); |
119 MarkBit markbit = MarkBitFrom<mode>(obj); | 119 MarkBit markbit = MarkBitFrom<mode>(obj); |
120 Marking::GreyToBlack(markbit); | 120 Marking::GreyToBlack(markbit); |
121 MemoryChunk::IncrementLiveBytes<mode>(obj, obj->Size()); | 121 MemoryChunk::IncrementLiveBytes<mode>(obj, obj->Size()); |
122 } | 122 } |
123 | 123 |
124 template <MarkingMode mode = MarkingMode::FULL> | |
125 V8_INLINE static void AnyToGrey(HeapObject* obj) { | |
126 MarkBit markbit = MarkBitFrom<mode>(obj); | |
127 if (Marking::IsBlack(markbit)) { | |
128 MemoryChunk::IncrementLiveBytes<mode>(obj, -obj->Size()); | |
129 } | |
130 Marking::AnyToGrey(markbit); | |
131 } | |
132 | |
133 private: | 124 private: |
134 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectMarking); | 125 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectMarking); |
135 }; | 126 }; |
136 | 127 |
137 // ---------------------------------------------------------------------------- | 128 // ---------------------------------------------------------------------------- |
138 // Marking deque for tracing live objects. | 129 // Marking deque for tracing live objects. |
139 class MarkingDeque { | 130 class MarkingDeque { |
140 public: | 131 public: |
141 explicit MarkingDeque(Heap* heap) | 132 explicit MarkingDeque(Heap* heap) |
142 : backing_store_(nullptr), | 133 : backing_store_(nullptr), |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 | 849 |
859 private: | 850 private: |
860 MarkCompactCollector* collector_; | 851 MarkCompactCollector* collector_; |
861 }; | 852 }; |
862 | 853 |
863 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); | 854 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); |
864 } // namespace internal | 855 } // namespace internal |
865 } // namespace v8 | 856 } // namespace v8 |
866 | 857 |
867 #endif // V8_HEAP_MARK_COMPACT_H_ | 858 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |