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 #include "src/heap/remembered-set.h" | 5 #include "src/heap/remembered-set.h" |
6 #include "src/heap/heap-inl.h" | 6 #include "src/heap/heap-inl.h" |
7 #include "src/heap/heap.h" | 7 #include "src/heap/heap.h" |
8 #include "src/heap/mark-compact.h" | 8 #include "src/heap/mark-compact.h" |
9 #include "src/heap/slot-set.h" | 9 #include "src/heap/slot-set.h" |
10 #include "src/heap/spaces.h" | 10 #include "src/heap/spaces.h" |
11 #include "src/heap/store-buffer.h" | 11 #include "src/heap/store-buffer.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 template <PointerDirection direction> | 16 template <PointerDirection direction> |
17 void RememberedSet<direction>::ClearInvalidSlots(Heap* heap) { | 17 void RememberedSet<direction>::ClearInvalidSlots(Heap* heap) { |
18 STATIC_ASSERT(direction == OLD_TO_NEW); | 18 STATIC_ASSERT(direction == OLD_TO_NEW); |
19 PageIterator it(heap->old_space()); | 19 for (MemoryChunk* chunk : *heap->old_space()) { |
20 MemoryChunk* chunk; | |
21 while (it.has_next()) { | |
22 chunk = it.next(); | |
23 SlotSet* slots = GetSlotSet(chunk); | 20 SlotSet* slots = GetSlotSet(chunk); |
24 if (slots != nullptr) { | 21 if (slots != nullptr) { |
25 slots->Iterate([heap, chunk](Address addr) { | 22 slots->Iterate([heap, chunk](Address addr) { |
26 Object** slot = reinterpret_cast<Object**>(addr); | 23 Object** slot = reinterpret_cast<Object**>(addr); |
27 return IsValidSlot(heap, chunk, slot) ? KEEP_SLOT : REMOVE_SLOT; | 24 return IsValidSlot(heap, chunk, slot) ? KEEP_SLOT : REMOVE_SLOT; |
28 }); | 25 }); |
29 } | 26 } |
30 } | 27 } |
31 } | 28 } |
32 | 29 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 heap->mark_compact_collector()->IsSlotInBlackObject( | 65 heap->mark_compact_collector()->IsSlotInBlackObject( |
69 chunk, reinterpret_cast<Address>(slot)); | 66 chunk, reinterpret_cast<Address>(slot)); |
70 } | 67 } |
71 | 68 |
72 template void RememberedSet<OLD_TO_NEW>::ClearInvalidSlots(Heap* heap); | 69 template void RememberedSet<OLD_TO_NEW>::ClearInvalidSlots(Heap* heap); |
73 template void RememberedSet<OLD_TO_NEW>::VerifyValidSlots(Heap* heap); | 70 template void RememberedSet<OLD_TO_NEW>::VerifyValidSlots(Heap* heap); |
74 template void RememberedSet<OLD_TO_OLD>::VerifyValidSlots(Heap* heap); | 71 template void RememberedSet<OLD_TO_OLD>::VerifyValidSlots(Heap* heap); |
75 | 72 |
76 } // namespace internal | 73 } // namespace internal |
77 } // namespace v8 | 74 } // namespace v8 |
OLD | NEW |