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_INL_H_ | 5 #ifndef V8_HEAP_MARK_COMPACT_INL_H_ |
6 #define V8_HEAP_MARK_COMPACT_INL_H_ | 6 #define V8_HEAP_MARK_COMPACT_INL_H_ |
7 | 7 |
8 #include "src/heap/mark-compact.h" | 8 #include "src/heap/mark-compact.h" |
9 #include "src/heap/remembered-set.h" | 9 #include "src/heap/remembered-set.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 template <MarkingMode mode> | 15 template <MarkingMode mode> |
16 void MarkCompactCollector::PushBlack(HeapObject* obj) { | 16 void MarkCompactCollector::PushBlack(HeapObject* obj) { |
17 DCHECK(ObjectMarking::IsBlack<mode>(obj)); | 17 DCHECK((ObjectMarking::IsBlack<MarkBit::NON_ATOMIC, mode>(obj))); |
18 if (!marking_deque<mode>()->Push(obj)) { | 18 if (!marking_deque<mode>()->Push(obj)) { |
19 ObjectMarking::BlackToGrey<mode>(obj); | 19 ObjectMarking::BlackToGrey<MarkBit::NON_ATOMIC, mode>(obj); |
20 } | 20 } |
21 } | 21 } |
22 | 22 |
23 | 23 |
24 void MarkCompactCollector::UnshiftBlack(HeapObject* obj) { | 24 void MarkCompactCollector::UnshiftBlack(HeapObject* obj) { |
25 DCHECK(ObjectMarking::IsBlack(obj)); | 25 DCHECK(ObjectMarking::IsBlack(obj)); |
26 if (!marking_deque()->Unshift(obj)) { | 26 if (!marking_deque()->Unshift(obj)) { |
27 ObjectMarking::BlackToGrey(obj); | 27 ObjectMarking::BlackToGrey(obj); |
28 } | 28 } |
29 } | 29 } |
30 | 30 |
31 template <MarkingMode mode> | 31 template <MarkingMode mode> |
32 void MarkCompactCollector::MarkObject(HeapObject* obj) { | 32 void MarkCompactCollector::MarkObject(HeapObject* obj) { |
33 if (ObjectMarking::IsWhite<mode>(obj)) { | 33 if (ObjectMarking::IsWhite<MarkBit::NON_ATOMIC, mode>(obj)) { |
34 ObjectMarking::WhiteToBlack<mode>(obj); | 34 ObjectMarking::WhiteToBlack<MarkBit::NON_ATOMIC, mode>(obj); |
35 PushBlack<mode>(obj); | 35 PushBlack<mode>(obj); |
36 } | 36 } |
37 } | 37 } |
38 | 38 |
39 void MarkCompactCollector::RecordSlot(HeapObject* object, Object** slot, | 39 void MarkCompactCollector::RecordSlot(HeapObject* object, Object** slot, |
40 Object* target) { | 40 Object* target) { |
41 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); | 41 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); |
42 Page* source_page = Page::FromAddress(reinterpret_cast<Address>(object)); | 42 Page* source_page = Page::FromAddress(reinterpret_cast<Address>(object)); |
43 if (target_page->IsEvacuationCandidate() && | 43 if (target_page->IsEvacuationCandidate() && |
44 !ShouldSkipEvacuationSlotRecording(object)) { | 44 !ShouldSkipEvacuationSlotRecording(object)) { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 } | 202 } |
203 if (object != nullptr) return object; | 203 if (object != nullptr) return object; |
204 } | 204 } |
205 return nullptr; | 205 return nullptr; |
206 } | 206 } |
207 | 207 |
208 } // namespace internal | 208 } // namespace internal |
209 } // namespace v8 | 209 } // namespace v8 |
210 | 210 |
211 #endif // V8_HEAP_MARK_COMPACT_INL_H_ | 211 #endif // V8_HEAP_MARK_COMPACT_INL_H_ |
OLD | NEW |