5 #ifndef V8_OBJECTS_TEMPLATES_H_ 6 #define V8_OBJECTS_TEMPLATES_H_ 8 #include "src/objects.h" 11 #include "src/objects/object-macros.h" 18 DECL_ACCESSORS(tag,
Object)
19 DECL_ACCESSORS(serial_number,
Object)
20 DECL_INT_ACCESSORS(number_of_properties)
21 DECL_ACCESSORS(property_list,
Object)
22 DECL_ACCESSORS(property_accessors,
Object)
29 #define TEMPLATE_INFO_FIELDS(V) \ 30 V(kTagOffset, kTaggedSize) \ 31 V(kSerialNumberOffset, kTaggedSize) \ 32 V(kNumberOfProperties, kTaggedSize) \ 33 V(kPropertyListOffset, kTaggedSize) \ 34 V(kPropertyAccessorsOffset, kTaggedSize) \ 38 DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, TEMPLATE_INFO_FIELDS)
39 #undef TEMPLATE_INFO_FIELDS 41 static const int kFastTemplateInstantiationsCacheSize = 1 * KB;
46 static const int kSlowTemplateInstantiationsCacheSize = 1 * MB;
56 DECL_ACCESSORS(prototype_template,
Object)
57 DECL_ACCESSORS(prototype_provider_template,
Object)
58 DECL_ACCESSORS(parent_template,
Object)
59 DECL_ACCESSORS(named_property_handler,
Object)
60 DECL_ACCESSORS(indexed_property_handler,
Object)
61 DECL_ACCESSORS(instance_template,
Object)
62 DECL_ACCESSORS(instance_call_handler,
Object)
63 DECL_ACCESSORS(access_check_info,
Object)
72 #define SYMBOL_FIELDS(V) \ 73 V(kPrototypeTemplateOffset, kTaggedSize) \ 74 V(kPrototypeProviderTemplateOffset, kTaggedSize) \ 75 V(kParentTemplateOffset, kTaggedSize) \ 76 V(kNamedPropertyHandlerOffset, kTaggedSize) \ 77 V(kIndexedPropertyHandlerOffset, kTaggedSize) \ 78 V(kInstanceTemplateOffset, kTaggedSize) \ 79 V(kInstanceCallHandlerOffset, kTaggedSize) \ 80 V(kAccessCheckInfoOffset, kTaggedSize) \ 84 DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, SYMBOL_FIELDS)
96 DECL_ACCESSORS(call_code,
Object)
98 DECL_ACCESSORS(class_name,
Object)
104 DECL_ACCESSORS(signature,
Object)
111 #define DECL_RARE_ACCESSORS(Name, CamelName, Type) \ 112 inline Type* Get##CamelName(); \ 113 static inline void Set##CamelName( \ 114 Isolate* isolate, Handle<FunctionTemplateInfo> function_template_info, \ 119 DECL_RARE_ACCESSORS(prototype_template, PrototypeTemplate,
Object)
124 DECL_RARE_ACCESSORS(prototype_provider_template, PrototypeProviderTemplate,
130 DECL_RARE_ACCESSORS(parent_template, ParentTemplate,
Object)
133 DECL_RARE_ACCESSORS(named_property_handler, NamedPropertyHandler,
Object)
135 DECL_RARE_ACCESSORS(indexed_property_handler, IndexedPropertyHandler,
Object)
141 DECL_RARE_ACCESSORS(instance_template, InstanceTemplate,
Object)
146 DECL_RARE_ACCESSORS(instance_call_handler, InstanceCallHandler,
Object)
149 #undef DECL_RARE_ACCESSORS 151 DECL_ACCESSORS(shared_function_info,
Object)
154 DECL_INT_ACCESSORS(flag)
157 DECL_INT_ACCESSORS(length)
162 DECL_ACCESSORS(cached_property_name,
Object)
165 DECL_BOOLEAN_ACCESSORS(hidden_prototype)
166 DECL_BOOLEAN_ACCESSORS(undetectable)
170 DECL_BOOLEAN_ACCESSORS(needs_access_check)
172 DECL_BOOLEAN_ACCESSORS(read_only_prototype)
177 DECL_BOOLEAN_ACCESSORS(remove_prototype)
181 DECL_BOOLEAN_ACCESSORS(do_not_cache)
184 DECL_BOOLEAN_ACCESSORS(accept_any_receiver)
193 static const int kInvalidSerialNumber = 0;
196 #define FUNCTION_TEMPLATE_INFO_FIELDS(V) \ 197 V(kCallCodeOffset, kTaggedSize) \ 198 V(kClassNameOffset, kTaggedSize) \ 199 V(kSignatureOffset, kTaggedSize) \ 200 V(kFunctionTemplateRareDataOffset, kTaggedSize) \ 201 V(kSharedFunctionInfoOffset, kTaggedSize) \ 202 V(kFlagOffset, kTaggedSize) \ 203 V(kLengthOffset, kTaggedSize) \ 204 V(kCachedPropertyNameOffset, kTaggedSize) \ 208 DEFINE_FIELD_OFFSET_CONSTANTS(TemplateInfo::kHeaderSize,
209 FUNCTION_TEMPLATE_INFO_FIELDS)
210 #undef FUNCTION_TEMPLATE_INFO_FIELDS 218 inline bool IsTemplateFor(
JSObject*
object);
219 bool IsTemplateFor(
Map map);
220 inline bool instantiated();
222 inline bool BreakAtEntry();
236 static const int kHiddenPrototypeBit = 0;
237 static const int kUndetectableBit = 1;
238 static const int kNeedsAccessCheckBit = 2;
239 static const int kReadOnlyPrototypeBit = 3;
240 static const int kRemovePrototypeBit = 4;
241 static const int kDoNotCacheBit = 5;
242 static const int kAcceptAnyReceiver = 6;
249 DECL_ACCESSORS(constructor,
Object)
250 DECL_ACCESSORS(data,
Object)
251 DECL_INT_ACCESSORS(embedder_field_count)
252 DECL_BOOLEAN_ACCESSORS(immutable_proto)
261 #define OBJECT_TEMPLATE_INFO_FIELDS(V) \ 262 V(kConstructorOffset, kTaggedSize) \ 264 V(kDataOffset, kTaggedSize) \ 268 DEFINE_FIELD_OFFSET_CONSTANTS(TemplateInfo::kHeaderSize,
269 OBJECT_TEMPLATE_INFO_FIELDS)
270 #undef OBJECT_TEMPLATE_INFO_FIELDS 277 class IsImmutablePrototype :
public BitField<bool, 0, 1> {};
278 class EmbedderFieldCount
279 :
public BitField<int, IsImmutablePrototype::kNext, 29> {};
285 #include "src/objects/object-macros-undef.h" 287 #endif // V8_OBJECTS_TEMPLATES_H_