5#ifndef INCLUDE_V8_TEMPLATE_H_
6#define INCLUDE_V8_TEMPLATE_H_
22class FunctionTemplate;
28#define V8_INTRINSICS_LIST(F) \
29 F(ArrayProto_entries, array_entries_iterator) \
30 F(ArrayProto_forEach, array_for_each_iterator) \
31 F(ArrayProto_keys, array_keys_iterator) \
32 F(ArrayProto_values, array_values_iterator) \
33 F(ArrayPrototype, initial_array_prototype) \
34 F(AsyncIteratorPrototype, initial_async_iterator_prototype) \
35 F(ErrorPrototype, initial_error_prototype) \
36 F(IteratorPrototype, initial_iterator_prototype) \
37 F(MapIteratorPrototype, initial_map_iterator_prototype) \
38 F(ObjProto_valueOf, object_value_of_function) \
39 F(SetIteratorPrototype, initial_set_iterator_prototype)
42#define V8_DECL_INTRINSIC(name, iname) k##name,
44#undef V8_DECL_INTRINSIC
57 void Set(Local<Name> name, Local<Data> value,
78 void SetAccessorProperty(
104 void SetNativeDataProperty(
108 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
109 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
115 void SetLazyDataProperty(
118 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
119 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
188 Local<Name> property,
const PropertyCallbackInfo<Value>& info);
217 Intercepted (*)(Local<Name> property, Local<Value> value,
218 const PropertyCallbackInfo<void>& info);
247 Local<Name> property,
const PropertyCallbackInfo<Integer>& info);
274 Local<Name> property,
const PropertyCallbackInfo<Boolean>& info);
283 void (*)(
const PropertyCallbackInfo<Array>& info);
312 Intercepted (*)(Local<Name> property,
const PropertyDescriptor& desc,
313 const PropertyCallbackInfo<void>& info);
337 Local<Name> property,
const PropertyCallbackInfo<Value>& info);
347 Intercepted (*)(uint32_t index,
const PropertyCallbackInfo<Value>& info);
353 uint32_t index, Local<Value> value,
const PropertyCallbackInfo<void>& info);
359 Intercepted (*)(uint32_t index,
const PropertyCallbackInfo<Integer>& info);
365 Intercepted (*)(uint32_t index,
const PropertyCallbackInfo<Boolean>& info);
374 void (*)(
const PropertyCallbackInfo<Array>& info);
380 Intercepted (*)(uint32_t index,
const PropertyDescriptor& desc,
381 const PropertyCallbackInfo<void>& info);
387 Intercepted (*)(uint32_t index,
const PropertyCallbackInfo<Value>& info);
393 uint32_t (*)(Local<Value> value, uint32_t start_index, uint32_t end_index,
394 uint32_t* out_length,
const PropertyCallbackInfo<void>& info);
401 Local<Object> accessed_object,
513class V8_EXPORT FunctionTemplate :
public Template {
516 static Local<FunctionTemplate> New(
517 Isolate* isolate, FunctionCallback callback =
nullptr,
518 Local<Value> data = Local<Value>(),
519 Local<Signature> signature = Local<Signature>(),
int length = 0,
520 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
521 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
522 const CFunction* c_function =
nullptr, uint16_t instance_type = 0,
523 uint16_t allowed_receiver_instance_type_range_start = 0,
524 uint16_t allowed_receiver_instance_type_range_end = 0);
527 static Local<FunctionTemplate> NewWithCFunctionOverloads(
528 Isolate* isolate, FunctionCallback callback =
nullptr,
529 Local<Value> data = Local<Value>(),
530 Local<Signature> signature = Local<Signature>(),
int length = 0,
531 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
532 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
533 const MemorySpan<const CFunction>& c_function_overloads = {});
538 static Local<FunctionTemplate> NewWithCache(
539 Isolate* isolate, FunctionCallback callback,
540 Local<Private> cache_property, Local<Value> data = Local<Value>(),
541 Local<Signature> signature = Local<Signature>(),
int length = 0,
542 SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
546 Local<Context> context);
564 FunctionCallback callback, Local<Data> data = {},
566 const MemorySpan<const CFunction>& c_function_overloads = {});
569 void SetLength(
int length);
572 Local<ObjectTemplate> InstanceTemplate();
579 void Inherit(Local<FunctionTemplate> parent);
585 Local<ObjectTemplate> PrototypeTemplate();
593 void SetPrototypeProviderTemplate(Local<FunctionTemplate> prototype_provider);
600 void SetClassName(Local<String> name);
606 void SetInterfaceName(Local<String> name);
612 void SetExceptionContext(ExceptionContext context);
618 void SetAcceptAnyReceiver(
bool value);
624 void ReadOnlyPrototype();
630 void RemovePrototype();
636 bool HasInstance(Local<Value>
object);
653 void SealAndPrepareForPromotionToReadOnly();
655 V8_INLINE static FunctionTemplate* Cast(Data* data);
660 static void CheckCast(
Data* that);
708 static_cast<int>(
flags) |
787 static_cast<int>(
flags) |
946 void MarkAsUndetectable();
965 void SetAccessCheckCallbackAndHandler(
975 int InternalFieldCount()
const;
981 void SetInternalFieldCount(
int value);
986 bool IsImmutableProto()
const;
992 void SetImmutableProto();
1004 bool IsCodeLike()
const;
1012 void SealAndPrepareForPromotionToReadOnly();
1053 static void CheckCast(
Data* that);
1066class V8_EXPORT Signature :
public Data {
1077 static void CheckCast(
Data* that);
1090#ifdef V8_ENABLE_CHECKS
1097#ifdef V8_ENABLE_CHECKS
1104#ifdef V8_ENABLE_CHECKS
1111#ifdef V8_ENABLE_CHECKS
1114 return reinterpret_cast<Signature*
>(data);
Definition: v8-context.h:48
Definition: v8-template.h:1025
static DictionaryTemplate * Cast(Data *data)
Definition: v8-template.h:1102
Definition: v8-template.h:512
static FunctionTemplate * Cast(Data *data)
Definition: v8-template.h:1088
Definition: v8-isolate.h:291
Definition: v8-local-handle.h:366
Definition: v8-local-handle.h:734
Definition: v8-memory-span.h:48
Definition: v8-template.h:889
static ObjectTemplate * Cast(Data *data)
Definition: v8-template.h:1095
Definition: v8-container.h:148
Definition: v8-template.h:1065
static Signature * Cast(Data *data)
Definition: v8-template.h:1109
static MaybeLocal< String > NewFromUtf8(Isolate *isolate, const char *data, NewStringType type=NewStringType::kNormal, int length=-1)
Definition: v8-template.h:49
void Set(Local< Name > name, Local< Data > value, PropertyAttribute attributes=None)
Definition: libplatform.h:15
PropertyAttribute
Definition: v8-object.h:154
void(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) AccessorNameGetterCallback
Definition: v8-object.h:180
Intercepted(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) NamedPropertySetterCallback
Definition: v8-template.h:217
SideEffectType
Definition: v8-object.h:227
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) NamedPropertyDescriptorCallback
Definition: v8-template.h:336
Intercepted(*)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< void > &info) IndexedPropertySetterCallbackV2
Definition: v8-template.h:352
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) NamedPropertyGetterCallback
Definition: v8-template.h:187
Intercepted(*)(Local< Name > property, const PropertyDescriptor &desc, const PropertyCallbackInfo< void > &info) NamedPropertyDefinerCallback
Definition: v8-template.h:312
Intrinsic
Definition: v8-template.h:41
void(*)(const PropertyCallbackInfo< Array > &info) NamedPropertyEnumeratorCallback
Definition: v8-template.h:282
ConstructorBehavior
Definition: v8-template.h:403
void(*)(const FunctionCallbackInfo< Value > &info) FunctionCallback
Definition: v8-function-callback.h:354
Intercepted(*)(uint32_t index, const PropertyDescriptor &desc, const PropertyCallbackInfo< void > &info) IndexedPropertyDefinerCallbackV2
Definition: v8-template.h:380
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Boolean > &info) IndexedPropertyDeleterCallbackV2
Definition: v8-template.h:364
void(*)(const PropertyCallbackInfo< Array > &info) IndexedPropertyEnumeratorCallback
Definition: v8-template.h:373
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyDescriptorCallbackV2
Definition: v8-template.h:386
Intercepted
Definition: v8-template.h:141
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Integer > &info) NamedPropertyQueryCallback
Definition: v8-template.h:246
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) AccessorNameSetterCallback
Definition: v8-object.h:203
uint32_t(*)(Local< Value > value, uint32_t start_index, uint32_t end_index, uint32_t *out_length, const PropertyCallbackInfo< void > &info) IndexedPropertyIndexOfCallback
Definition: v8-template.h:393
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyGetterCallbackV2
Definition: v8-template.h:346
bool(*)(Local< Context > accessing_context, Local< Object > accessed_object, Local< Value > data) AccessCheckCallback
Definition: v8-template.h:401
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Boolean > &info) NamedPropertyDeleterCallback
Definition: v8-template.h:273
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Integer > &info) IndexedPropertyQueryCallbackV2
Definition: v8-template.h:358
PropertyHandlerFlags
Definition: v8-template.h:668
@ kInternalNewCallbacksSignatures
Definition: v8-template.h:781
PropertyHandlerFlags flags
Definition: v8-template.h:880
IndexedPropertyQueryCallbackV2 query
Definition: v8-template.h:873
IndexedPropertyIndexOfCallback index_of
Definition: v8-template.h:878
IndexedPropertyDeleterCallbackV2 deleter
Definition: v8-template.h:874
IndexedPropertyGetterCallbackV2 getter
Definition: v8-template.h:871
IndexedPropertyEnumeratorCallback enumerator
Definition: v8-template.h:875
Local< Value > data
Definition: v8-template.h:879
IndexedPropertyDescriptorCallbackV2 descriptor
Definition: v8-template.h:877
IndexedPropertySetterCallbackV2 setter
Definition: v8-template.h:872
IndexedPropertyDefinerCallbackV2 definer
Definition: v8-template.h:876
Definition: v8-template.h:702
NamedPropertyDescriptorCallback descriptor
Definition: v8-template.h:776
Local< Value > data
Definition: v8-template.h:777
NamedPropertySetterCallback setter
Definition: v8-template.h:771
NamedPropertyDeleterCallback deleter
Definition: v8-template.h:773
NamedPropertyEnumeratorCallback enumerator
Definition: v8-template.h:774
NamedPropertyQueryCallback query
Definition: v8-template.h:772
NamedPropertyGetterCallback getter
Definition: v8-template.h:770
NamedPropertyDefinerCallback definer
Definition: v8-template.h:775
PropertyHandlerFlags flags
Definition: v8-template.h:778
#define V8_INTRINSICS_LIST(F)
Definition: v8-template.h:28
#define V8_DECL_INTRINSIC(name, iname)
Definition: v8-template.h:42
#define V8_EXPORT
Definition: v8config.h:854
#define V8_INLINE
Definition: v8config.h:508
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:678