| 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 } | 234 } |
| 235 | 235 |
| 236 static inline int SizeOf(Map* map, HeapObject* object) { | 236 static inline int SizeOf(Map* map, HeapObject* object) { |
| 237 return map->instance_size(); | 237 return map->instance_size(); |
| 238 } | 238 } |
| 239 }; | 239 }; |
| 240 | 240 |
| 241 class BytecodeArray::BodyDescriptor final : public BodyDescriptorBase { | 241 class BytecodeArray::BodyDescriptor final : public BodyDescriptorBase { |
| 242 public: | 242 public: |
| 243 static bool IsValidSlot(HeapObject* obj, int offset) { | 243 static bool IsValidSlot(HeapObject* obj, int offset) { |
| 244 return offset >= kConstantPoolOffset && | 244 return offset >= kConstantPoolOffset && offset <= kStackFrameCacheOffset; |
| 245 offset <= kSourcePositionTableOffset; | |
| 246 } | 245 } |
| 247 | 246 |
| 248 template <typename ObjectVisitor> | 247 template <typename ObjectVisitor> |
| 249 static inline void IterateBody(HeapObject* obj, int object_size, | 248 static inline void IterateBody(HeapObject* obj, int object_size, |
| 250 ObjectVisitor* v) { | 249 ObjectVisitor* v) { |
| 251 IteratePointer(obj, kConstantPoolOffset, v); | 250 IteratePointer(obj, kConstantPoolOffset, v); |
| 252 IteratePointer(obj, kHandlerTableOffset, v); | 251 IteratePointer(obj, kHandlerTableOffset, v); |
| 253 IteratePointer(obj, kSourcePositionTableOffset, v); | 252 IteratePointer(obj, kSourcePositionTableOffset, v); |
| 253 IteratePointer(obj, kStackFrameCacheOffset, v); |
| 254 } | 254 } |
| 255 | 255 |
| 256 template <typename StaticVisitor> | 256 template <typename StaticVisitor> |
| 257 static inline void IterateBody(HeapObject* obj, int object_size) { | 257 static inline void IterateBody(HeapObject* obj, int object_size) { |
| 258 Heap* heap = obj->GetHeap(); | 258 Heap* heap = obj->GetHeap(); |
| 259 IteratePointer<StaticVisitor>(heap, obj, kConstantPoolOffset); | 259 IteratePointer<StaticVisitor>(heap, obj, kConstantPoolOffset); |
| 260 IteratePointer<StaticVisitor>(heap, obj, kHandlerTableOffset); | 260 IteratePointer<StaticVisitor>(heap, obj, kHandlerTableOffset); |
| 261 IteratePointer<StaticVisitor>(heap, obj, kSourcePositionTableOffset); | 261 IteratePointer<StaticVisitor>(heap, obj, kSourcePositionTableOffset); |
| 262 IteratePointer<StaticVisitor>(heap, obj, kStackFrameCacheOffset); |
| 262 } | 263 } |
| 263 | 264 |
| 264 static inline int SizeOf(Map* map, HeapObject* obj) { | 265 static inline int SizeOf(Map* map, HeapObject* obj) { |
| 265 return reinterpret_cast<BytecodeArray*>(obj)->BytecodeArraySize(); | 266 return reinterpret_cast<BytecodeArray*>(obj)->BytecodeArraySize(); |
| 266 } | 267 } |
| 267 }; | 268 }; |
| 268 | 269 |
| 269 class FixedTypedArrayBase::BodyDescriptor final : public BodyDescriptorBase { | 270 class FixedTypedArrayBase::BodyDescriptor final : public BodyDescriptorBase { |
| 270 public: | 271 public: |
| 271 static bool IsValidSlot(HeapObject* obj, int offset) { | 272 static bool IsValidSlot(HeapObject* obj, int offset) { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 }; | 393 }; |
| 393 | 394 |
| 394 class Code::BodyDescriptor final : public BodyDescriptorBase { | 395 class Code::BodyDescriptor final : public BodyDescriptorBase { |
| 395 public: | 396 public: |
| 396 STATIC_ASSERT(kRelocationInfoOffset + kPointerSize == kHandlerTableOffset); | 397 STATIC_ASSERT(kRelocationInfoOffset + kPointerSize == kHandlerTableOffset); |
| 397 STATIC_ASSERT(kHandlerTableOffset + kPointerSize == | 398 STATIC_ASSERT(kHandlerTableOffset + kPointerSize == |
| 398 kDeoptimizationDataOffset); | 399 kDeoptimizationDataOffset); |
| 399 STATIC_ASSERT(kDeoptimizationDataOffset + kPointerSize == | 400 STATIC_ASSERT(kDeoptimizationDataOffset + kPointerSize == |
| 400 kSourcePositionTableOffset); | 401 kSourcePositionTableOffset); |
| 401 STATIC_ASSERT(kSourcePositionTableOffset + kPointerSize == | 402 STATIC_ASSERT(kSourcePositionTableOffset + kPointerSize == |
| 403 kStackFrameCacheOffset); |
| 404 STATIC_ASSERT(kStackFrameCacheOffset + kPointerSize == |
| 402 kTypeFeedbackInfoOffset); | 405 kTypeFeedbackInfoOffset); |
| 403 STATIC_ASSERT(kTypeFeedbackInfoOffset + kPointerSize == | 406 STATIC_ASSERT(kTypeFeedbackInfoOffset + kPointerSize == |
| 404 kNextCodeLinkOffset); | 407 kNextCodeLinkOffset); |
| 405 | 408 |
| 406 static bool IsValidSlot(HeapObject* obj, int offset) { | 409 static bool IsValidSlot(HeapObject* obj, int offset) { |
| 407 // Slots in code can't be invalid because we never trim code objects. | 410 // Slots in code can't be invalid because we never trim code objects. |
| 408 return true; | 411 return true; |
| 409 } | 412 } |
| 410 | 413 |
| 411 template <typename ObjectVisitor> | 414 template <typename ObjectVisitor> |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 | 654 |
| 652 template <typename ObjectVisitor> | 655 template <typename ObjectVisitor> |
| 653 void HeapObject::IterateBodyFast(InstanceType type, int object_size, | 656 void HeapObject::IterateBodyFast(InstanceType type, int object_size, |
| 654 ObjectVisitor* v) { | 657 ObjectVisitor* v) { |
| 655 BodyDescriptorApply<CallIterateBody, void>(type, this, object_size, v); | 658 BodyDescriptorApply<CallIterateBody, void>(type, this, object_size, v); |
| 656 } | 659 } |
| 657 } // namespace internal | 660 } // namespace internal |
| 658 } // namespace v8 | 661 } // namespace v8 |
| 659 | 662 |
| 660 #endif // V8_OBJECTS_BODY_DESCRIPTORS_INL_H_ | 663 #endif // V8_OBJECTS_BODY_DESCRIPTORS_INL_H_ |
| OLD | NEW |