Index: src/heap/objects-visiting-inl.h |
diff --git a/src/heap/objects-visiting-inl.h b/src/heap/objects-visiting-inl.h |
index 86f6d01940a0c7b9126e439a8b1392ca71ae51da..c4ce232c6024e3272093c6d67fa4bd7637e8090c 100644 |
--- a/src/heap/objects-visiting-inl.h |
+++ b/src/heap/objects-visiting-inl.h |
@@ -63,7 +63,11 @@ void StaticNewSpaceVisitor<StaticVisitor>::Initialize() { |
table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString); |
- table_.Register(kVisitJSFunction, &VisitJSFunction); |
+ // Don't visit code entry. We are using this visitor only during scavenges. |
+ table_.Register( |
+ kVisitJSFunction, |
+ &FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, |
+ int>::Visit); |
table_.Register(kVisitJSArrayBuffer, &VisitJSArrayBuffer); |
@@ -507,7 +511,7 @@ void StaticMarkingVisitor<StaticVisitor>::VisitJSFunction(Map* map, |
VisitSharedFunctionInfoWeakCode(heap, shared); |
} |
// Treat the reference to the code object weakly. |
- VisitJSFunctionWeakCode(heap, object); |
+ VisitJSFunctionWeakCode(map, object); |
return; |
} else { |
// Visit all unoptimized code objects to prevent flushing them. |
@@ -517,7 +521,7 @@ void StaticMarkingVisitor<StaticVisitor>::VisitJSFunction(Map* map, |
} |
} |
} |
- VisitJSFunctionStrongCode(heap, object); |
+ VisitJSFunctionStrongCode(map, object); |
} |
@@ -802,42 +806,20 @@ void StaticMarkingVisitor<StaticVisitor>::VisitSharedFunctionInfoWeakCode( |
template <typename StaticVisitor> |
void StaticMarkingVisitor<StaticVisitor>::VisitJSFunctionStrongCode( |
- Heap* heap, HeapObject* object) { |
- Object** start_slot = |
- HeapObject::RawField(object, JSFunction::kPropertiesOffset); |
- Object** end_slot = |
- HeapObject::RawField(object, JSFunction::kCodeEntryOffset); |
- StaticVisitor::VisitPointers(heap, object, start_slot, end_slot); |
- |
- 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, object, start_slot, end_slot); |
+ Map* map, HeapObject* object) { |
+ typedef FlexibleBodyVisitor<StaticVisitor, |
+ JSFunction::BodyDescriptorStrongCode, |
+ void> JSFunctionStrongCodeBodyVisitor; |
+ JSFunctionStrongCodeBodyVisitor::Visit(map, object); |
} |
template <typename StaticVisitor> |
void StaticMarkingVisitor<StaticVisitor>::VisitJSFunctionWeakCode( |
- Heap* heap, HeapObject* object) { |
- Object** start_slot = |
- HeapObject::RawField(object, JSFunction::kPropertiesOffset); |
- Object** end_slot = |
- HeapObject::RawField(object, JSFunction::kCodeEntryOffset); |
- StaticVisitor::VisitPointers(heap, object, start_slot, end_slot); |
- |
- // Skip visiting kCodeEntryOffset as it is treated weakly here. |
- STATIC_ASSERT(JSFunction::kCodeEntryOffset + kPointerSize == |
- JSFunction::kPrototypeOrInitialMapOffset); |
- |
- start_slot = |
- HeapObject::RawField(object, JSFunction::kPrototypeOrInitialMapOffset); |
- end_slot = HeapObject::RawField(object, JSFunction::kNonWeakFieldsEndOffset); |
- StaticVisitor::VisitPointers(heap, object, start_slot, end_slot); |
+ Map* map, HeapObject* object) { |
+ typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, |
+ void> JSFunctionWeakCodeBodyVisitor; |
+ JSFunctionWeakCodeBodyVisitor::Visit(map, object); |
} |