Index: src/objects-body-descriptors-inl.h |
diff --git a/src/objects-body-descriptors-inl.h b/src/objects-body-descriptors-inl.h |
index be9c0f2de697b242420e8b471324a6998f66ba24..d34c0f04e40a9e68bce0b75011441de7a7761209 100644 |
--- a/src/objects-body-descriptors-inl.h |
+++ b/src/objects-body-descriptors-inl.h |
@@ -17,7 +17,6 @@ int FlexibleBodyDescriptor<start_offset>::SizeOf(Map* map, HeapObject* object) { |
return object->SizeFromMap(map); |
} |
- |
bool BodyDescriptorBase::IsValidSlotImpl(HeapObject* obj, int offset) { |
if (!FLAG_unbox_double_fields || obj->map()->HasFastPointerLayout()) { |
return true; |
@@ -53,7 +52,6 @@ void BodyDescriptorBase::IterateBodyImpl(HeapObject* obj, int start_offset, |
} |
} |
- |
template <typename StaticVisitor> |
void BodyDescriptorBase::IterateBodyImpl(Heap* heap, HeapObject* obj, |
int start_offset, int end_offset) { |
@@ -76,39 +74,62 @@ void BodyDescriptorBase::IterateBodyImpl(Heap* heap, HeapObject* obj, |
} |
} |
- |
template <typename ObjectVisitor> |
-DISABLE_CFI_PERF |
-void BodyDescriptorBase::IteratePointers(HeapObject* obj, int start_offset, |
- int end_offset, ObjectVisitor* v) { |
+DISABLE_CFI_PERF void BodyDescriptorBase::IteratePointers(HeapObject* obj, |
+ int start_offset, |
+ int end_offset, |
+ ObjectVisitor* v) { |
v->VisitPointers(HeapObject::RawField(obj, start_offset), |
HeapObject::RawField(obj, end_offset)); |
} |
- |
template <typename StaticVisitor> |
-DISABLE_CFI_PERF |
-void BodyDescriptorBase::IteratePointers(Heap* heap, HeapObject* obj, |
- int start_offset, int end_offset) { |
+DISABLE_CFI_PERF void BodyDescriptorBase::IteratePointers(Heap* heap, |
+ HeapObject* obj, |
+ int start_offset, |
+ int end_offset) { |
StaticVisitor::VisitPointers(heap, obj, |
HeapObject::RawField(obj, start_offset), |
HeapObject::RawField(obj, end_offset)); |
} |
- |
template <typename ObjectVisitor> |
void BodyDescriptorBase::IteratePointer(HeapObject* obj, int offset, |
ObjectVisitor* v) { |
v->VisitPointer(HeapObject::RawField(obj, offset)); |
} |
- |
template <typename StaticVisitor> |
void BodyDescriptorBase::IteratePointer(Heap* heap, HeapObject* obj, |
int offset) { |
StaticVisitor::VisitPointer(heap, obj, HeapObject::RawField(obj, offset)); |
} |
+class JSObject::BodyDescriptor final : public BodyDescriptorBase { |
+ public: |
+ static const int kStartOffset = JSReceiver::kPropertiesOffset; |
+ |
+ static bool IsValidSlot(HeapObject* obj, int offset) { |
+ if (offset < kStartOffset) return false; |
+ return IsValidSlotImpl(obj, offset); |
+ } |
+ |
+ template <typename ObjectVisitor> |
+ static inline void IterateBody(HeapObject* obj, int object_size, |
+ ObjectVisitor* v) { |
+ IterateBodyImpl(obj, kStartOffset, object_size, v); |
+ } |
+ |
+ template <typename StaticVisitor> |
+ static inline void IterateBody(HeapObject* obj, int object_size) { |
+ Heap* heap = obj->GetHeap(); |
+ IterateBodyImpl<StaticVisitor>(heap, obj, kStartOffset, object_size); |
+ } |
+ |
+ static inline int SizeOf(Map* map, HeapObject* object) { |
+ return map->instance_size(); |
+ } |
+}; |
// Iterates the function object according to the visiting policy. |
template <JSFunction::BodyVisitingPolicy body_visiting_policy> |
@@ -160,7 +181,6 @@ class JSFunction::BodyDescriptorImpl final : public BodyDescriptorBase { |
} |
}; |
- |
class JSArrayBuffer::BodyDescriptor final : public BodyDescriptorBase { |
public: |
STATIC_ASSERT(kByteLengthOffset + kPointerSize == kBackingStoreOffset); |
@@ -193,7 +213,6 @@ class JSArrayBuffer::BodyDescriptor final : public BodyDescriptorBase { |
} |
}; |
- |
class BytecodeArray::BodyDescriptor final : public BodyDescriptorBase { |
public: |
static bool IsValidSlot(HeapObject* obj, int offset) { |
@@ -222,7 +241,6 @@ class BytecodeArray::BodyDescriptor final : public BodyDescriptorBase { |
} |
}; |
- |
class FixedTypedArrayBase::BodyDescriptor final : public BodyDescriptorBase { |
public: |
static bool IsValidSlot(HeapObject* obj, int offset) { |
@@ -246,7 +264,6 @@ class FixedTypedArrayBase::BodyDescriptor final : public BodyDescriptorBase { |
} |
}; |
- |
template <JSWeakCollection::BodyVisitingPolicy body_visiting_policy> |
class JSWeakCollection::BodyDescriptorImpl final : public BodyDescriptorBase { |
public: |
@@ -285,7 +302,6 @@ class JSWeakCollection::BodyDescriptorImpl final : public BodyDescriptorBase { |
} |
}; |
- |
class Foreign::BodyDescriptor final : public BodyDescriptorBase { |
public: |
static bool IsValidSlot(HeapObject* obj, int offset) { return false; } |
@@ -306,7 +322,6 @@ class Foreign::BodyDescriptor final : public BodyDescriptorBase { |
static inline int SizeOf(Map* map, HeapObject* object) { return kSize; } |
}; |
- |
class ExternalOneByteString::BodyDescriptor final : public BodyDescriptorBase { |
public: |
static bool IsValidSlot(HeapObject* obj, int offset) { return false; } |
@@ -329,7 +344,6 @@ class ExternalOneByteString::BodyDescriptor final : public BodyDescriptorBase { |
static inline int SizeOf(Map* map, HeapObject* object) { return kSize; } |
}; |
- |
class ExternalTwoByteString::BodyDescriptor final : public BodyDescriptorBase { |
public: |
static bool IsValidSlot(HeapObject* obj, int offset) { return false; } |
@@ -352,7 +366,6 @@ class ExternalTwoByteString::BodyDescriptor final : public BodyDescriptorBase { |
static inline int SizeOf(Map* map, HeapObject* object) { return kSize; } |
}; |
- |
class Code::BodyDescriptor final : public BodyDescriptorBase { |
public: |
STATIC_ASSERT(kRelocationInfoOffset + kPointerSize == kHandlerTableOffset); |