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/slots-buffer.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 inline std::vector<Page*>& MarkCompactCollector::sweeping_list(Space* space) { | 15 inline std::vector<Page*>& MarkCompactCollector::sweeping_list(Space* space) { |
16 if (space == heap()->old_space()) { | 16 if (space == heap()->old_space()) { |
17 return sweeping_list_old_space_; | 17 return sweeping_list_old_space_; |
18 } else if (space == heap()->code_space()) { | 18 } else if (space == heap()->code_space()) { |
19 return sweeping_list_code_space_; | 19 return sweeping_list_code_space_; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 bool MarkCompactCollector::IsMarked(Object* obj) { | 63 bool MarkCompactCollector::IsMarked(Object* obj) { |
64 DCHECK(obj->IsHeapObject()); | 64 DCHECK(obj->IsHeapObject()); |
65 HeapObject* heap_object = HeapObject::cast(obj); | 65 HeapObject* heap_object = HeapObject::cast(obj); |
66 return Marking::IsBlackOrGrey(Marking::MarkBitFrom(heap_object)); | 66 return Marking::IsBlackOrGrey(Marking::MarkBitFrom(heap_object)); |
67 } | 67 } |
68 | 68 |
69 | 69 |
70 void MarkCompactCollector::RecordSlot(HeapObject* object, Object** slot, | 70 void MarkCompactCollector::RecordSlot(HeapObject* object, Object** slot, |
71 Object* target) { | 71 Object* target) { |
72 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); | 72 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); |
| 73 Page* source_page = Page::FromAddress(reinterpret_cast<Address>(object)); |
73 if (target_page->IsEvacuationCandidate() && | 74 if (target_page->IsEvacuationCandidate() && |
74 !ShouldSkipEvacuationSlotRecording(object)) { | 75 !ShouldSkipEvacuationSlotRecording(object)) { |
75 if (!SlotsBuffer::AddTo(slots_buffer_allocator_, | 76 DCHECK(Marking::IsBlackOrGrey(Marking::MarkBitFrom(object))); |
76 target_page->slots_buffer_address(), slot, | 77 RememberedSet<OLD_TO_OLD>::Insert(source_page, |
77 SlotsBuffer::FAIL_ON_OVERFLOW)) { | 78 reinterpret_cast<Address>(slot)); |
78 EvictPopularEvacuationCandidate(target_page); | |
79 } | |
80 } | 79 } |
81 } | 80 } |
82 | 81 |
83 | |
84 void MarkCompactCollector::ForceRecordSlot(HeapObject* object, Object** slot, | |
85 Object* target) { | |
86 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); | |
87 if (target_page->IsEvacuationCandidate() && | |
88 !ShouldSkipEvacuationSlotRecording(object)) { | |
89 CHECK(SlotsBuffer::AddTo(slots_buffer_allocator_, | |
90 target_page->slots_buffer_address(), slot, | |
91 SlotsBuffer::IGNORE_OVERFLOW)); | |
92 } | |
93 } | |
94 | |
95 | 82 |
96 void CodeFlusher::AddCandidate(SharedFunctionInfo* shared_info) { | 83 void CodeFlusher::AddCandidate(SharedFunctionInfo* shared_info) { |
97 if (GetNextCandidate(shared_info) == nullptr) { | 84 if (GetNextCandidate(shared_info) == nullptr) { |
98 SetNextCandidate(shared_info, shared_function_info_candidates_head_); | 85 SetNextCandidate(shared_info, shared_function_info_candidates_head_); |
99 shared_function_info_candidates_head_ = shared_info; | 86 shared_function_info_candidates_head_ = shared_info; |
100 } | 87 } |
101 } | 88 } |
102 | 89 |
103 | 90 |
104 void CodeFlusher::AddCandidate(JSFunction* function) { | 91 void CodeFlusher::AddCandidate(JSFunction* function) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 } | 184 } |
198 if (object != nullptr) return object; | 185 if (object != nullptr) return object; |
199 } | 186 } |
200 return nullptr; | 187 return nullptr; |
201 } | 188 } |
202 | 189 |
203 } // namespace internal | 190 } // namespace internal |
204 } // namespace v8 | 191 } // namespace v8 |
205 | 192 |
206 #endif // V8_HEAP_MARK_COMPACT_INL_H_ | 193 #endif // V8_HEAP_MARK_COMPACT_INL_H_ |
OLD | NEW |