5 #ifndef V8_OBJECTS_BODY_DESCRIPTORS_H_ 6 #define V8_OBJECTS_BODY_DESCRIPTORS_H_ 8 #include "src/objects.h" 9 #include "src/objects/map.h" 32 template <
typename ObjectVisitor>
33 static inline void IteratePointers(
HeapObject* obj,
int start_offset,
36 template <
typename ObjectVisitor>
37 static inline void IteratePointer(
HeapObject* obj,
int offset,
40 template <
typename ObjectVisitor>
41 static inline void IterateCustomWeakPointers(
HeapObject* obj,
42 int start_offset,
int end_offset,
45 template <
typename ObjectVisitor>
46 static inline void IterateCustomWeakPointer(
HeapObject* obj,
int offset,
49 template <
typename ObjectVisitor>
50 static inline void IterateMaybeWeakPointers(
HeapObject* obj,
int start_offset,
53 template <
typename ObjectVisitor>
54 static inline void IterateMaybeWeakPointer(
HeapObject* obj,
int offset,
59 static inline bool IsValidSlotImpl(
Map map,
HeapObject* obj,
int offset);
62 template <
typename ObjectVisitor>
63 static inline void IterateBodyImpl(
Map map,
HeapObject* obj,
int start_offset,
71 template <
int start_offset,
int end_offset,
int size>
74 static const int kStartOffset = start_offset;
75 static const int kEndOffset = end_offset;
76 static const int kSize = size;
78 static bool IsValidSlot(
Map map,
HeapObject* obj,
int offset) {
79 return offset >= kStartOffset && offset < kEndOffset;
82 template <
typename ObjectVisitor>
84 IteratePointers(obj, start_offset, end_offset, v);
87 template <
typename ObjectVisitor>
88 static inline void IterateBody(
Map map,
HeapObject* obj,
int object_size,
90 IterateBody(map, obj, v);
93 static inline int SizeOf(
Map map,
HeapObject*
object) {
return kSize; }
100 template <
int start_offset>
103 static const int kStartOffset = start_offset;
105 static bool IsValidSlot(
Map map,
HeapObject* obj,
int offset) {
106 return (offset >= kStartOffset);
109 template <
typename ObjectVisitor>
110 static inline void IterateBody(
Map map,
HeapObject* obj,
int object_size,
112 IteratePointers(obj, start_offset, object_size, v);
121 template <
int start_offset>
124 static const int kStartOffset = start_offset;
126 static bool IsValidSlot(
Map map,
HeapObject* obj,
int offset) {
127 return (offset >= kStartOffset);
130 template <
typename ObjectVisitor>
131 static inline void IterateBody(
Map map,
HeapObject* obj,
int object_size,
133 IterateMaybeWeakPointers(obj, start_offset, object_size, v);
144 template <
class ParentBodyDescriptor,
class ChildBodyDescriptor>
149 STATIC_ASSERT(ParentBodyDescriptor::kSize <=
150 ChildBodyDescriptor::kStartOffset);
152 static bool IsValidSlot(
Map map,
HeapObject* obj,
int offset) {
153 return ParentBodyDescriptor::IsValidSlot(map, obj, offset) ||
154 ChildBodyDescriptor::IsValidSlot(map, obj, offset);
157 template <
typename ObjectVisitor>
159 ParentBodyDescriptor::IterateBody(map, obj, v);
160 ChildBodyDescriptor::IterateBody(map, obj, v);
163 template <
typename ObjectVisitor>
164 static inline void IterateBody(
Map map,
HeapObject* obj,
int object_size,
166 ParentBodyDescriptor::IterateBody(map, obj, object_size, v);
167 ChildBodyDescriptor::IterateBody(map, obj, object_size, v);
172 return ChildBodyDescriptor::SizeOf(map,
object);
179 #endif // V8_OBJECTS_BODY_DESCRIPTORS_H_