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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 V8_INLINE static bool IsBlackOrGrey(HeapObject* obj) { | 71 V8_INLINE static bool IsBlackOrGrey(HeapObject* obj) { |
72 return Marking::IsBlackOrGrey(MarkBitFrom<mode>(obj)); | 72 return Marking::IsBlackOrGrey(MarkBitFrom<mode>(obj)); |
73 } | 73 } |
74 | 74 |
75 template <MarkingMode mode = MarkingMode::FULL> | 75 template <MarkingMode mode = MarkingMode::FULL> |
76 V8_INLINE static void ClearMarkBit(HeapObject* obj) { | 76 V8_INLINE static void ClearMarkBit(HeapObject* obj) { |
77 Marking::MarkWhite(MarkBitFrom<mode>(obj)); | 77 Marking::MarkWhite(MarkBitFrom<mode>(obj)); |
78 } | 78 } |
79 | 79 |
80 template <MarkingMode mode = MarkingMode::FULL> | 80 template <MarkingMode mode = MarkingMode::FULL> |
81 V8_INLINE static void BlackToWhite(HeapObject* obj) { | |
82 DCHECK(IsBlack<mode>(obj)); | |
83 MarkBit markbit = MarkBitFrom<mode>(obj); | |
84 Marking::BlackToWhite(markbit); | |
85 MemoryChunk::IncrementLiveBytes<mode>(obj, -obj->Size()); | |
86 } | |
87 | |
88 template <MarkingMode mode = MarkingMode::FULL> | |
89 V8_INLINE static void GreyToWhite(HeapObject* obj) { | |
90 DCHECK(IsGrey<mode>(obj)); | |
91 Marking::GreyToWhite(MarkBitFrom<mode>(obj)); | |
92 } | |
93 | |
94 template <MarkingMode mode = MarkingMode::FULL> | |
95 V8_INLINE static void BlackToGrey(HeapObject* obj) { | 81 V8_INLINE static void BlackToGrey(HeapObject* obj) { |
96 DCHECK(IsBlack<mode>(obj)); | 82 DCHECK(IsBlack<mode>(obj)); |
97 MarkBit markbit = MarkBitFrom<mode>(obj); | 83 MarkBit markbit = MarkBitFrom<mode>(obj); |
98 Marking::BlackToGrey(markbit); | 84 Marking::BlackToGrey(markbit); |
99 MemoryChunk::IncrementLiveBytes<mode>(obj, -obj->Size()); | 85 MemoryChunk::IncrementLiveBytes<mode>(obj, -obj->Size()); |
100 } | 86 } |
101 | 87 |
102 template <MarkingMode mode = MarkingMode::FULL> | 88 template <MarkingMode mode = MarkingMode::FULL> |
103 V8_INLINE static void WhiteToGrey(HeapObject* obj) { | 89 V8_INLINE static void WhiteToGrey(HeapObject* obj) { |
104 DCHECK(IsWhite<mode>(obj)); | 90 DCHECK(IsWhite<mode>(obj)); |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 | 835 |
850 private: | 836 private: |
851 MarkCompactCollector* collector_; | 837 MarkCompactCollector* collector_; |
852 }; | 838 }; |
853 | 839 |
854 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); | 840 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); |
855 } // namespace internal | 841 } // namespace internal |
856 } // namespace v8 | 842 } // namespace v8 |
857 | 843 |
858 #endif // V8_HEAP_MARK_COMPACT_H_ | 844 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |