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