OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/mark-compact.h" | 5 #include "src/heap/mark-compact.h" |
6 | 6 |
7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
(...skipping 4504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4515 ->NeverEvacuate()); | 4515 ->NeverEvacuate()); |
4516 | 4516 |
4517 while (buffer != NULL) { | 4517 while (buffer != NULL) { |
4518 SlotsBuffer::ObjectSlot* slots = buffer->slots_; | 4518 SlotsBuffer::ObjectSlot* slots = buffer->slots_; |
4519 intptr_t slots_count = buffer->idx_; | 4519 intptr_t slots_count = buffer->idx_; |
4520 | 4520 |
4521 for (int slot_idx = 0; slot_idx < slots_count; ++slot_idx) { | 4521 for (int slot_idx = 0; slot_idx < slots_count; ++slot_idx) { |
4522 ObjectSlot slot = slots[slot_idx]; | 4522 ObjectSlot slot = slots[slot_idx]; |
4523 if (!IsTypedSlot(slot)) { | 4523 if (!IsTypedSlot(slot)) { |
4524 Object* object = *slot; | 4524 Object* object = *slot; |
4525 if ((object->IsHeapObject() && heap->InNewSpace(object)) || | 4525 // Slots are invalid when they currently: |
| 4526 // - do not point to a heap object (SMI) |
| 4527 // - point to a heap object in new space |
| 4528 // - are not within a live heap object on a valid pointer slot |
| 4529 // - point to a heap object not on an evacuation candidate |
| 4530 if (!object->IsHeapObject() || heap->InNewSpace(object) || |
4526 !heap->mark_compact_collector()->IsSlotInLiveObject( | 4531 !heap->mark_compact_collector()->IsSlotInLiveObject( |
4527 reinterpret_cast<Address>(slot))) { | 4532 reinterpret_cast<Address>(slot)) || |
| 4533 !Page::FromAddress(reinterpret_cast<Address>(object)) |
| 4534 ->IsEvacuationCandidate()) { |
| 4535 // TODO(hpayer): Instead of replacing slots with kRemovedEntry we |
| 4536 // could shrink the slots buffer in-place. |
4528 slots[slot_idx] = kRemovedEntry; | 4537 slots[slot_idx] = kRemovedEntry; |
4529 } | 4538 } |
4530 } else { | 4539 } else { |
4531 ++slot_idx; | 4540 ++slot_idx; |
4532 DCHECK(slot_idx < slots_count); | 4541 DCHECK(slot_idx < slots_count); |
4533 } | 4542 } |
4534 } | 4543 } |
4535 buffer = buffer->next(); | 4544 buffer = buffer->next(); |
4536 } | 4545 } |
4537 } | 4546 } |
(...skipping 11 matching lines...) Expand all Loading... |
4549 while (buffer != NULL) { | 4558 while (buffer != NULL) { |
4550 SlotsBuffer::ObjectSlot* slots = buffer->slots_; | 4559 SlotsBuffer::ObjectSlot* slots = buffer->slots_; |
4551 intptr_t slots_count = buffer->idx_; | 4560 intptr_t slots_count = buffer->idx_; |
4552 bool is_typed_slot = false; | 4561 bool is_typed_slot = false; |
4553 | 4562 |
4554 for (int slot_idx = 0; slot_idx < slots_count; ++slot_idx) { | 4563 for (int slot_idx = 0; slot_idx < slots_count; ++slot_idx) { |
4555 ObjectSlot slot = slots[slot_idx]; | 4564 ObjectSlot slot = slots[slot_idx]; |
4556 if (!IsTypedSlot(slot)) { | 4565 if (!IsTypedSlot(slot)) { |
4557 Address slot_address = reinterpret_cast<Address>(slot); | 4566 Address slot_address = reinterpret_cast<Address>(slot); |
4558 if (slot_address >= start_slot && slot_address < end_slot) { | 4567 if (slot_address >= start_slot && slot_address < end_slot) { |
| 4568 // TODO(hpayer): Instead of replacing slots with kRemovedEntry we |
| 4569 // could shrink the slots buffer in-place. |
4559 slots[slot_idx] = kRemovedEntry; | 4570 slots[slot_idx] = kRemovedEntry; |
4560 if (is_typed_slot) { | 4571 if (is_typed_slot) { |
4561 slots[slot_idx - 1] = kRemovedEntry; | 4572 slots[slot_idx - 1] = kRemovedEntry; |
4562 } | 4573 } |
4563 } | 4574 } |
4564 is_typed_slot = false; | 4575 is_typed_slot = false; |
4565 } else { | 4576 } else { |
4566 is_typed_slot = true; | 4577 is_typed_slot = true; |
4567 DCHECK(slot_idx < slots_count); | 4578 DCHECK(slot_idx < slots_count); |
4568 } | 4579 } |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4751 SlotsBuffer* buffer = *buffer_address; | 4762 SlotsBuffer* buffer = *buffer_address; |
4752 while (buffer != NULL) { | 4763 while (buffer != NULL) { |
4753 SlotsBuffer* next_buffer = buffer->next(); | 4764 SlotsBuffer* next_buffer = buffer->next(); |
4754 DeallocateBuffer(buffer); | 4765 DeallocateBuffer(buffer); |
4755 buffer = next_buffer; | 4766 buffer = next_buffer; |
4756 } | 4767 } |
4757 *buffer_address = NULL; | 4768 *buffer_address = NULL; |
4758 } | 4769 } |
4759 } // namespace internal | 4770 } // namespace internal |
4760 } // namespace v8 | 4771 } // namespace v8 |
OLD | NEW |