| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_OBJECTS_BODY_DESCRIPTORS_INL_H_ | 5 #ifndef V8_OBJECTS_BODY_DESCRIPTORS_INL_H_ |
| 6 #define V8_OBJECTS_BODY_DESCRIPTORS_INL_H_ | 6 #define V8_OBJECTS_BODY_DESCRIPTORS_INL_H_ |
| 7 | 7 |
| 8 #include "src/assembler-inl.h" | 8 #include "src/assembler-inl.h" |
| 9 #include "src/objects-body-descriptors.h" | 9 #include "src/objects-body-descriptors.h" |
| 10 #include "src/transitions.h" | 10 #include "src/transitions.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 IterateBodyImpl(obj, kStartOffset, object_size, v); | 120 IterateBodyImpl(obj, kStartOffset, object_size, v); |
| 121 } | 121 } |
| 122 | 122 |
| 123 template <typename StaticVisitor> | 123 template <typename StaticVisitor> |
| 124 static inline void IterateBody(HeapObject* obj, int object_size) { | 124 static inline void IterateBody(HeapObject* obj, int object_size) { |
| 125 Heap* heap = obj->GetHeap(); | 125 Heap* heap = obj->GetHeap(); |
| 126 IterateBodyImpl<StaticVisitor>(heap, obj, kStartOffset, object_size); | 126 IterateBodyImpl<StaticVisitor>(heap, obj, kStartOffset, object_size); |
| 127 } | 127 } |
| 128 | 128 |
| 129 static inline int SizeOf(Map* map, HeapObject* object) { | 129 static inline int SizeOf(Map* map, HeapObject* object) { |
| 130 return map->instance_size(); | |
| 131 } | |
| 132 }; | |
| 133 | |
| 134 class JSObject::FastBodyDescriptor final : public BodyDescriptorBase { | |
| 135 public: | |
| 136 static const int kStartOffset = JSReceiver::kPropertiesOffset; | |
| 137 | |
| 138 static bool IsValidSlot(HeapObject* obj, int offset) { | |
| 139 return offset >= kStartOffset; | |
| 140 } | |
| 141 | |
| 142 template <typename ObjectVisitor> | |
| 143 static inline void IterateBody(HeapObject* obj, int object_size, | |
| 144 ObjectVisitor* v) { | |
| 145 IteratePointers(obj, kStartOffset, object_size, v); | |
| 146 } | |
| 147 | |
| 148 template <typename StaticVisitor> | |
| 149 static inline void IterateBody(HeapObject* obj, int object_size) { | |
| 150 Heap* heap = obj->GetHeap(); | |
| 151 IteratePointers<StaticVisitor>(heap, obj, kStartOffset, object_size); | |
| 152 } | |
| 153 | |
| 154 static inline int SizeOf(Map* map, HeapObject* object) { | |
| 155 return map->instance_size(); | 130 return map->instance_size(); |
| 156 } | 131 } |
| 157 }; | 132 }; |
| 158 | 133 |
| 159 // Iterates the function object according to the visiting policy. | 134 // Iterates the function object according to the visiting policy. |
| 160 template <JSFunction::BodyVisitingPolicy body_visiting_policy> | 135 template <JSFunction::BodyVisitingPolicy body_visiting_policy> |
| 161 class JSFunction::BodyDescriptorImpl final : public BodyDescriptorBase { | 136 class JSFunction::BodyDescriptorImpl final : public BodyDescriptorBase { |
| 162 public: | 137 public: |
| 163 STATIC_ASSERT(kNonWeakFieldsEndOffset == kCodeEntryOffset); | 138 STATIC_ASSERT(kNonWeakFieldsEndOffset == kCodeEntryOffset); |
| 164 STATIC_ASSERT(kCodeEntryOffset + kPointerSize == kNextFunctionLinkOffset); | 139 STATIC_ASSERT(kCodeEntryOffset + kPointerSize == kNextFunctionLinkOffset); |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 | 625 |
| 651 template <typename ObjectVisitor> | 626 template <typename ObjectVisitor> |
| 652 void HeapObject::IterateBodyFast(InstanceType type, int object_size, | 627 void HeapObject::IterateBodyFast(InstanceType type, int object_size, |
| 653 ObjectVisitor* v) { | 628 ObjectVisitor* v) { |
| 654 BodyDescriptorApply<CallIterateBody, void>(type, this, object_size, v); | 629 BodyDescriptorApply<CallIterateBody, void>(type, this, object_size, v); |
| 655 } | 630 } |
| 656 } // namespace internal | 631 } // namespace internal |
| 657 } // namespace v8 | 632 } // namespace v8 |
| 658 | 633 |
| 659 #endif // V8_OBJECTS_BODY_DESCRIPTORS_INL_H_ | 634 #endif // V8_OBJECTS_BODY_DESCRIPTORS_INL_H_ |
| OLD | NEW |