Chromium Code Reviews| 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 #include "src/macro-assembler.h" | |
| 12 | 13 |
| 13 namespace v8 { | 14 namespace v8 { |
| 14 namespace internal { | 15 namespace internal { |
| 15 | 16 |
| 16 template <PointerDirection direction> | 17 template <PointerDirection direction> |
| 17 void RememberedSet<direction>::ClearInvalidSlots(Heap* heap) { | 18 void RememberedSet<direction>::ClearInvalidSlots(Heap* heap) { |
| 18 STATIC_ASSERT(direction == OLD_TO_NEW); | 19 STATIC_ASSERT(direction == OLD_TO_NEW); |
| 19 for (MemoryChunk* chunk : *heap->old_space()) { | 20 { |
| 20 SlotSet* slots = GetSlotSet(chunk); | 21 for (MemoryChunk* chunk : *heap->old_space()) { |
| 21 if (slots != nullptr) { | 22 { |
|
Michael Lippautz
2016/06/23 11:51:12
nit: I too like building pyramids but there's no n
ahaas
2016/06/23 12:42:21
done.
| |
| 22 slots->Iterate([heap, chunk](Address addr) { | 23 SlotSet* slots = GetSlotSet(chunk); |
| 23 Object** slot = reinterpret_cast<Object**>(addr); | 24 if (slots != nullptr) { |
| 24 return IsValidSlot(heap, chunk, slot) ? KEEP_SLOT : REMOVE_SLOT; | 25 slots->Iterate([heap, chunk](Address addr) { |
| 25 }); | 26 Object** slot = reinterpret_cast<Object**>(addr); |
| 27 return IsValidSlot(heap, chunk, slot) ? KEEP_SLOT : REMOVE_SLOT; | |
| 28 }); | |
| 29 } | |
| 30 } | |
| 31 } | |
| 32 } | |
|
Michael Lippautz
2016/06/23 11:51:12
nit: You can also get rid of the outer scopes, so
ahaas
2016/06/23 12:42:21
done.
| |
| 33 { | |
| 34 for (MemoryChunk* chunk : *heap->code_space()) { | |
| 35 TypedSlotSet* slots = GetTypedSlotSet(chunk); | |
| 36 if (slots != nullptr) { | |
| 37 slots->Iterate( | |
| 38 [heap, chunk](SlotType type, Address host_addr, Address addr) { | |
| 39 if (Marking::IsBlack(Marking::MarkBitFrom(host_addr))) { | |
| 40 return KEEP_SLOT; | |
| 41 } else { | |
| 42 return REMOVE_SLOT; | |
| 43 } | |
| 44 }); | |
| 45 } | |
| 26 } | 46 } |
| 27 } | 47 } |
| 28 } | 48 } |
| 29 | 49 |
| 30 template <PointerDirection direction> | 50 template <PointerDirection direction> |
| 31 void RememberedSet<direction>::VerifyValidSlots(Heap* heap) { | 51 void RememberedSet<direction>::VerifyValidSlots(Heap* heap) { |
| 32 Iterate(heap, [heap](Address addr) { | 52 Iterate(heap, [heap](Address addr) { |
| 33 HeapObject* obj = | 53 HeapObject* obj = |
| 34 heap->mark_compact_collector()->FindBlackObjectBySlotSlow(addr); | 54 heap->mark_compact_collector()->FindBlackObjectBySlotSlow(addr); |
| 35 if (obj == nullptr) { | 55 if (obj == nullptr) { |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 65 heap->mark_compact_collector()->IsSlotInBlackObject( | 85 heap->mark_compact_collector()->IsSlotInBlackObject( |
| 66 chunk, reinterpret_cast<Address>(slot)); | 86 chunk, reinterpret_cast<Address>(slot)); |
| 67 } | 87 } |
| 68 | 88 |
| 69 template void RememberedSet<OLD_TO_NEW>::ClearInvalidSlots(Heap* heap); | 89 template void RememberedSet<OLD_TO_NEW>::ClearInvalidSlots(Heap* heap); |
| 70 template void RememberedSet<OLD_TO_NEW>::VerifyValidSlots(Heap* heap); | 90 template void RememberedSet<OLD_TO_NEW>::VerifyValidSlots(Heap* heap); |
| 71 template void RememberedSet<OLD_TO_OLD>::VerifyValidSlots(Heap* heap); | 91 template void RememberedSet<OLD_TO_OLD>::VerifyValidSlots(Heap* heap); |
| 72 | 92 |
| 73 } // namespace internal | 93 } // namespace internal |
| 74 } // namespace v8 | 94 } // namespace v8 |
| OLD | NEW |