| 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" |  | 
| 13 | 12 | 
| 14 namespace v8 { | 13 namespace v8 { | 
| 15 namespace internal { | 14 namespace internal { | 
| 16 | 15 | 
| 17 template <PointerDirection direction> | 16 template <PointerDirection direction> | 
| 18 void RememberedSet<direction>::ClearInvalidSlots(Heap* heap) { | 17 void RememberedSet<direction>::ClearInvalidSlots(Heap* heap) { | 
| 19   STATIC_ASSERT(direction == OLD_TO_NEW); | 18   STATIC_ASSERT(direction == OLD_TO_NEW); | 
| 20   { | 19   PageIterator it(heap->old_space()); | 
| 21     PageIterator it(heap->old_space()); | 20   MemoryChunk* chunk; | 
| 22     MemoryChunk* chunk; | 21   while (it.has_next()) { | 
| 23     while (it.has_next()) { | 22     chunk = it.next(); | 
| 24       chunk = it.next(); | 23     SlotSet* slots = GetSlotSet(chunk); | 
| 25       { | 24     if (slots != nullptr) { | 
| 26         SlotSet* slots = GetSlotSet(chunk); | 25       slots->Iterate([heap, chunk](Address addr) { | 
| 27         if (slots != nullptr) { | 26         Object** slot = reinterpret_cast<Object**>(addr); | 
| 28           slots->Iterate([heap, chunk](Address addr) { | 27         return IsValidSlot(heap, chunk, slot) ? KEEP_SLOT : REMOVE_SLOT; | 
| 29             Object** slot = reinterpret_cast<Object**>(addr); | 28       }); | 
| 30             return IsValidSlot(heap, chunk, slot) ? KEEP_SLOT : REMOVE_SLOT; |  | 
| 31           }); |  | 
| 32         } |  | 
| 33       } |  | 
| 34     } |  | 
| 35   } |  | 
| 36   { |  | 
| 37     PageIterator it(heap->code_space()); |  | 
| 38     MemoryChunk* chunk; |  | 
| 39     while (it.has_next()) { |  | 
| 40       chunk = it.next(); |  | 
| 41       TypedSlotSet* slots = GetTypedSlotSet(chunk); |  | 
| 42       if (slots != nullptr) { |  | 
| 43         slots->Iterate( |  | 
| 44             [heap, chunk](SlotType type, Address host_addr, Address addr) { |  | 
| 45               if (Marking::IsBlack(Marking::MarkBitFrom(host_addr))) { |  | 
| 46                 return KEEP_SLOT; |  | 
| 47               } else { |  | 
| 48                 return REMOVE_SLOT; |  | 
| 49               } |  | 
| 50             }); |  | 
| 51       } |  | 
| 52     } | 29     } | 
| 53   } | 30   } | 
| 54 } | 31 } | 
| 55 | 32 | 
| 56 template <PointerDirection direction> | 33 template <PointerDirection direction> | 
| 57 void RememberedSet<direction>::VerifyValidSlots(Heap* heap) { | 34 void RememberedSet<direction>::VerifyValidSlots(Heap* heap) { | 
| 58   Iterate(heap, [heap](Address addr) { | 35   Iterate(heap, [heap](Address addr) { | 
| 59     HeapObject* obj = | 36     HeapObject* obj = | 
| 60         heap->mark_compact_collector()->FindBlackObjectBySlotSlow(addr); | 37         heap->mark_compact_collector()->FindBlackObjectBySlotSlow(addr); | 
| 61     if (obj == nullptr) { | 38     if (obj == nullptr) { | 
| (...skipping 29 matching lines...) Expand all  Loading... | 
| 91          heap->mark_compact_collector()->IsSlotInBlackObject( | 68          heap->mark_compact_collector()->IsSlotInBlackObject( | 
| 92              chunk, reinterpret_cast<Address>(slot)); | 69              chunk, reinterpret_cast<Address>(slot)); | 
| 93 } | 70 } | 
| 94 | 71 | 
| 95 template void RememberedSet<OLD_TO_NEW>::ClearInvalidSlots(Heap* heap); | 72 template void RememberedSet<OLD_TO_NEW>::ClearInvalidSlots(Heap* heap); | 
| 96 template void RememberedSet<OLD_TO_NEW>::VerifyValidSlots(Heap* heap); | 73 template void RememberedSet<OLD_TO_NEW>::VerifyValidSlots(Heap* heap); | 
| 97 template void RememberedSet<OLD_TO_OLD>::VerifyValidSlots(Heap* heap); | 74 template void RememberedSet<OLD_TO_OLD>::VerifyValidSlots(Heap* heap); | 
| 98 | 75 | 
| 99 }  // namespace internal | 76 }  // namespace internal | 
| 100 }  // namespace v8 | 77 }  // namespace v8 | 
| OLD | NEW | 
|---|