Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/objects-gen.h

Issue 23604020: Initial prototype of object layout generation. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 // This file is automatically generated from 'objects.layout' and should
29 // not be modified by hand. Run 'make objects' instead to update it.
30
31 #ifndef V8_OBJECTS_GEN_H_
32 #define V8_OBJECTS_GEN_H_
33
34
35 // A simple one-element struct, useful where SMIs need to be boxed.
36 class Box : public Struct {
37 public:
38 // [value]: the boxed contents.
39 DECL_ACCESSORS(value, Object)
40
41 // Casting.
42 static inline Box* cast(Object* object);
43
44 // Dispatched behavior.
45 DECLARE_PRINTER(Box)
46 DECLARE_VERIFIER(Box)
47
48 // Layout description.
49 static const int kValueOffset = Struct::kHeaderSize;
50 static const int kSize = kValueOffset + kPointerSize;
51
52 private:
53 DISALLOW_IMPLICIT_CONSTRUCTORS(Box);
54 };
55
56
57 /*bool Object::IsBox() {
58 return Object::IsHeapObject() &&
59 HeapObject::cast(this)->map()->instance_type() == BOX_TYPE;
60 }*/
61
62
63 /*Box* Box::cast(Object* object) {
64 ASSERT(object->IsBox());
65 return reinterpret_cast<Box*>(object);
66 }*/
67
68
69 // Representation of a slow alias as part of a non-strict arguments objects.
70 // For fast aliases (if HasNonStrictArgumentsElements()):
71 // - the parameter map contains an index into the context
72 // - all attributes of the element have default values
73 // For slow aliases (if HasDictionaryArgumentsElements()):
74 // - the parameter map contains no fast alias mapping (i.e. the hole)
75 // - this struct (in the slow backing store) contains an index into the context
76 // - all attributes are available as part if the property details
77 class AliasedArgumentsEntry : public Struct {
78 public:
79 inline int aliased_context_slot();
80 inline void set_aliased_context_slot(int value);
81
82 // Casting.
83 static inline AliasedArgumentsEntry* cast(Object* object);
84
85 // Dispatched behavior.
86 DECLARE_PRINTER(AliasedArgumentsEntry)
87 DECLARE_VERIFIER(AliasedArgumentsEntry)
88
89 // Layout description.
90 static const int kAliasedContextSlotOffset = Struct::kHeaderSize;
91 static const int kSize = kAliasedContextSlotOffset + kPointerSize;
92
93 private:
94 DISALLOW_IMPLICIT_CONSTRUCTORS(AliasedArgumentsEntry);
95 };
96
97
98 /*bool Object::IsAliasedArgumentsEntry() {
99 return Object::IsHeapObject() &&
100 HeapObject::cast(this)->map()->instance_type() == ALIASED_ARGUMENTS_ENTRY_ TYPE;
101 }*/
102
103
104 /*AliasedArgumentsEntry* AliasedArgumentsEntry::cast(Object* object) {
105 ASSERT(object->IsAliasedArgumentsEntry());
106 return reinterpret_cast<AliasedArgumentsEntry*>(object);
107 }*/
108
109
110 // DeclaredAccessorInfo is a AccessorInfo.
111 class DeclaredAccessorInfo : public AccessorInfo {
112 public:
113 DECL_ACCESSORS(descriptor, DeclaredAccessorDescriptor)
114
115 // Casting.
116 static inline DeclaredAccessorInfo* cast(Object* object);
117
118 // Dispatched behavior.
119 DECLARE_PRINTER(DeclaredAccessorInfo)
120 DECLARE_VERIFIER(DeclaredAccessorInfo)
121
122 // Layout description.
123 static const int kDescriptorOffset = AccessorInfo::kHeaderSize;
124 static const int kSize = kDescriptorOffset + kPointerSize;
125
126 private:
127 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorInfo);
128 };
129
130
131 /*bool Object::IsDeclaredAccessorInfo() {
132 return Object::IsHeapObject() &&
133 HeapObject::cast(this)->map()->instance_type() == DECLARED_ACCESSOR_INFO_T YPE;
134 }*/
135
136
137 /*DeclaredAccessorInfo* DeclaredAccessorInfo::cast(Object* object) {
138 ASSERT(object->IsDeclaredAccessorInfo());
139 return reinterpret_cast<DeclaredAccessorInfo*>(object);
140 }*/
141
142
143 // An accessor must have a getter, but can have no setter.
144 //
145 // When setting a property, V8 searches accessors in prototypes.
146 // If an accessor was found and it does not have a setter,
147 // the request is ignored.
148 //
149 // If the accessor in the prototype has the READ_ONLY property attribute, then
150 // a new value is added to the local object when the property is set.
151 // This shadows the accessor in the prototype.
152 class ExecutableAccessorInfo : public AccessorInfo {
153 public:
154 DECL_ACCESSORS(getter, Object)
155 DECL_ACCESSORS(setter, Object)
156 DECL_ACCESSORS(data, Object)
157
158 // Casting.
159 static inline ExecutableAccessorInfo* cast(Object* object);
160
161 // Dispatched behavior.
162 DECLARE_PRINTER(ExecutableAccessorInfo)
163 DECLARE_VERIFIER(ExecutableAccessorInfo)
164
165 // Layout description.
166 static const int kGetterOffset = AccessorInfo::kHeaderSize;
167 static const int kSetterOffset = kGetterOffset + kPointerSize;
168 static const int kDataOffset = kSetterOffset + kPointerSize;
169 static const int kSize = kDataOffset + kPointerSize;
170
171 private:
172 DISALLOW_IMPLICIT_CONSTRUCTORS(ExecutableAccessorInfo);
173 };
174
175
176 /*bool Object::IsExecutableAccessorInfo() {
177 return Object::IsHeapObject() &&
178 HeapObject::cast(this)->map()->instance_type() == EXECUTABLE_ACCESSOR_INFO _TYPE;
179 }*/
180
181
182 /*ExecutableAccessorInfo* ExecutableAccessorInfo::cast(Object* object) {
183 ASSERT(object->IsExecutableAccessorInfo());
184 return reinterpret_cast<ExecutableAccessorInfo*>(object);
185 }*/
186
187
188 // FunctionTemplateInfo is a TemplateInfo.
189 class FunctionTemplateInfo : public TemplateInfo {
190 public:
191 DECL_ACCESSORS(serial_number, Object)
192 DECL_ACCESSORS(call_code, Object)
193 DECL_ACCESSORS(property_accessors, Object)
194 DECL_ACCESSORS(prototype_template, Object)
195 DECL_ACCESSORS(parent_template, Object)
196 DECL_ACCESSORS(named_property_handler, Object)
197 DECL_ACCESSORS(indexed_property_handler, Object)
198 DECL_ACCESSORS(instance_template, Object)
199 DECL_ACCESSORS(class_name, Object)
200 DECL_ACCESSORS(signature, Object)
201 DECL_ACCESSORS(instance_call_handler, Object)
202 DECL_ACCESSORS(access_check_info, Object)
203 inline int flag();
204 inline void set_flag(int value);
205 inline int length();
206 inline void set_length(int value);
207
208 // Following fields are encoded within the 'flag' field.
209 DECL_BOOLEAN_ACCESSORS(hidden_prototype)
210 DECL_BOOLEAN_ACCESSORS(undetectable)
211 DECL_BOOLEAN_ACCESSORS(needs_access_check)
212 DECL_BOOLEAN_ACCESSORS(read_only_prototype)
213 DECL_BOOLEAN_ACCESSORS(remove_prototype)
214
215 // Casting.
216 static inline FunctionTemplateInfo* cast(Object* object);
217
218 // Dispatched behavior.
219 DECLARE_PRINTER(FunctionTemplateInfo)
220 DECLARE_VERIFIER(FunctionTemplateInfo)
221
222 // Layout description.
223 static const int kSerialNumberOffset = TemplateInfo::kHeaderSize;
224 static const int kCallCodeOffset = kSerialNumberOffset + kPointerSize;
225 static const int kPropertyAccessorsOffset = kCallCodeOffset + kPointerSize;
226 static const int kPrototypeTemplateOffset = kPropertyAccessorsOffset + kPointe rSize;
227 static const int kParentTemplateOffset = kPrototypeTemplateOffset + kPointerSi ze;
228 static const int kNamedPropertyHandlerOffset = kParentTemplateOffset + kPointe rSize;
229 static const int kIndexedPropertyHandlerOffset = kNamedPropertyHandlerOffset + kPointerSize;
230 static const int kInstanceTemplateOffset = kIndexedPropertyHandlerOffset + kPo interSize;
231 static const int kClassNameOffset = kInstanceTemplateOffset + kPointerSize;
232 static const int kSignatureOffset = kClassNameOffset + kPointerSize;
233 static const int kInstanceCallHandlerOffset = kSignatureOffset + kPointerSize;
234 static const int kAccessCheckInfoOffset = kInstanceCallHandlerOffset + kPointe rSize;
235 static const int kFlagOffset = kAccessCheckInfoOffset + kPointerSize;
236 static const int kLengthOffset = kFlagOffset + kPointerSize;
237 static const int kSize = kLengthOffset + kPointerSize;
238
239 private:
240 // Bit positions within the 'flag' field.
241 static const int kHiddenPrototypeBit = 0;
242 static const int kUndetectableBit = 1;
243 static const int kNeedsAccessCheckBit = 2;
244 static const int kReadOnlyPrototypeBit = 3;
245 static const int kRemovePrototypeBit = 4;
246
247 DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo);
248 };
249
250
251 /*bool Object::IsFunctionTemplateInfo() {
252 return Object::IsHeapObject() &&
253 HeapObject::cast(this)->map()->instance_type() == FUNCTION_TEMPLATE_INFO_T YPE;
254 }*/
255
256
257 /*FunctionTemplateInfo* FunctionTemplateInfo::cast(Object* object) {
258 ASSERT(object->IsFunctionTemplateInfo());
259 return reinterpret_cast<FunctionTemplateInfo*>(object);
260 }*/
261
262
263 // ObjectTemplateInfo is a TemplateInfo.
264 class ObjectTemplateInfo : public TemplateInfo {
265 public:
266 DECL_ACCESSORS(constructor, Object)
267 DECL_ACCESSORS(internal_field_count, Object)
268
269 // Casting.
270 static inline ObjectTemplateInfo* cast(Object* object);
271
272 // Dispatched behavior.
273 DECLARE_PRINTER(ObjectTemplateInfo)
274 DECLARE_VERIFIER(ObjectTemplateInfo)
275
276 // Layout description.
277 static const int kConstructorOffset = TemplateInfo::kHeaderSize;
278 static const int kInternalFieldCountOffset = kConstructorOffset + kPointerSize ;
279 static const int kSize = kInternalFieldCountOffset + kPointerSize;
280
281 private:
282 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectTemplateInfo);
283 };
284
285
286 /*bool Object::IsObjectTemplateInfo() {
287 return Object::IsHeapObject() &&
288 HeapObject::cast(this)->map()->instance_type() == OBJECT_TEMPLATE_INFO_TYP E;
289 }*/
290
291
292 /*ObjectTemplateInfo* ObjectTemplateInfo::cast(Object* object) {
293 ASSERT(object->IsObjectTemplateInfo());
294 return reinterpret_cast<ObjectTemplateInfo*>(object);
295 }*/
296
297
298 // SignatureInfo is a Struct.
299 class SignatureInfo : public Struct {
300 public:
301 DECL_ACCESSORS(receiver, Object)
302 DECL_ACCESSORS(args, Object)
303
304 // Casting.
305 static inline SignatureInfo* cast(Object* object);
306
307 // Dispatched behavior.
308 DECLARE_PRINTER(SignatureInfo)
309 DECLARE_VERIFIER(SignatureInfo)
310
311 // Layout description.
312 static const int kReceiverOffset = Struct::kHeaderSize;
313 static const int kArgsOffset = kReceiverOffset + kPointerSize;
314 static const int kSize = kArgsOffset + kPointerSize;
315
316 private:
317 DISALLOW_IMPLICIT_CONSTRUCTORS(SignatureInfo);
318 };
319
320
321 /*bool Object::IsSignatureInfo() {
322 return Object::IsHeapObject() &&
323 HeapObject::cast(this)->map()->instance_type() == SIGNATURE_INFO_TYPE;
324 }*/
325
326
327 /*SignatureInfo* SignatureInfo::cast(Object* object) {
328 ASSERT(object->IsSignatureInfo());
329 return reinterpret_cast<SignatureInfo*>(object);
330 }*/
331
332
333 // TypeSwitchInfo is a Struct.
334 class TypeSwitchInfo : public Struct {
335 public:
336 DECL_ACCESSORS(types, Object)
337
338 // Casting.
339 static inline TypeSwitchInfo* cast(Object* object);
340
341 // Dispatched behavior.
342 DECLARE_PRINTER(TypeSwitchInfo)
343 DECLARE_VERIFIER(TypeSwitchInfo)
344
345 // Layout description.
346 static const int kTypesOffset = Struct::kHeaderSize;
347 static const int kSize = kTypesOffset + kPointerSize;
348
349 private:
350 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeSwitchInfo);
351 };
352
353
354 /*bool Object::IsTypeSwitchInfo() {
355 return Object::IsHeapObject() &&
356 HeapObject::cast(this)->map()->instance_type() == TYPE_SWITCH_INFO_TYPE;
357 }*/
358
359
360 /*TypeSwitchInfo* TypeSwitchInfo::cast(Object* object) {
361 ASSERT(object->IsTypeSwitchInfo());
362 return reinterpret_cast<TypeSwitchInfo*>(object);
363 }*/
364
365
366 #endif // V8_OBJECTS_GEN_H_
OLDNEW
« src/objects.layout ('K') | « src/objects-debug.cc ('k') | src/objects-gen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698