| 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/slots-buffer.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)); | |
| 74 if (target_page->IsEvacuationCandidate() && | 73 if (target_page->IsEvacuationCandidate() && |
| 75 !ShouldSkipEvacuationSlotRecording(object)) { | 74 !ShouldSkipEvacuationSlotRecording(object)) { |
| 76 RememberedSet<OLD_TO_OLD>::Insert(source_page, | 75 if (!SlotsBuffer::AddTo(slots_buffer_allocator_, |
| 77 reinterpret_cast<Address>(slot)); | 76 target_page->slots_buffer_address(), slot, |
| 77 SlotsBuffer::FAIL_ON_OVERFLOW)) { |
| 78 EvictPopularEvacuationCandidate(target_page); |
| 79 } |
| 78 } | 80 } |
| 79 } | 81 } |
| 80 | 82 |
| 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 |
| 81 | 95 |
| 82 void CodeFlusher::AddCandidate(SharedFunctionInfo* shared_info) { | 96 void CodeFlusher::AddCandidate(SharedFunctionInfo* shared_info) { |
| 83 if (GetNextCandidate(shared_info) == nullptr) { | 97 if (GetNextCandidate(shared_info) == nullptr) { |
| 84 SetNextCandidate(shared_info, shared_function_info_candidates_head_); | 98 SetNextCandidate(shared_info, shared_function_info_candidates_head_); |
| 85 shared_function_info_candidates_head_ = shared_info; | 99 shared_function_info_candidates_head_ = shared_info; |
| 86 } | 100 } |
| 87 } | 101 } |
| 88 | 102 |
| 89 | 103 |
| 90 void CodeFlusher::AddCandidate(JSFunction* function) { | 104 void CodeFlusher::AddCandidate(JSFunction* function) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 197 } |
| 184 if (object != nullptr) return object; | 198 if (object != nullptr) return object; |
| 185 } | 199 } |
| 186 return nullptr; | 200 return nullptr; |
| 187 } | 201 } |
| 188 | 202 |
| 189 } // namespace internal | 203 } // namespace internal |
| 190 } // namespace v8 | 204 } // namespace v8 |
| 191 | 205 |
| 192 #endif // V8_HEAP_MARK_COMPACT_INL_H_ | 206 #endif // V8_HEAP_MARK_COMPACT_INL_H_ |
| OLD | NEW |