Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index 052fc5147288277ce83293579553ac02d784aac8..08010cb7e0c7fe0f2abb16d0eb6e2476725ca78a 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -6684,32 +6684,6 @@ void JSArrayBuffer::set_is_shared(bool value) { |
} |
-// static |
-template <typename StaticVisitor> |
-void JSArrayBuffer::JSArrayBufferIterateBody(Heap* heap, HeapObject* obj) { |
- StaticVisitor::VisitPointers( |
- heap, obj, |
- HeapObject::RawField(obj, JSArrayBuffer::BodyDescriptor::kStartOffset), |
- HeapObject::RawField(obj, |
- JSArrayBuffer::kByteLengthOffset + kPointerSize)); |
- StaticVisitor::VisitPointers( |
- heap, obj, HeapObject::RawField(obj, JSArrayBuffer::kSize), |
- HeapObject::RawField(obj, JSArrayBuffer::kSizeWithInternalFields)); |
-} |
- |
- |
-void JSArrayBuffer::JSArrayBufferIterateBody(HeapObject* obj, |
- ObjectVisitor* v) { |
- v->VisitPointers( |
- HeapObject::RawField(obj, JSArrayBuffer::BodyDescriptor::kStartOffset), |
- HeapObject::RawField(obj, |
- JSArrayBuffer::kByteLengthOffset + kPointerSize)); |
- v->VisitPointers( |
- HeapObject::RawField(obj, JSArrayBuffer::kSize), |
- HeapObject::RawField(obj, JSArrayBuffer::kSizeWithInternalFields)); |
-} |
- |
- |
Object* JSArrayBufferView::byte_offset() const { |
if (WasNeutered()) return Smi::FromInt(0); |
return Object::cast(READ_FIELD(this, kByteOffsetOffset)); |
@@ -7868,19 +7842,6 @@ void Foreign::ForeignIterateBody() { |
} |
-void FixedTypedArrayBase::FixedTypedArrayBaseIterateBody(ObjectVisitor* v) { |
- v->VisitPointer( |
- reinterpret_cast<Object**>(FIELD_ADDR(this, kBasePointerOffset))); |
-} |
- |
- |
-template <typename StaticVisitor> |
-void FixedTypedArrayBase::FixedTypedArrayBaseIterateBody() { |
- StaticVisitor::VisitPointer( |
- reinterpret_cast<Object**>(FIELD_ADDR(this, kBasePointerOffset))); |
-} |
- |
- |
void ExternalOneByteString::ExternalOneByteStringIterateBody(ObjectVisitor* v) { |
typedef v8::String::ExternalOneByteStringResource Resource; |
v->VisitExternalOneByteString( |
@@ -7911,6 +7872,7 @@ void ExternalTwoByteString::ExternalTwoByteStringIterateBody() { |
} |
+template <typename ObjectVisitor> |
void BodyDescriptorBase::IterateBodyImpl(HeapObject* obj, int start_offset, |
int end_offset, ObjectVisitor* v) { |
if (!FLAG_unbox_double_fields || obj->map()->HasFastPointerLayout()) { |
@@ -7956,6 +7918,7 @@ void BodyDescriptorBase::IterateBodyImpl(Heap* heap, HeapObject* obj, |
} |
+template <typename ObjectVisitor> |
void BodyDescriptorBase::IteratePointers(HeapObject* obj, int start_offset, |
int end_offset, ObjectVisitor* v) { |
v->VisitPointers(HeapObject::RawField(obj, start_offset), |
@@ -7972,6 +7935,20 @@ void BodyDescriptorBase::IteratePointers(Heap* heap, HeapObject* obj, |
} |
+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)); |
+} |
+ |
+ |
// Iterates the function object according to the visiting policy. |
template <JSFunction::BodyVisitingPolicy body_visiting_policy> |
class JSFunction::BodyDescriptorImpl : public BodyDescriptorBase { |
@@ -7980,6 +7957,7 @@ class JSFunction::BodyDescriptorImpl : public BodyDescriptorBase { |
STATIC_ASSERT(kCodeEntryOffset + kPointerSize == kNextFunctionLinkOffset); |
STATIC_ASSERT(kNextFunctionLinkOffset + kPointerSize == kSize); |
+ template <typename ObjectVisitor> |
static inline void IterateBody(HeapObject* obj, int object_size, |
ObjectVisitor* v) { |
IteratePointers(obj, kPropertiesOffset, kNonWeakFieldsEndOffset, v); |
@@ -8025,6 +8003,111 @@ class JSFunction::BodyDescriptorImpl : public BodyDescriptorBase { |
}; |
+class JSArrayBuffer::BodyDescriptor : public BodyDescriptorBase { |
+ public: |
+ STATIC_ASSERT(kByteLengthOffset + kPointerSize == kBackingStoreOffset); |
+ STATIC_ASSERT(kBackingStoreOffset + kPointerSize == kBitFieldSlot); |
+ STATIC_ASSERT(kBitFieldSlot + kPointerSize == kSize); |
+ |
+ template <typename ObjectVisitor> |
+ static inline void IterateBody(HeapObject* obj, int object_size, |
+ ObjectVisitor* v) { |
+ IteratePointers(obj, kPropertiesOffset, kBackingStoreOffset, v); |
+ IteratePointers(obj, kSize, kSizeWithInternalFields, v); |
+ |
+ // TODO(ishell): v8:4531, fix when JSArrayBuffers are allowed to have |
+ // in-object properties |
+ // IterateBodyImpl(obj, kSize, object_size, v); |
+ } |
+ |
+ template <typename StaticVisitor> |
+ static inline void IterateBody(HeapObject* obj, int object_size) { |
+ Heap* heap = obj->GetHeap(); |
+ IteratePointers<StaticVisitor>(heap, obj, kPropertiesOffset, |
+ kBackingStoreOffset); |
+ IteratePointers<StaticVisitor>(heap, obj, kSize, kSizeWithInternalFields); |
+ |
+ // TODO(ishell): v8:4531, fix when JSArrayBuffers are allowed to have |
+ // in-object properties |
+ // IterateBodyImpl<StaticVisitor>(heap, obj, kSize, object_size); |
+ } |
+ |
+ static inline int SizeOf(Map* map, HeapObject* object) { |
+ // TODO(ishell): v8:4531, fix when JSArrayBuffers are allowed to have |
+ // in-object properties |
+ // return map->instance_size(); |
+ return kSizeWithInternalFields; |
+ } |
+}; |
+ |
+ |
+class BytecodeArray::BodyDescriptor : public BodyDescriptorBase { |
+ public: |
+ template <typename ObjectVisitor> |
+ static inline void IterateBody(HeapObject* obj, int object_size, |
+ ObjectVisitor* v) { |
+ IteratePointer(obj, kConstantPoolOffset, v); |
+ } |
+ |
+ template <typename StaticVisitor> |
+ static inline void IterateBody(HeapObject* obj, int object_size) { |
+ Heap* heap = obj->GetHeap(); |
+ IteratePointer<StaticVisitor>(heap, obj, kConstantPoolOffset); |
+ } |
+ |
+ static inline int SizeOf(Map* map, HeapObject* object) { |
+ return SizeFor( |
+ reinterpret_cast<FixedArray*>(object)->synchronized_length()); |
+ } |
+}; |
+ |
+ |
+class FixedTypedArrayBase::BodyDescriptor : public BodyDescriptorBase { |
+ public: |
+ template <typename ObjectVisitor> |
+ static inline void IterateBody(HeapObject* obj, int object_size, |
+ ObjectVisitor* v) { |
+ IteratePointer(obj, kBasePointerOffset, v); |
+ } |
+ |
+ template <typename StaticVisitor> |
+ static inline void IterateBody(HeapObject* obj, int object_size) { |
+ Heap* heap = obj->GetHeap(); |
+ IteratePointer<StaticVisitor>(heap, obj, kBasePointerOffset); |
+ } |
+ |
+ static inline int SizeOf(Map* map, HeapObject* object) { |
+ return reinterpret_cast<FixedTypedArrayBase*>(object)->size(); |
+ } |
+}; |
+ |
+ |
+class JSWeakCollection::BodyDescriptor : public BodyDescriptorBase { |
+ public: |
+ template <typename ObjectVisitor> |
+ static inline void IterateBody(HeapObject* obj, int object_size, |
+ ObjectVisitor* v) { |
+ IteratePointers(obj, kPropertiesOffset, kSize, v); |
+ |
+ // TODO(ishell): v8:4531, fix when JSWeakCollection are allowed to have |
+ // in-object properties |
+ // IterateBodyImpl(obj, kSize, object_size, v); |
+ } |
+ |
+ template <typename StaticVisitor> |
+ static inline void IterateBody(HeapObject* obj, int object_size) { |
+ Heap* heap = obj->GetHeap(); |
+ IteratePointers<StaticVisitor>(heap, obj, kPropertiesOffset, kSize); |
+ |
+ // TODO(ishell): v8:4531, fix when JSWeakCollection are allowed to have |
+ // in-object properties |
+ // IterateBodyImpl<StaticVisitor>(heap, obj, kSize, object_size); |
+ } |
+ |
+ static inline int SizeOf(Map* map, HeapObject* object) { return kSize; } |
+}; |
+ |
+ |
template<class Derived, class TableType> |
Object* OrderedHashTableIterator<Derived, TableType>::CurrentKey() { |
TableType* table(TableType::cast(this->table())); |