OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_REMEMBERED_SET_H | 5 #ifndef V8_REMEMBERED_SET_H |
6 #define V8_REMEMBERED_SET_H | 6 #define V8_REMEMBERED_SET_H |
7 | 7 |
8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/heap/heap.h" | 9 #include "src/heap/heap.h" |
10 #include "src/heap/slot-set.h" | 10 #include "src/heap/slot-set.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 uintptr_t offset = slot_addr - page->address(); | 113 uintptr_t offset = slot_addr - page->address(); |
114 uintptr_t host_offset = host_addr - page->address(); | 114 uintptr_t host_offset = host_addr - page->address(); |
115 DCHECK_LT(offset, static_cast<uintptr_t>(TypedSlotSet::kMaxOffset)); | 115 DCHECK_LT(offset, static_cast<uintptr_t>(TypedSlotSet::kMaxOffset)); |
116 DCHECK_LT(host_offset, static_cast<uintptr_t>(TypedSlotSet::kMaxOffset)); | 116 DCHECK_LT(host_offset, static_cast<uintptr_t>(TypedSlotSet::kMaxOffset)); |
117 slot_set->Insert(slot_type, static_cast<uint32_t>(host_offset), | 117 slot_set->Insert(slot_type, static_cast<uint32_t>(host_offset), |
118 static_cast<uint32_t>(offset)); | 118 static_cast<uint32_t>(offset)); |
119 } | 119 } |
120 | 120 |
121 // Given a page and a range of typed slots in that page, this function removes | 121 // Given a page and a range of typed slots in that page, this function removes |
122 // the slots from the remembered set. | 122 // the slots from the remembered set. |
123 static void RemoveRangeTyped(Page* page, Address start, Address end) { | 123 static void RemoveRangeTyped(MemoryChunk* page, Address start, Address end) { |
124 TypedSlotSet* slots = GetTypedSlotSet(page); | 124 TypedSlotSet* slots = GetTypedSlotSet(page); |
125 if (slots != nullptr) { | 125 if (slots != nullptr) { |
126 slots->Iterate([start, end](SlotType slot_type, Address host_addr, | 126 slots->Iterate([start, end](SlotType slot_type, Address host_addr, |
127 Address slot_addr) { | 127 Address slot_addr) { |
128 return start <= slot_addr && slot_addr < end ? REMOVE_SLOT : KEEP_SLOT; | 128 return start <= slot_addr && slot_addr < end ? REMOVE_SLOT : KEEP_SLOT; |
129 }); | 129 }); |
130 } | 130 } |
131 } | 131 } |
132 | 132 |
133 // Iterates and filters the remembered set with the given callback. | 133 // Iterates and filters the remembered set with the given callback. |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 return callback(reinterpret_cast<Object**>(addr)); | 338 return callback(reinterpret_cast<Object**>(addr)); |
339 } | 339 } |
340 case NUMBER_OF_SLOT_TYPES: | 340 case NUMBER_OF_SLOT_TYPES: |
341 break; | 341 break; |
342 } | 342 } |
343 UNREACHABLE(); | 343 UNREACHABLE(); |
344 return REMOVE_SLOT; | 344 return REMOVE_SLOT; |
345 } | 345 } |
346 }; | 346 }; |
347 | 347 |
| 348 inline SlotType SlotTypeForRelocInfoMode(RelocInfo::Mode rmode) { |
| 349 if (RelocInfo::IsCodeTarget(rmode)) { |
| 350 return CODE_TARGET_SLOT; |
| 351 } else if (RelocInfo::IsCell(rmode)) { |
| 352 return CELL_TARGET_SLOT; |
| 353 } else if (RelocInfo::IsEmbeddedObject(rmode)) { |
| 354 return EMBEDDED_OBJECT_SLOT; |
| 355 } else if (RelocInfo::IsDebugBreakSlot(rmode)) { |
| 356 return DEBUG_TARGET_SLOT; |
| 357 } |
| 358 UNREACHABLE(); |
| 359 return NUMBER_OF_SLOT_TYPES; |
| 360 } |
| 361 |
348 } // namespace internal | 362 } // namespace internal |
349 } // namespace v8 | 363 } // namespace v8 |
350 | 364 |
351 #endif // V8_REMEMBERED_SET_H | 365 #endif // V8_REMEMBERED_SET_H |
OLD | NEW |