| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/slots-buffer.h" | 5 #include "src/heap/slots-buffer.h" |
| 6 | 6 |
| 7 #include "src/assembler.h" | 7 #include "src/assembler.h" |
| 8 #include "src/heap/heap.h" | 8 #include "src/heap/heap.h" |
| 9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 for (int slot_idx = 0; slot_idx < slots_count; ++slot_idx) { | 50 for (int slot_idx = 0; slot_idx < slots_count; ++slot_idx) { |
| 51 ObjectSlot slot = slots[slot_idx]; | 51 ObjectSlot slot = slots[slot_idx]; |
| 52 if (!IsTypedSlot(slot)) { | 52 if (!IsTypedSlot(slot)) { |
| 53 Object* object = *slot; | 53 Object* object = *slot; |
| 54 // Slots are invalid when they currently: | 54 // Slots are invalid when they currently: |
| 55 // - do not point to a heap object (SMI) | 55 // - do not point to a heap object (SMI) |
| 56 // - point to a heap object in new space | 56 // - point to a heap object in new space |
| 57 // - are not within a live heap object on a valid pointer slot | 57 // - are not within a live heap object on a valid pointer slot |
| 58 // - point to a heap object not on an evacuation candidate | 58 // - point to a heap object not on an evacuation candidate |
| 59 if (!object->IsHeapObject() || heap->InNewSpace(object) || | 59 if (!object->IsHeapObject() || |
| 60 !heap->mark_compact_collector()->IsSlotInLiveObject( | 60 !heap->mark_compact_collector()->IsSlotInLiveObject( |
| 61 reinterpret_cast<Address>(slot)) || | 61 reinterpret_cast<Address>(slot)) || |
| 62 heap->InNewSpace(object) || |
| 62 !Page::FromAddress(reinterpret_cast<Address>(object)) | 63 !Page::FromAddress(reinterpret_cast<Address>(object)) |
| 63 ->IsEvacuationCandidate()) { | 64 ->IsEvacuationCandidate()) { |
| 64 // TODO(hpayer): Instead of replacing slots with kRemovedEntry we | 65 // TODO(hpayer): Instead of replacing slots with kRemovedEntry we |
| 65 // could shrink the slots buffer in-place. | 66 // could shrink the slots buffer in-place. |
| 66 slots[slot_idx] = kRemovedEntry; | 67 slots[slot_idx] = kRemovedEntry; |
| 67 } | 68 } |
| 68 } else { | 69 } else { |
| 69 ++slot_idx; | 70 ++slot_idx; |
| 70 DCHECK(slot_idx < slots_count); | 71 DCHECK(slot_idx < slots_count); |
| 71 } | 72 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 while (buffer != NULL) { | 153 while (buffer != NULL) { |
| 153 SlotsBuffer* next_buffer = buffer->next(); | 154 SlotsBuffer* next_buffer = buffer->next(); |
| 154 DeallocateBuffer(buffer); | 155 DeallocateBuffer(buffer); |
| 155 buffer = next_buffer; | 156 buffer = next_buffer; |
| 156 } | 157 } |
| 157 *buffer_address = NULL; | 158 *buffer_address = NULL; |
| 158 } | 159 } |
| 159 | 160 |
| 160 } // namespace internal | 161 } // namespace internal |
| 161 } // namespace v8 | 162 } // namespace v8 |
| OLD | NEW |