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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 } | 59 } |
60 | 60 |
61 V8_INLINE static bool IsGrey(HeapObject* obj) { | 61 V8_INLINE static bool IsGrey(HeapObject* obj) { |
62 return Marking::IsGrey(MarkBitFrom(obj)); | 62 return Marking::IsGrey(MarkBitFrom(obj)); |
63 } | 63 } |
64 | 64 |
65 V8_INLINE static bool IsBlackOrGrey(HeapObject* obj) { | 65 V8_INLINE static bool IsBlackOrGrey(HeapObject* obj) { |
66 return Marking::IsBlackOrGrey(MarkBitFrom(obj)); | 66 return Marking::IsBlackOrGrey(MarkBitFrom(obj)); |
67 } | 67 } |
68 | 68 |
69 V8_INLINE static void ClearMarkBit(HeapObject* obj) { | 69 V8_INLINE static void ClearMarkBit(HeapObject* obj) { |
ulan
2017/02/28 15:43:47
If object is black at the callsites, can we just u
Hannes Payer (out of office)
2017/03/01 13:49:18
No we cannot, since the object can also be grey (w
| |
70 Marking::MarkWhite(MarkBitFrom(obj)); | 70 DCHECK(IsBlack(obj)); |
71 Marking::BlackToWhite(MarkBitFrom(obj)); | |
71 } | 72 } |
72 | 73 |
73 V8_INLINE static void BlackToWhite(HeapObject* obj) { | 74 V8_INLINE static void BlackToWhite(HeapObject* obj) { |
74 DCHECK(IsBlack(obj)); | 75 DCHECK(IsBlack(obj)); |
75 MarkBit markbit = MarkBitFrom(obj); | 76 MarkBit markbit = MarkBitFrom(obj); |
76 Marking::BlackToWhite(markbit); | 77 Marking::BlackToWhite(markbit); |
77 MemoryChunk::IncrementLiveBytes(obj, -obj->Size()); | 78 MemoryChunk::IncrementLiveBytes(obj, -obj->Size()); |
78 } | 79 } |
79 | 80 |
80 V8_INLINE static void GreyToWhite(HeapObject* obj) { | 81 V8_INLINE static void GreyToWhite(HeapObject* obj) { |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
843 | 844 |
844 private: | 845 private: |
845 MarkCompactCollector* collector_; | 846 MarkCompactCollector* collector_; |
846 }; | 847 }; |
847 | 848 |
848 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); | 849 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); |
849 } // namespace internal | 850 } // namespace internal |
850 } // namespace v8 | 851 } // namespace v8 |
851 | 852 |
852 #endif // V8_HEAP_MARK_COMPACT_H_ | 853 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |