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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 | 30 |
31 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { | 31 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { |
32 DCHECK(ObjectMarking::MarkBitFrom(obj) == mark_bit); | 32 DCHECK(ObjectMarking::MarkBitFrom(obj) == mark_bit); |
33 if (ObjectMarking::IsWhite(obj)) { | 33 if (ObjectMarking::IsWhite(obj)) { |
34 ObjectMarking::WhiteToBlack(obj); | 34 ObjectMarking::WhiteToBlack(obj); |
35 PushBlack(obj); | 35 PushBlack(obj); |
36 } | 36 } |
37 } | 37 } |
38 | 38 |
39 void MarkCompactCollector::SetMark(HeapObject* obj) { | |
40 DCHECK(ObjectMarking::IsWhite(obj)); | |
41 ObjectMarking::WhiteToBlack(obj); | |
42 } | |
43 | |
44 | |
45 bool MarkCompactCollector::IsMarked(Object* obj) { | |
46 DCHECK(obj->IsHeapObject()); | |
47 return ObjectMarking::IsBlackOrGrey(HeapObject::cast(obj)); | |
48 } | |
49 | |
50 | |
51 void MarkCompactCollector::RecordSlot(HeapObject* object, Object** slot, | 39 void MarkCompactCollector::RecordSlot(HeapObject* object, Object** slot, |
52 Object* target) { | 40 Object* target) { |
53 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); | 41 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); |
54 Page* source_page = Page::FromAddress(reinterpret_cast<Address>(object)); | 42 Page* source_page = Page::FromAddress(reinterpret_cast<Address>(object)); |
55 if (target_page->IsEvacuationCandidate() && | 43 if (target_page->IsEvacuationCandidate() && |
56 !ShouldSkipEvacuationSlotRecording(object)) { | 44 !ShouldSkipEvacuationSlotRecording(object)) { |
57 DCHECK(IsMarked(object)); | 45 DCHECK(ObjectMarking::IsBlackOrGrey(object)); |
58 RememberedSet<OLD_TO_OLD>::Insert(source_page, | 46 RememberedSet<OLD_TO_OLD>::Insert(source_page, |
59 reinterpret_cast<Address>(slot)); | 47 reinterpret_cast<Address>(slot)); |
60 } | 48 } |
61 } | 49 } |
62 | 50 |
63 | 51 |
64 void CodeFlusher::AddCandidate(SharedFunctionInfo* shared_info) { | 52 void CodeFlusher::AddCandidate(SharedFunctionInfo* shared_info) { |
65 if (GetNextCandidate(shared_info) == nullptr) { | 53 if (GetNextCandidate(shared_info) == nullptr) { |
66 SetNextCandidate(shared_info, shared_function_info_candidates_head_); | 54 SetNextCandidate(shared_info, shared_function_info_candidates_head_); |
67 shared_function_info_candidates_head_ = shared_info; | 55 shared_function_info_candidates_head_ = shared_info; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } | 198 } |
211 if (object != nullptr) return object; | 199 if (object != nullptr) return object; |
212 } | 200 } |
213 return nullptr; | 201 return nullptr; |
214 } | 202 } |
215 | 203 |
216 } // namespace internal | 204 } // namespace internal |
217 } // namespace v8 | 205 } // namespace v8 |
218 | 206 |
219 #endif // V8_HEAP_MARK_COMPACT_INL_H_ | 207 #endif // V8_HEAP_MARK_COMPACT_INL_H_ |
OLD | NEW |