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);
394 Local<Object> accessed_object,
506class V8_EXPORT FunctionTemplate :
public Template {
509 static Local<FunctionTemplate> New(
510 Isolate* isolate, FunctionCallback callback =
nullptr,
511 Local<Value> data = Local<Value>(),
512 Local<Signature> signature = Local<Signature>(),
int length = 0,
513 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
514 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
515 const CFunction* c_function =
nullptr, uint16_t instance_type = 0,
516 uint16_t allowed_receiver_instance_type_range_start = 0,
517 uint16_t allowed_receiver_instance_type_range_end = 0);
520 static Local<FunctionTemplate> NewWithCFunctionOverloads(
521 Isolate* isolate, FunctionCallback callback =
nullptr,
522 Local<Value> data = Local<Value>(),
523 Local<Signature> signature = Local<Signature>(),
int length = 0,
524 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
525 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
526 const MemorySpan<const CFunction>& c_function_overloads = {});
531 static Local<FunctionTemplate> NewWithCache(
532 Isolate* isolate, FunctionCallback callback,
533 Local<Private> cache_property, Local<Value> data = Local<Value>(),
534 Local<Signature> signature = Local<Signature>(),
int length = 0,
535 SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
539 Local<Context> context);
557 FunctionCallback callback, Local<Data> data = {},
559 const MemorySpan<const CFunction>& c_function_overloads = {});
562 void SetLength(
int length);
565 Local<ObjectTemplate> InstanceTemplate();
572 void Inherit(Local<FunctionTemplate> parent);
578 Local<ObjectTemplate> PrototypeTemplate();
586 void SetPrototypeProviderTemplate(Local<FunctionTemplate> prototype_provider);
593 void SetClassName(Local<String> name);
599 void SetInterfaceName(Local<String> name);
605 void SetExceptionContext(ExceptionContext context);
611 void SetAcceptAnyReceiver(
bool value);
617 void ReadOnlyPrototype();
623 void RemovePrototype();
629 bool HasInstance(Local<Value>
object);
646 void SealAndPrepareForPromotionToReadOnly();
648 V8_INLINE static FunctionTemplate* Cast(Data* data);
653 static void CheckCast(
Data* that);
701 static_cast<int>(
flags) |
780 static_cast<int>(
flags) |
916 void MarkAsUndetectable();
935 void SetAccessCheckCallbackAndHandler(
945 int InternalFieldCount()
const;
951 void SetInternalFieldCount(
int value);
956 bool IsImmutableProto()
const;
962 void SetImmutableProto();
974 bool IsCodeLike()
const;
982 void SealAndPrepareForPromotionToReadOnly();
989 static void CheckCast(
Data* that);
1023 static void CheckCast(
Data* that);
1036class V8_EXPORT Signature :
public Data {
1047 static void CheckCast(
Data* that);
1060#ifdef V8_ENABLE_CHECKS
1067#ifdef V8_ENABLE_CHECKS
1074#ifdef V8_ENABLE_CHECKS
1081#ifdef V8_ENABLE_CHECKS
1084 return reinterpret_cast<Signature*
>(data);
Definition: v8-context.h:48
Definition: v8-template.h:995
static DictionaryTemplate * Cast(Data *data)
Definition: v8-template.h:1072
Definition: v8-template.h:505
static FunctionTemplate * Cast(Data *data)
Definition: v8-template.h:1058
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:859
static ObjectTemplate * Cast(Data *data)
Definition: v8-template.h:1065
Definition: v8-container.h:148
Definition: v8-template.h:1035
static Signature * Cast(Data *data)
Definition: v8-template.h:1079
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:396
void(*)(const FunctionCallbackInfo< Value > &info) FunctionCallback
Definition: v8-function-callback.h:352
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
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:394
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:661
@ kInternalNewCallbacksSignatures
Definition: v8-template.h:774
PropertyHandlerFlags flags
Definition: v8-template.h:850
IndexedPropertyQueryCallbackV2 query
Definition: v8-template.h:844
IndexedPropertyDeleterCallbackV2 deleter
Definition: v8-template.h:845
IndexedPropertyGetterCallbackV2 getter
Definition: v8-template.h:842
IndexedPropertyEnumeratorCallback enumerator
Definition: v8-template.h:846
Local< Value > data
Definition: v8-template.h:849
IndexedPropertyDescriptorCallbackV2 descriptor
Definition: v8-template.h:848
IndexedPropertySetterCallbackV2 setter
Definition: v8-template.h:843
IndexedPropertyDefinerCallbackV2 definer
Definition: v8-template.h:847
Definition: v8-template.h:695
NamedPropertyDescriptorCallback descriptor
Definition: v8-template.h:769
Local< Value > data
Definition: v8-template.h:770
NamedPropertySetterCallback setter
Definition: v8-template.h:764
NamedPropertyDeleterCallback deleter
Definition: v8-template.h:766
NamedPropertyEnumeratorCallback enumerator
Definition: v8-template.h:767
NamedPropertyQueryCallback query
Definition: v8-template.h:765
NamedPropertyGetterCallback getter
Definition: v8-template.h:763
NamedPropertyDefinerCallback definer
Definition: v8-template.h:768
PropertyHandlerFlags flags
Definition: v8-template.h:771
#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