| 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/objects-body-descriptors.h" | 8 #include "src/objects-body-descriptors.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 static inline int SizeOf(Map* map, HeapObject* object) { | 187 static inline int SizeOf(Map* map, HeapObject* object) { |
| 188 return map->instance_size(); | 188 return map->instance_size(); |
| 189 } | 189 } |
| 190 }; | 190 }; |
| 191 | 191 |
| 192 | 192 |
| 193 class BytecodeArray::BodyDescriptor final : public BodyDescriptorBase { | 193 class BytecodeArray::BodyDescriptor final : public BodyDescriptorBase { |
| 194 public: | 194 public: |
| 195 static bool IsValidSlot(HeapObject* obj, int offset) { | 195 static bool IsValidSlot(HeapObject* obj, int offset) { |
| 196 return offset == kConstantPoolOffset || offset == kHandlerTableOffset; | 196 return offset >= kConstantPoolOffset && |
| 197 offset <= kSourcePositionTableOffset; |
| 197 } | 198 } |
| 198 | 199 |
| 199 template <typename ObjectVisitor> | 200 template <typename ObjectVisitor> |
| 200 static inline void IterateBody(HeapObject* obj, int object_size, | 201 static inline void IterateBody(HeapObject* obj, int object_size, |
| 201 ObjectVisitor* v) { | 202 ObjectVisitor* v) { |
| 202 IteratePointer(obj, kConstantPoolOffset, v); | 203 IteratePointer(obj, kConstantPoolOffset, v); |
| 203 IteratePointer(obj, kHandlerTableOffset, v); | 204 IteratePointer(obj, kHandlerTableOffset, v); |
| 205 IteratePointer(obj, kSourcePositionTableOffset, v); |
| 204 } | 206 } |
| 205 | 207 |
| 206 template <typename StaticVisitor> | 208 template <typename StaticVisitor> |
| 207 static inline void IterateBody(HeapObject* obj, int object_size) { | 209 static inline void IterateBody(HeapObject* obj, int object_size) { |
| 208 Heap* heap = obj->GetHeap(); | 210 Heap* heap = obj->GetHeap(); |
| 209 IteratePointer<StaticVisitor>(heap, obj, kConstantPoolOffset); | 211 IteratePointer<StaticVisitor>(heap, obj, kConstantPoolOffset); |
| 210 IteratePointer<StaticVisitor>(heap, obj, kHandlerTableOffset); | 212 IteratePointer<StaticVisitor>(heap, obj, kHandlerTableOffset); |
| 213 IteratePointer<StaticVisitor>(heap, obj, kSourcePositionTableOffset); |
| 211 } | 214 } |
| 212 | 215 |
| 213 static inline int SizeOf(Map* map, HeapObject* obj) { | 216 static inline int SizeOf(Map* map, HeapObject* obj) { |
| 214 return reinterpret_cast<BytecodeArray*>(obj)->BytecodeArraySize(); | 217 return reinterpret_cast<BytecodeArray*>(obj)->BytecodeArraySize(); |
| 215 } | 218 } |
| 216 }; | 219 }; |
| 217 | 220 |
| 218 | 221 |
| 219 class FixedTypedArrayBase::BodyDescriptor final : public BodyDescriptorBase { | 222 class FixedTypedArrayBase::BodyDescriptor final : public BodyDescriptorBase { |
| 220 public: | 223 public: |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 | 561 |
| 559 template <typename ObjectVisitor> | 562 template <typename ObjectVisitor> |
| 560 void HeapObject::IterateBodyFast(InstanceType type, int object_size, | 563 void HeapObject::IterateBodyFast(InstanceType type, int object_size, |
| 561 ObjectVisitor* v) { | 564 ObjectVisitor* v) { |
| 562 BodyDescriptorApply<CallIterateBody, void>(type, this, object_size, v); | 565 BodyDescriptorApply<CallIterateBody, void>(type, this, object_size, v); |
| 563 } | 566 } |
| 564 } // namespace internal | 567 } // namespace internal |
| 565 } // namespace v8 | 568 } // namespace v8 |
| 566 | 569 |
| 567 #endif // V8_OBJECTS_BODY_DESCRIPTORS_INL_H_ | 570 #endif // V8_OBJECTS_BODY_DESCRIPTORS_INL_H_ |
| OLD | NEW |