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 void MarkCompactCollector::PushBlack(HeapObject* obj) { | 15 void MarkCompactCollector::PushBlack(HeapObject* obj) { |
16 DCHECK((ObjectMarking::IsBlack<MarkBit::NON_ATOMIC>(obj))); | 16 DCHECK((ObjectMarking::IsBlack<MarkBit::NON_ATOMIC>( |
| 17 obj, MarkingState::Internal(obj)))); |
17 if (!marking_deque()->Push(obj)) { | 18 if (!marking_deque()->Push(obj)) { |
18 ObjectMarking::BlackToGrey<MarkBit::NON_ATOMIC>(obj); | 19 ObjectMarking::BlackToGrey<MarkBit::NON_ATOMIC>( |
| 20 obj, MarkingState::Internal(obj)); |
19 } | 21 } |
20 } | 22 } |
21 | 23 |
22 void MinorMarkCompactCollector::PushBlack(HeapObject* obj) { | 24 void MinorMarkCompactCollector::PushBlack(HeapObject* obj) { |
23 DCHECK( | 25 DCHECK((ObjectMarking::IsBlack<MarkBit::NON_ATOMIC>( |
24 (ObjectMarking::IsBlack<MarkBit::NON_ATOMIC>(obj, StateForObject(obj)))); | 26 obj, MarkingState::External(obj)))); |
25 if (!marking_deque()->Push(obj)) { | 27 if (!marking_deque()->Push(obj)) { |
26 ObjectMarking::BlackToGrey<MarkBit::NON_ATOMIC>(obj, StateForObject(obj)); | 28 ObjectMarking::BlackToGrey<MarkBit::NON_ATOMIC>( |
| 29 obj, MarkingState::External(obj)); |
27 } | 30 } |
28 } | 31 } |
29 | 32 |
30 void MarkCompactCollector::UnshiftBlack(HeapObject* obj) { | 33 void MarkCompactCollector::UnshiftBlack(HeapObject* obj) { |
31 DCHECK(ObjectMarking::IsBlack(obj)); | 34 DCHECK(ObjectMarking::IsBlack(obj, MarkingState::Internal(obj))); |
32 if (!marking_deque()->Unshift(obj)) { | 35 if (!marking_deque()->Unshift(obj)) { |
33 ObjectMarking::BlackToGrey(obj); | 36 ObjectMarking::BlackToGrey(obj, MarkingState::Internal(obj)); |
34 } | 37 } |
35 } | 38 } |
36 | 39 |
37 void MarkCompactCollector::MarkObject(HeapObject* obj) { | 40 void MarkCompactCollector::MarkObject(HeapObject* obj) { |
38 if (ObjectMarking::IsWhite<MarkBit::NON_ATOMIC>(obj)) { | 41 if (ObjectMarking::IsWhite<MarkBit::NON_ATOMIC>( |
39 ObjectMarking::WhiteToBlack<MarkBit::NON_ATOMIC>(obj); | 42 obj, MarkingState::Internal(obj))) { |
| 43 ObjectMarking::WhiteToBlack<MarkBit::NON_ATOMIC>( |
| 44 obj, MarkingState::Internal(obj)); |
40 PushBlack(obj); | 45 PushBlack(obj); |
41 } | 46 } |
42 } | 47 } |
43 | 48 |
44 void MinorMarkCompactCollector::MarkObject(HeapObject* obj) { | 49 void MinorMarkCompactCollector::MarkObject(HeapObject* obj) { |
45 if (ObjectMarking::IsWhite<MarkBit::NON_ATOMIC>(obj, StateForObject(obj))) { | 50 if (ObjectMarking::IsWhite<MarkBit::NON_ATOMIC>( |
46 ObjectMarking::WhiteToBlack<MarkBit::NON_ATOMIC>(obj, StateForObject(obj)); | 51 obj, MarkingState::External(obj))) { |
| 52 ObjectMarking::WhiteToBlack<MarkBit::NON_ATOMIC>( |
| 53 obj, MarkingState::External(obj)); |
47 PushBlack(obj); | 54 PushBlack(obj); |
48 } | 55 } |
49 } | 56 } |
50 | 57 |
51 void MarkCompactCollector::RecordSlot(HeapObject* object, Object** slot, | 58 void MarkCompactCollector::RecordSlot(HeapObject* object, Object** slot, |
52 Object* target) { | 59 Object* target) { |
53 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); | 60 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); |
54 Page* source_page = Page::FromAddress(reinterpret_cast<Address>(object)); | 61 Page* source_page = Page::FromAddress(reinterpret_cast<Address>(object)); |
55 if (target_page->IsEvacuationCandidate() && | 62 if (target_page->IsEvacuationCandidate() && |
56 !ShouldSkipEvacuationSlotRecording(object)) { | 63 !ShouldSkipEvacuationSlotRecording(object)) { |
57 DCHECK(ObjectMarking::IsBlackOrGrey(object)); | 64 DCHECK( |
| 65 ObjectMarking::IsBlackOrGrey(object, MarkingState::Internal(object))); |
58 RememberedSet<OLD_TO_OLD>::Insert(source_page, | 66 RememberedSet<OLD_TO_OLD>::Insert(source_page, |
59 reinterpret_cast<Address>(slot)); | 67 reinterpret_cast<Address>(slot)); |
60 } | 68 } |
61 } | 69 } |
62 | 70 |
63 | 71 |
64 void CodeFlusher::AddCandidate(SharedFunctionInfo* shared_info) { | 72 void CodeFlusher::AddCandidate(SharedFunctionInfo* shared_info) { |
65 if (GetNextCandidate(shared_info) == nullptr) { | 73 if (GetNextCandidate(shared_info) == nullptr) { |
66 SetNextCandidate(shared_info, shared_function_info_candidates_head_); | 74 SetNextCandidate(shared_info, shared_function_info_candidates_head_); |
67 shared_function_info_candidates_head_ = shared_info; | 75 shared_function_info_candidates_head_ = shared_info; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 } | 230 } |
223 if (object != nullptr) return object; | 231 if (object != nullptr) return object; |
224 } | 232 } |
225 return nullptr; | 233 return nullptr; |
226 } | 234 } |
227 | 235 |
228 } // namespace internal | 236 } // namespace internal |
229 } // namespace v8 | 237 } // namespace v8 |
230 | 238 |
231 #endif // V8_HEAP_MARK_COMPACT_INL_H_ | 239 #endif // V8_HEAP_MARK_COMPACT_INL_H_ |
OLD | NEW |