RecordSlot's target argument should be HeapObject

Bug: chromium:844008
Change-Id: If248ca90213c5cb3dfb0e3936a9ac824ed3c3119
Reviewed-on: https://chromium-review.googlesource.com/1095276
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@google.com>
Cr-Commit-Position: refs/heads/master@{#53646}
This commit is contained in:
Dominik Inführ 2018-06-11 17:19:16 +02:00 committed by Commit Bot
parent d50075453a
commit 1dacb78614
6 changed files with 24 additions and 18 deletions

View File

@ -157,8 +157,9 @@ class ConcurrentMarkingVisitor final
Object* object = snapshot.value(i);
DCHECK(!HasWeakHeapObjectTag(object));
if (!object->IsHeapObject()) continue;
MarkObject(HeapObject::cast(object));
MarkCompactCollector::RecordSlot(host, slot, object);
HeapObject* heap_object = HeapObject::cast(object);
MarkObject(heap_object);
MarkCompactCollector::RecordSlot(host, slot, heap_object);
}
}
@ -368,7 +369,7 @@ class ConcurrentMarkingVisitor final
Object** value_slot =
table->RawFieldOfElementAt(EphemeronHashTable::EntryToValueIndex(i));
MarkCompactCollector::RecordSlot(table, key_slot, *key_slot);
MarkCompactCollector::RecordSlot(table, key_slot, key);
if (marking_state_.IsBlackOrGrey(key)) {
VisitPointer(table, value_slot);
@ -376,7 +377,8 @@ class ConcurrentMarkingVisitor final
Object* value = *value_slot;
if (value->IsHeapObject()) {
MarkCompactCollector::RecordSlot(table, value_slot, value);
MarkCompactCollector::RecordSlot(table, value_slot,
HeapObject::cast(value));
}
}
}

View File

@ -98,7 +98,8 @@ void IncrementalMarking::RecordWriteSlow(HeapObject* obj,
Object* value) {
if (BaseRecordWrite(obj, value) && slot != nullptr) {
// Object is not going to be rescanned we need to record the slot.
heap_->mark_compact_collector()->RecordSlot(obj, slot, value);
heap_->mark_compact_collector()->RecordSlot(obj, slot,
HeapObject::cast(value));
}
}

View File

@ -145,7 +145,7 @@ int MarkingVisitor<fixed_array_mode, retaining_path_mode,
// Weak cells with live values are directly processed here to reduce
// the processing time of weak cells during the main GC pause.
Object** slot = HeapObject::RawField(weak_cell, WeakCell::kValueOffset);
collector_->RecordSlot(weak_cell, slot, *slot);
collector_->RecordSlot(weak_cell, slot, HeapObject::cast(*slot));
} else {
// If we do not know about liveness of values of weak cells, we have to
// process them when we know the liveness of the whole transitive
@ -383,13 +383,13 @@ void MarkCompactCollector::MarkExternallyReferencedObject(HeapObject* obj) {
}
void MarkCompactCollector::RecordSlot(HeapObject* object, Object** slot,
Object* target) {
HeapObject* target) {
RecordSlot(object, reinterpret_cast<HeapObjectReference**>(slot), target);
}
void MarkCompactCollector::RecordSlot(HeapObject* object,
HeapObjectReference** slot,
Object* target) {
HeapObject* target) {
Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target));
Page* source_page = Page::FromAddress(reinterpret_cast<Address>(object));
if (target_page->IsEvacuationCandidate<AccessMode::ATOMIC>() &&

View File

@ -959,7 +959,7 @@ class InternalizedStringTableCleaner : public ObjectVisitor {
} else {
// StringTable contains only old space strings.
DCHECK(!heap_->InNewSpace(o));
MarkCompactCollector::RecordSlot(table_, p, o);
MarkCompactCollector::RecordSlot(table_, p, heap_object);
}
}
}
@ -1912,9 +1912,9 @@ void MarkCompactCollector::ClearWeakCells() {
// Resurrect the cell.
non_atomic_marking_state()->WhiteToBlack(value);
Object** slot = HeapObject::RawField(value, Cell::kValueOffset);
RecordSlot(value, slot, *slot);
RecordSlot(value, slot, HeapObject::cast(*slot));
slot = HeapObject::RawField(weak_cell, WeakCell::kValueOffset);
RecordSlot(weak_cell, slot, *slot);
RecordSlot(weak_cell, slot, HeapObject::cast(*slot));
} else {
weak_cell->clear();
}
@ -1925,7 +1925,7 @@ void MarkCompactCollector::ClearWeakCells() {
} else {
// The value of the weak cell is alive.
Object** slot = HeapObject::RawField(weak_cell, WeakCell::kValueOffset);
RecordSlot(weak_cell, slot, *slot);
RecordSlot(weak_cell, slot, HeapObject::cast(*slot));
}
}
}
@ -1957,7 +1957,6 @@ void MarkCompactCollector::AbortWeakObjects() {
weak_objects_.transition_arrays.Clear();
weak_objects_.weak_references.Clear();
weak_objects_.weak_objects_in_code.Clear();
weak_objects_.ephemeron_hash_tables.Clear();
}
void MarkCompactCollector::RecordRelocSlot(Code* host, RelocInfo* rinfo,

View File

@ -572,9 +572,10 @@ class MarkCompactCollector final : public MarkCompactCollectorBase {
void RecordRelocSlot(Code* host, RelocInfo* rinfo, Object* target);
V8_INLINE static void RecordSlot(HeapObject* object, Object** slot,
Object* target);
HeapObject* target);
V8_INLINE static void RecordSlot(HeapObject* object,
HeapObjectReference** slot, Object* target);
HeapObjectReference** slot,
HeapObject* target);
void RecordLiveSlotsOnPage(Page* page);
void UpdateSlots(SlotsBuffer* buffer);

View File

@ -53,7 +53,8 @@ Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer) {
HeapObject* slot_holder = WeakListVisitor<T>::WeakNextHolder(tail);
int slot_offset = WeakListVisitor<T>::WeakNextOffset();
Object** slot = HeapObject::RawField(slot_holder, slot_offset);
MarkCompactCollector::RecordSlot(slot_holder, slot, retained);
MarkCompactCollector::RecordSlot(slot_holder, slot,
HeapObject::cast(retained));
}
}
// Retained object is new tail.
@ -135,7 +136,8 @@ struct WeakListVisitor<Context> {
for (int idx = Context::FIRST_WEAK_SLOT;
idx < Context::NATIVE_CONTEXT_SLOTS; ++idx) {
Object** slot = Context::cast(context)->RawFieldOfElementAt(idx);
MarkCompactCollector::RecordSlot(context, slot, *slot);
MarkCompactCollector::RecordSlot(context, slot,
HeapObject::cast(*slot));
}
// Code objects are always allocated in Code space, we do not have to
// visit them during scavenges.
@ -157,7 +159,8 @@ struct WeakListVisitor<Context> {
// Record the updated slot if necessary.
Object** head_slot =
HeapObject::RawField(context, FixedArray::SizeFor(index));
heap->mark_compact_collector()->RecordSlot(context, head_slot, list_head);
heap->mark_compact_collector()->RecordSlot(context, head_slot,
HeapObject::cast(list_head));
}
}