Index: src/heap/objects-visiting-inl.h |
diff --git a/src/heap/objects-visiting-inl.h b/src/heap/objects-visiting-inl.h |
index c1cd67437222dc9be3592540b5b1ea4c5aab61ba..dbc296e59ea777a88b608fb7de25e2d5ce9bcdb0 100644 |
--- a/src/heap/objects-visiting-inl.h |
+++ b/src/heap/objects-visiting-inl.h |
@@ -83,7 +83,7 @@ int StaticNewSpaceVisitor<StaticVisitor>::VisitJSArrayBuffer( |
Heap* heap = map->GetHeap(); |
VisitPointers( |
- heap, |
+ heap, object, |
HeapObject::RawField(object, JSArrayBuffer::BodyDescriptor::kStartOffset), |
HeapObject::RawField(object, JSArrayBuffer::kSizeWithInternalFields)); |
if (!JSArrayBuffer::cast(object)->is_external()) { |
@@ -98,7 +98,7 @@ template <typename StaticVisitor> |
int StaticNewSpaceVisitor<StaticVisitor>::VisitJSTypedArray( |
Map* map, HeapObject* object) { |
VisitPointers( |
- map->GetHeap(), |
+ map->GetHeap(), object, |
HeapObject::RawField(object, JSTypedArray::BodyDescriptor::kStartOffset), |
HeapObject::RawField(object, JSTypedArray::kSizeWithInternalFields)); |
return JSTypedArray::kSizeWithInternalFields; |
@@ -109,7 +109,7 @@ template <typename StaticVisitor> |
int StaticNewSpaceVisitor<StaticVisitor>::VisitJSDataView(Map* map, |
HeapObject* object) { |
VisitPointers( |
- map->GetHeap(), |
+ map->GetHeap(), object, |
HeapObject::RawField(object, JSDataView::BodyDescriptor::kStartOffset), |
HeapObject::RawField(object, JSDataView::kSizeWithInternalFields)); |
return JSDataView::kSizeWithInternalFields; |
@@ -199,9 +199,10 @@ void StaticMarkingVisitor<StaticVisitor>::Initialize() { |
template <typename StaticVisitor> |
void StaticMarkingVisitor<StaticVisitor>::VisitCodeEntry( |
- Heap* heap, Address entry_address) { |
+ Heap* heap, HeapObject* object, Address entry_address) { |
Code* code = Code::cast(Code::GetObjectFromEntryAddress(entry_address)); |
- heap->mark_compact_collector()->RecordCodeEntrySlot(entry_address, code); |
+ heap->mark_compact_collector()->RecordCodeEntrySlot(object, entry_address, |
+ code); |
StaticVisitor::MarkObject(heap, code); |
} |
@@ -285,7 +286,7 @@ void StaticMarkingVisitor<StaticVisitor>::VisitNativeContext( |
for (int idx = Context::FIRST_WEAK_SLOT; idx < Context::NATIVE_CONTEXT_SLOTS; |
++idx) { |
Object** slot = Context::cast(object)->RawFieldOfElementAt(idx); |
- collector->RecordSlot(slot, slot, *slot); |
+ collector->RecordSlot(object, slot, *slot); |
} |
} |
@@ -307,7 +308,8 @@ void StaticMarkingVisitor<StaticVisitor>::VisitMap(Map* map, |
MarkMapContents(heap, map_object); |
} else { |
StaticVisitor::VisitPointers( |
- heap, HeapObject::RawField(object, Map::kPointerFieldsBeginOffset), |
+ heap, object, |
+ HeapObject::RawField(object, Map::kPointerFieldsBeginOffset), |
HeapObject::RawField(object, Map::kPointerFieldsEndOffset)); |
} |
} |
@@ -319,7 +321,7 @@ void StaticMarkingVisitor<StaticVisitor>::VisitPropertyCell( |
Heap* heap = map->GetHeap(); |
StaticVisitor::VisitPointers( |
- heap, |
+ heap, object, |
HeapObject::RawField(object, PropertyCell::kPointerFieldsBeginOffset), |
HeapObject::RawField(object, PropertyCell::kPointerFieldsEndOffset)); |
} |
@@ -347,7 +349,7 @@ void StaticMarkingVisitor<StaticVisitor>::VisitAllocationSite( |
Heap* heap = map->GetHeap(); |
StaticVisitor::VisitPointers( |
- heap, |
+ heap, object, |
HeapObject::RawField(object, AllocationSite::kPointerFieldsBeginOffset), |
HeapObject::RawField(object, AllocationSite::kPointerFieldsEndOffset)); |
} |
@@ -369,7 +371,8 @@ void StaticMarkingVisitor<StaticVisitor>::VisitWeakCollection( |
// Skip visiting the backing hash table containing the mappings and the |
// pointer to the other enqueued weak collections, both are post-processed. |
StaticVisitor::VisitPointers( |
- heap, HeapObject::RawField(object, JSWeakCollection::kPropertiesOffset), |
+ heap, object, |
+ HeapObject::RawField(object, JSWeakCollection::kPropertiesOffset), |
HeapObject::RawField(object, JSWeakCollection::kTableOffset)); |
STATIC_ASSERT(JSWeakCollection::kTableOffset + kPointerSize == |
JSWeakCollection::kNextOffset); |
@@ -382,7 +385,7 @@ void StaticMarkingVisitor<StaticVisitor>::VisitWeakCollection( |
// Mark the backing hash table without pushing it on the marking stack. |
Object** slot = HeapObject::RawField(object, JSWeakCollection::kTableOffset); |
HeapObject* obj = HeapObject::cast(*slot); |
- heap->mark_compact_collector()->RecordSlot(slot, slot, obj); |
+ heap->mark_compact_collector()->RecordSlot(object, slot, obj); |
StaticVisitor::MarkObjectWithoutPush(heap, obj); |
} |
@@ -494,7 +497,8 @@ void StaticMarkingVisitor<StaticVisitor>::VisitJSRegExp(Map* map, |
int last_property_offset = |
JSRegExp::kSize + kPointerSize * map->inobject_properties(); |
StaticVisitor::VisitPointers( |
- map->GetHeap(), HeapObject::RawField(object, JSRegExp::kPropertiesOffset), |
+ map->GetHeap(), object, |
+ HeapObject::RawField(object, JSRegExp::kPropertiesOffset), |
HeapObject::RawField(object, last_property_offset)); |
} |
@@ -505,7 +509,7 @@ void StaticMarkingVisitor<StaticVisitor>::VisitJSArrayBuffer( |
Heap* heap = map->GetHeap(); |
StaticVisitor::VisitPointers( |
- heap, |
+ heap, object, |
HeapObject::RawField(object, JSArrayBuffer::BodyDescriptor::kStartOffset), |
HeapObject::RawField(object, JSArrayBuffer::kSizeWithInternalFields)); |
if (!JSArrayBuffer::cast(object)->is_external()) { |
@@ -519,7 +523,7 @@ template <typename StaticVisitor> |
void StaticMarkingVisitor<StaticVisitor>::VisitJSTypedArray( |
Map* map, HeapObject* object) { |
StaticVisitor::VisitPointers( |
- map->GetHeap(), |
+ map->GetHeap(), object, |
HeapObject::RawField(object, JSTypedArray::BodyDescriptor::kStartOffset), |
HeapObject::RawField(object, JSTypedArray::kSizeWithInternalFields)); |
} |
@@ -529,7 +533,7 @@ template <typename StaticVisitor> |
void StaticMarkingVisitor<StaticVisitor>::VisitJSDataView(Map* map, |
HeapObject* object) { |
StaticVisitor::VisitPointers( |
- map->GetHeap(), |
+ map->GetHeap(), object, |
HeapObject::RawField(object, JSDataView::BodyDescriptor::kStartOffset), |
HeapObject::RawField(object, JSDataView::kSizeWithInternalFields)); |
} |
@@ -553,13 +557,14 @@ void StaticMarkingVisitor<StaticVisitor>::MarkMapContents(Heap* heap, |
DescriptorArray* descriptors = map->instance_descriptors(); |
if (StaticVisitor::MarkObjectWithoutPush(heap, descriptors) && |
descriptors->length() > 0) { |
- StaticVisitor::VisitPointers(heap, descriptors->GetFirstElementAddress(), |
+ StaticVisitor::VisitPointers(heap, descriptors, |
+ descriptors->GetFirstElementAddress(), |
descriptors->GetDescriptorEndSlot(0)); |
} |
int start = 0; |
int end = map->NumberOfOwnDescriptors(); |
if (start < end) { |
- StaticVisitor::VisitPointers(heap, |
+ StaticVisitor::VisitPointers(heap, descriptors, |
descriptors->GetDescriptorStartSlot(start), |
descriptors->GetDescriptorEndSlot(end)); |
} |
@@ -569,7 +574,7 @@ void StaticMarkingVisitor<StaticVisitor>::MarkMapContents(Heap* heap, |
// been marked already, it is fine that one of these fields contains a |
// pointer to it. |
StaticVisitor::VisitPointers( |
- heap, HeapObject::RawField(map, Map::kPointerFieldsBeginOffset), |
+ heap, map, HeapObject::RawField(map, Map::kPointerFieldsBeginOffset), |
HeapObject::RawField(map, Map::kPointerFieldsEndOffset)); |
} |
@@ -580,13 +585,13 @@ void StaticMarkingVisitor<StaticVisitor>::MarkTransitionArray( |
if (!StaticVisitor::MarkObjectWithoutPush(heap, transitions)) return; |
if (transitions->HasPrototypeTransitions()) { |
- StaticVisitor::VisitPointer(heap, |
+ StaticVisitor::VisitPointer(heap, transitions, |
transitions->GetPrototypeTransitionsSlot()); |
} |
int num_transitions = TransitionArray::NumberOfTransitions(transitions); |
for (int i = 0; i < num_transitions; ++i) { |
- StaticVisitor::VisitPointer(heap, transitions->GetKeySlot(i)); |
+ StaticVisitor::VisitPointer(heap, transitions, transitions->GetKeySlot(i)); |
} |
} |
@@ -602,7 +607,7 @@ void StaticMarkingVisitor<StaticVisitor>::MarkOptimizedCodeMap( |
if (FLAG_turbo_preserve_shared_code && shared_object->IsCode() && |
FLAG_age_code && !Code::cast(shared_object)->IsOld()) { |
StaticVisitor::VisitPointer( |
- heap, |
+ heap, code_map, |
code_map->RawFieldOfElementAt(SharedFunctionInfo::kSharedCodeIndex)); |
} |
} |
@@ -734,7 +739,7 @@ void StaticMarkingVisitor<StaticVisitor>::VisitSharedFunctionInfoStrongCode( |
object, SharedFunctionInfo::BodyDescriptor::kStartOffset); |
Object** end_slot = HeapObject::RawField( |
object, SharedFunctionInfo::BodyDescriptor::kEndOffset); |
- StaticVisitor::VisitPointers(heap, start_slot, end_slot); |
+ StaticVisitor::VisitPointers(heap, object, start_slot, end_slot); |
} |
@@ -743,7 +748,7 @@ void StaticMarkingVisitor<StaticVisitor>::VisitSharedFunctionInfoWeakCode( |
Heap* heap, HeapObject* object) { |
Object** name_slot = |
HeapObject::RawField(object, SharedFunctionInfo::kNameOffset); |
- StaticVisitor::VisitPointer(heap, name_slot); |
+ StaticVisitor::VisitPointer(heap, object, name_slot); |
// Skip visiting kCodeOffset as it is treated weakly here. |
STATIC_ASSERT(SharedFunctionInfo::kNameOffset + kPointerSize == |
@@ -755,7 +760,7 @@ void StaticMarkingVisitor<StaticVisitor>::VisitSharedFunctionInfoWeakCode( |
HeapObject::RawField(object, SharedFunctionInfo::kOptimizedCodeMapOffset); |
Object** end_slot = HeapObject::RawField( |
object, SharedFunctionInfo::BodyDescriptor::kEndOffset); |
- StaticVisitor::VisitPointers(heap, start_slot, end_slot); |
+ StaticVisitor::VisitPointers(heap, object, start_slot, end_slot); |
} |
@@ -766,16 +771,17 @@ void StaticMarkingVisitor<StaticVisitor>::VisitJSFunctionStrongCode( |
HeapObject::RawField(object, JSFunction::kPropertiesOffset); |
Object** end_slot = |
HeapObject::RawField(object, JSFunction::kCodeEntryOffset); |
- StaticVisitor::VisitPointers(heap, start_slot, end_slot); |
+ StaticVisitor::VisitPointers(heap, object, start_slot, end_slot); |
- VisitCodeEntry(heap, object->address() + JSFunction::kCodeEntryOffset); |
+ VisitCodeEntry(heap, object, |
+ object->address() + JSFunction::kCodeEntryOffset); |
STATIC_ASSERT(JSFunction::kCodeEntryOffset + kPointerSize == |
JSFunction::kPrototypeOrInitialMapOffset); |
start_slot = |
HeapObject::RawField(object, JSFunction::kPrototypeOrInitialMapOffset); |
end_slot = HeapObject::RawField(object, JSFunction::kNonWeakFieldsEndOffset); |
- StaticVisitor::VisitPointers(heap, start_slot, end_slot); |
+ StaticVisitor::VisitPointers(heap, object, start_slot, end_slot); |
} |
@@ -786,7 +792,7 @@ void StaticMarkingVisitor<StaticVisitor>::VisitJSFunctionWeakCode( |
HeapObject::RawField(object, JSFunction::kPropertiesOffset); |
Object** end_slot = |
HeapObject::RawField(object, JSFunction::kCodeEntryOffset); |
- StaticVisitor::VisitPointers(heap, start_slot, end_slot); |
+ StaticVisitor::VisitPointers(heap, object, start_slot, end_slot); |
// Skip visiting kCodeEntryOffset as it is treated weakly here. |
STATIC_ASSERT(JSFunction::kCodeEntryOffset + kPointerSize == |
@@ -795,7 +801,7 @@ void StaticMarkingVisitor<StaticVisitor>::VisitJSFunctionWeakCode( |
start_slot = |
HeapObject::RawField(object, JSFunction::kPrototypeOrInitialMapOffset); |
end_slot = HeapObject::RawField(object, JSFunction::kNonWeakFieldsEndOffset); |
- StaticVisitor::VisitPointers(heap, start_slot, end_slot); |
+ StaticVisitor::VisitPointers(heap, object, start_slot, end_slot); |
} |
@@ -839,15 +845,16 @@ void Code::CodeIterateBody(Heap* heap) { |
// There are two places where we iterate code bodies: here and the non- |
// templated CodeIterateBody (above). They should be kept in sync. |
StaticVisitor::VisitPointer( |
- heap, |
+ heap, this, |
reinterpret_cast<Object**>(this->address() + kRelocationInfoOffset)); |
StaticVisitor::VisitPointer( |
- heap, reinterpret_cast<Object**>(this->address() + kHandlerTableOffset)); |
+ heap, this, |
+ reinterpret_cast<Object**>(this->address() + kHandlerTableOffset)); |
StaticVisitor::VisitPointer( |
- heap, |
+ heap, this, |
reinterpret_cast<Object**>(this->address() + kDeoptimizationDataOffset)); |
StaticVisitor::VisitPointer( |
- heap, |
+ heap, this, |
reinterpret_cast<Object**>(this->address() + kTypeFeedbackInfoOffset)); |
StaticVisitor::VisitNextCodeLink( |
heap, reinterpret_cast<Object**>(this->address() + kNextCodeLinkOffset)); |