Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index b57e27bb40c6f3dfd6a07ddee6c7c087cf6aa2fe..8d6737b2eeb00e4919bf2ba50f9531beb4f340aa 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -7843,7 +7843,8 @@ Relocatable::~Relocatable() { |
// static |
-int JSObject::BodyDescriptor::SizeOf(Map* map, HeapObject* object) { |
+template <int start_offset> |
+int FlexibleBodyDescriptor<start_offset>::SizeOf(Map* map, HeapObject* object) { |
return map->instance_size(); |
} |
@@ -7854,12 +7855,6 @@ int FixedArray::BodyDescriptor::SizeOf(Map* map, HeapObject* object) { |
} |
-// static |
-int StructBodyDescriptor::SizeOf(Map* map, HeapObject* object) { |
- return map->instance_size(); |
-} |
- |
- |
void Foreign::ForeignIterateBody(ObjectVisitor* v) { |
v->VisitExternalReference( |
reinterpret_cast<Address*>(FIELD_ADDR(this, kForeignAddressOffset))); |
@@ -7916,48 +7911,54 @@ void ExternalTwoByteString::ExternalTwoByteStringIterateBody() { |
} |
-static inline void IterateBodyUsingLayoutDescriptor(HeapObject* object, |
- int start_offset, |
- int end_offset, |
- ObjectVisitor* v) { |
- DCHECK(FLAG_unbox_double_fields); |
- DCHECK(IsAligned(start_offset, kPointerSize) && |
- IsAligned(end_offset, kPointerSize)); |
- |
- LayoutDescriptorHelper helper(object->map()); |
- DCHECK(!helper.all_fields_tagged()); |
- |
- for (int offset = start_offset; offset < end_offset; offset += kPointerSize) { |
- // Visit all tagged fields. |
- if (helper.IsTagged(offset)) { |
- v->VisitPointer(HeapObject::RawField(object, offset)); |
- } |
- } |
-} |
- |
- |
-template<int start_offset, int end_offset, int size> |
-void FixedBodyDescriptor<start_offset, end_offset, size>::IterateBody( |
- HeapObject* obj, |
- ObjectVisitor* v) { |
+void BodyDescriptorBase::IterateBodyImpl(HeapObject* obj, int start_offset, |
+ int end_offset, ObjectVisitor* v) { |
if (!FLAG_unbox_double_fields || obj->map()->HasFastPointerLayout()) { |
v->VisitPointers(HeapObject::RawField(obj, start_offset), |
HeapObject::RawField(obj, end_offset)); |
} else { |
- IterateBodyUsingLayoutDescriptor(obj, start_offset, end_offset, v); |
+ DCHECK(FLAG_unbox_double_fields); |
+ DCHECK(IsAligned(start_offset, kPointerSize) && |
+ IsAligned(end_offset, kPointerSize)); |
+ |
+ LayoutDescriptorHelper helper(obj->map()); |
+ DCHECK(!helper.all_fields_tagged()); |
+ for (int offset = start_offset; offset < end_offset;) { |
+ int end_of_region_offset; |
+ if (helper.IsTagged(offset, end_offset, &end_of_region_offset)) { |
+ v->VisitPointers(HeapObject::RawField(obj, offset), |
+ HeapObject::RawField(obj, end_of_region_offset)); |
+ } |
+ offset = end_of_region_offset; |
+ } |
} |
} |
-template<int start_offset> |
-void FlexibleBodyDescriptor<start_offset>::IterateBody(HeapObject* obj, |
- int object_size, |
- ObjectVisitor* v) { |
+template <typename StaticVisitor> |
+void BodyDescriptorBase::IterateBodyImpl(HeapObject* obj, int start_offset, |
+ int end_offset) { |
+ Heap* heap = obj->GetHeap(); |
if (!FLAG_unbox_double_fields || obj->map()->HasFastPointerLayout()) { |
- v->VisitPointers(HeapObject::RawField(obj, start_offset), |
- HeapObject::RawField(obj, object_size)); |
+ StaticVisitor::VisitPointers(heap, obj, |
+ HeapObject::RawField(obj, start_offset), |
+ HeapObject::RawField(obj, end_offset)); |
} else { |
- IterateBodyUsingLayoutDescriptor(obj, start_offset, object_size, v); |
+ DCHECK(FLAG_unbox_double_fields); |
+ DCHECK(IsAligned(start_offset, kPointerSize) && |
+ IsAligned(end_offset, kPointerSize)); |
+ |
+ LayoutDescriptorHelper helper(obj->map()); |
+ DCHECK(!helper.all_fields_tagged()); |
+ for (int offset = start_offset; offset < end_offset;) { |
+ int end_of_region_offset; |
+ if (helper.IsTagged(offset, end_offset, &end_of_region_offset)) { |
+ StaticVisitor::VisitPointers( |
+ heap, obj, HeapObject::RawField(obj, offset), |
+ HeapObject::RawField(obj, end_of_region_offset)); |
+ } |
+ offset = end_of_region_offset; |
+ } |
} |
} |