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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 | 150 |
151 static ObjectColor Color(MarkBit mark_bit) { | 151 static ObjectColor Color(MarkBit mark_bit) { |
152 if (IsBlack(mark_bit)) return BLACK_OBJECT; | 152 if (IsBlack(mark_bit)) return BLACK_OBJECT; |
153 if (IsWhite(mark_bit)) return WHITE_OBJECT; | 153 if (IsWhite(mark_bit)) return WHITE_OBJECT; |
154 if (IsGrey(mark_bit)) return GREY_OBJECT; | 154 if (IsGrey(mark_bit)) return GREY_OBJECT; |
155 UNREACHABLE(); | 155 UNREACHABLE(); |
156 return IMPOSSIBLE_COLOR; | 156 return IMPOSSIBLE_COLOR; |
157 } | 157 } |
158 #endif | 158 #endif |
159 | 159 |
160 // Returns true if the transferred color is black. | 160 // Returns true if the transferred color is black. |
Hannes Payer (out of office)
2016/05/20 07:34:41
Mention that this function clears the color of the
Marcel Hlopko
2016/05/20 14:31:41
Done.
| |
161 INLINE(static bool TransferColor(HeapObject* from, HeapObject* to)) { | 161 INLINE(static bool TransferColor(HeapObject* from, HeapObject* to)) { |
162 if (Page::FromAddress(to->address())->IsFlagSet(Page::BLACK_PAGE)) | 162 MarkBit from_mark_bit = MarkBitFrom(from); |
163 if (Page::FromAddress(to->address())->IsFlagSet(Page::BLACK_PAGE)) { | |
164 if (!Marking::IsWhite(from_mark_bit)) { | |
165 Marking::MarkWhite(from_mark_bit); | |
166 } | |
163 return true; | 167 return true; |
164 MarkBit from_mark_bit = MarkBitFrom(from); | 168 } |
165 MarkBit to_mark_bit = MarkBitFrom(to); | 169 MarkBit to_mark_bit = MarkBitFrom(to); |
166 DCHECK(Marking::IsWhite(to_mark_bit)); | 170 DCHECK(Marking::IsWhite(to_mark_bit)); |
167 if (from_mark_bit.Get()) { | 171 if (from_mark_bit.Get()) { |
168 to_mark_bit.Set(); | 172 to_mark_bit.Set(); |
173 from_mark_bit.Clear(); | |
169 if (from_mark_bit.Next().Get()) { | 174 if (from_mark_bit.Next().Get()) { |
170 to_mark_bit.Next().Set(); | 175 to_mark_bit.Next().Set(); |
176 from_mark_bit.Next().Clear(); | |
171 return true; | 177 return true; |
172 } | 178 } |
173 } | 179 } |
174 return false; | 180 return false; |
175 } | 181 } |
176 | 182 |
177 private: | 183 private: |
178 DISALLOW_IMPLICIT_CONSTRUCTORS(Marking); | 184 DISALLOW_IMPLICIT_CONSTRUCTORS(Marking); |
179 }; | 185 }; |
180 | 186 |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
889 private: | 895 private: |
890 MarkCompactCollector* collector_; | 896 MarkCompactCollector* collector_; |
891 }; | 897 }; |
892 | 898 |
893 | 899 |
894 const char* AllocationSpaceName(AllocationSpace space); | 900 const char* AllocationSpaceName(AllocationSpace space); |
895 } // namespace internal | 901 } // namespace internal |
896 } // namespace v8 | 902 } // namespace v8 |
897 | 903 |
898 #endif // V8_HEAP_MARK_COMPACT_H_ | 904 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |