PatchCodeForDeoptimization(isolate, codes[i]);
// We might be in the middle of incremental marking with compaction.
- // Ignore all slots that might have been recorded on the deoptimized code
- // object.
- isolate->heap()->mark_compact_collector()->RemoveObjectSlots(codes[i]);
+ // Ignore all slots that might have been recorded in the body of the
+ // deoptimized code object.
+ Code* code = codes[i];
+ isolate->heap()->mark_compact_collector()->RemoveObjectSlots(
+ code->instruction_start(), code->address() + code->Size());
}
}
}
-void MarkCompactCollector::RemoveObjectSlots(HeapObject* invalid_object) {
+void MarkCompactCollector::RemoveObjectSlots(Address start_slot,
+ Address end_slot) {
// Remove entries by replacing them with an old-space slot containing a smi
// that is located in an unmovable page.
int npages = evacuation_candidates_.length();
DCHECK(p->IsEvacuationCandidate() ||
p->IsFlagSet(Page::RESCAN_ON_EVACUATION));
if (p->IsEvacuationCandidate()) {
- SlotsBuffer::RemoveObjectSlots(heap_, p->slots_buffer(), invalid_object);
+ SlotsBuffer::RemoveObjectSlots(heap_, p->slots_buffer(), start_slot,
+ end_slot);
}
}
}
void SlotsBuffer::RemoveObjectSlots(Heap* heap, SlotsBuffer* buffer,
- HeapObject* invalid_object) {
+ Address start_slot, Address end_slot) {
// Remove entries by replacing them with an old-space slot containing a smi
// that is located in an unmovable page.
const ObjectSlot kRemovedEntry = HeapObject::RawField(
ObjectSlot slot = slots[slot_idx];
if (!IsTypedSlot(slot)) {
Address slot_address = reinterpret_cast<Address>(slot);
- if (slot_address >= invalid_object->address() &&
- slot_address <
- (invalid_object->address() + invalid_object->Size())) {
+ if (slot_address >= start_slot && slot_address < end_slot) {
slots[slot_idx] = kRemovedEntry;
if (is_typed_slot) {
slots[slot_idx - 1] = kRemovedEntry;
// before sweeping when mark bits are still intact.
static void RemoveInvalidSlots(Heap* heap, SlotsBuffer* buffer);
- // Eliminate all slots that point to the given invalid_object.
+ // Eliminate all slots that are within the given address range.
static void RemoveObjectSlots(Heap* heap, SlotsBuffer* buffer,
- HeapObject* invalid_object);
+ Address start_slot, Address end_slot);
// Ensures that there are no invalid slots in the chain of slots buffers.
static void VerifySlots(Heap* heap, SlotsBuffer* buffer);
void VerifyIsSlotInLiveObject(Address slot, HeapObject* object);
// Removes all the slots in the slot buffers that are within the given
- // invalid_object.
- void RemoveObjectSlots(HeapObject* invalid_object);
+ // address range.
+ void RemoveObjectSlots(Address start_slot, Address end_slot);
private:
class SweeperTask;
buffer->Add(HeapObject::RawField(*array, FixedArray::kHeaderSize));
DCHECK(reinterpret_cast<void*>(buffer->Get(0)) ==
HeapObject::RawField(*array, FixedArray::kHeaderSize));
- SlotsBuffer::RemoveObjectSlots(CcTest::i_isolate()->heap(), buffer, *array);
+ SlotsBuffer::RemoveObjectSlots(CcTest::i_isolate()->heap(), buffer,
+ array->address(),
+ array->address() + array->Size());
DCHECK(reinterpret_cast<void*>(buffer->Get(0)) ==
HeapObject::RawField(heap->empty_fixed_array(),
FixedArrayBase::kLengthOffset));
reinterpret_cast<Object**>(SlotsBuffer::EMBEDDED_OBJECT_SLOT));
DCHECK(reinterpret_cast<void*>(buffer->Get(2)) ==
HeapObject::RawField(*array, FixedArray::kHeaderSize));
- SlotsBuffer::RemoveObjectSlots(CcTest::i_isolate()->heap(), buffer, *array);
+ SlotsBuffer::RemoveObjectSlots(CcTest::i_isolate()->heap(), buffer,
+ array->address(),
+ array->address() + array->Size());
DCHECK(reinterpret_cast<void*>(buffer->Get(1)) ==
HeapObject::RawField(heap->empty_fixed_array(),
FixedArrayBase::kLengthOffset));