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" |
(...skipping 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 | 32 |
33 void MarkCompactCollector::UnshiftBlack(HeapObject* obj) { | 33 void MarkCompactCollector::UnshiftBlack(HeapObject* obj) { |
34 DCHECK(ObjectMarking::IsBlack(obj, MarkingState::Internal(obj))); | 34 DCHECK(ObjectMarking::IsBlack(obj, MarkingState::Internal(obj))); |
35 if (!marking_deque()->Unshift(obj)) { | 35 if (!marking_deque()->Unshift(obj)) { |
36 ObjectMarking::BlackToGrey(obj, MarkingState::Internal(obj)); | 36 ObjectMarking::BlackToGrey(obj, MarkingState::Internal(obj)); |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 void MarkCompactCollector::MarkObject(HeapObject* obj) { | 40 void MarkCompactCollector::MarkObject(HeapObject* obj) { |
41 if (ObjectMarking::IsWhite<MarkBit::NON_ATOMIC>( | 41 if (ObjectMarking::WhiteToBlack<MarkBit::NON_ATOMIC>( |
42 obj, MarkingState::Internal(obj))) { | 42 obj, MarkingState::Internal(obj))) { |
43 ObjectMarking::WhiteToBlack<MarkBit::NON_ATOMIC>( | |
44 obj, MarkingState::Internal(obj)); | |
45 PushBlack(obj); | 43 PushBlack(obj); |
46 } | 44 } |
47 } | 45 } |
48 | 46 |
49 void MinorMarkCompactCollector::MarkObject(HeapObject* obj) { | 47 void MinorMarkCompactCollector::MarkObject(HeapObject* obj) { |
50 if (ObjectMarking::IsWhite<MarkBit::NON_ATOMIC>( | 48 if (ObjectMarking::WhiteToBlack<MarkBit::NON_ATOMIC>( |
51 obj, MarkingState::External(obj))) { | 49 obj, MarkingState::External(obj))) { |
52 ObjectMarking::WhiteToBlack<MarkBit::NON_ATOMIC>( | |
53 obj, MarkingState::External(obj)); | |
54 PushBlack(obj); | 50 PushBlack(obj); |
55 } | 51 } |
56 } | 52 } |
57 | 53 |
58 void MarkCompactCollector::RecordSlot(HeapObject* object, Object** slot, | 54 void MarkCompactCollector::RecordSlot(HeapObject* object, Object** slot, |
59 Object* target) { | 55 Object* target) { |
60 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); | 56 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); |
61 Page* source_page = Page::FromAddress(reinterpret_cast<Address>(object)); | 57 Page* source_page = Page::FromAddress(reinterpret_cast<Address>(object)); |
62 if (target_page->IsEvacuationCandidate() && | 58 if (target_page->IsEvacuationCandidate() && |
63 !ShouldSkipEvacuationSlotRecording(object)) { | 59 !ShouldSkipEvacuationSlotRecording(object)) { |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 } | 245 } |
250 if (object != nullptr) return object; | 246 if (object != nullptr) return object; |
251 } | 247 } |
252 return nullptr; | 248 return nullptr; |
253 } | 249 } |
254 | 250 |
255 } // namespace internal | 251 } // namespace internal |
256 } // namespace v8 | 252 } // namespace v8 |
257 | 253 |
258 #endif // V8_HEAP_MARK_COMPACT_INL_H_ | 254 #endif // V8_HEAP_MARK_COMPACT_INL_H_ |
OLD | NEW |