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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 for (MemoryChunk* chunk : *heap->code_space()) { | 29 for (MemoryChunk* chunk : *heap->code_space()) { |
30 TypedSlotSet* slots = GetTypedSlotSet(chunk); | 30 TypedSlotSet* slots = GetTypedSlotSet(chunk); |
31 if (slots != nullptr) { | 31 if (slots != nullptr) { |
32 slots->Iterate( | 32 slots->Iterate( |
33 [heap, chunk](SlotType type, Address host_addr, Address addr) { | 33 [heap, chunk](SlotType type, Address host_addr, Address addr) { |
34 if (Marking::IsBlack(ObjectMarking::MarkBitFrom(host_addr))) { | 34 if (Marking::IsBlack(ObjectMarking::MarkBitFrom(host_addr))) { |
35 return KEEP_SLOT; | 35 return KEEP_SLOT; |
36 } else { | 36 } else { |
37 return REMOVE_SLOT; | 37 return REMOVE_SLOT; |
38 } | 38 } |
39 }); | 39 }, |
| 40 TypedSlotSet::PREFREE_EMPTY_CHUNKS); |
40 } | 41 } |
41 } | 42 } |
42 for (MemoryChunk* chunk : *heap->map_space()) { | 43 for (MemoryChunk* chunk : *heap->map_space()) { |
43 SlotSet* slots = GetSlotSet(chunk); | 44 SlotSet* slots = GetSlotSet(chunk); |
44 if (slots != nullptr) { | 45 if (slots != nullptr) { |
45 slots->Iterate([heap, chunk](Address addr) { | 46 slots->Iterate([heap, chunk](Address addr) { |
46 Object** slot = reinterpret_cast<Object**>(addr); | 47 Object** slot = reinterpret_cast<Object**>(addr); |
47 // TODO(mlippautz): In map space all allocations would ideally be map | 48 // TODO(mlippautz): In map space all allocations would ideally be map |
48 // aligned. After establishing this invariant IsValidSlot could just | 49 // aligned. After establishing this invariant IsValidSlot could just |
49 // refer to the containing object using alignment and check the mark | 50 // refer to the containing object using alignment and check the mark |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 heap->mark_compact_collector()->IsSlotInBlackObject( | 93 heap->mark_compact_collector()->IsSlotInBlackObject( |
93 chunk, reinterpret_cast<Address>(slot)); | 94 chunk, reinterpret_cast<Address>(slot)); |
94 } | 95 } |
95 | 96 |
96 template void RememberedSet<OLD_TO_NEW>::ClearInvalidSlots(Heap* heap); | 97 template void RememberedSet<OLD_TO_NEW>::ClearInvalidSlots(Heap* heap); |
97 template void RememberedSet<OLD_TO_NEW>::VerifyValidSlots(Heap* heap); | 98 template void RememberedSet<OLD_TO_NEW>::VerifyValidSlots(Heap* heap); |
98 template void RememberedSet<OLD_TO_OLD>::VerifyValidSlots(Heap* heap); | 99 template void RememberedSet<OLD_TO_OLD>::VerifyValidSlots(Heap* heap); |
99 | 100 |
100 } // namespace internal | 101 } // namespace internal |
101 } // namespace v8 | 102 } // namespace v8 |
OLD | NEW |