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);
111 void SetNativeDataProperty(
119 void SetNativeDataProperty(
125 SetNativeDataProperty(
127 attribute, getter_side_effect_type, setter_side_effect_type);
134 void SetLazyDataProperty(
137 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
138 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
207 Local<Name> property,
const PropertyCallbackInfo<Value>& info);
236 Intercepted (*)(Local<Name> property, Local<Value> value,
237 const PropertyCallbackInfo<Boolean>& info);
432 uint32_t (*)(
Local<Value> value, uint32_t start_index, uint32_t end_index,
552class V8_EXPORT FunctionTemplate :
public Template {
555 static Local<FunctionTemplate> New(
556 Isolate* isolate, FunctionCallback callback =
nullptr,
557 Local<Value> data = Local<Value>(),
558 Local<Signature> signature = Local<Signature>(),
int length = 0,
559 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
560 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
561 const CFunction* c_function =
nullptr, uint16_t instance_type = 0,
562 uint16_t allowed_receiver_instance_type_range_start = 0,
563 uint16_t allowed_receiver_instance_type_range_end = 0);
566 static Local<FunctionTemplate> NewWithCFunctionOverloads(
567 Isolate* isolate, FunctionCallback callback =
nullptr,
568 Local<Value> data = Local<Value>(),
569 Local<Signature> signature = Local<Signature>(),
int length = 0,
570 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
571 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
572 const MemorySpan<const CFunction>& c_function_overloads = {});
577 static Local<FunctionTemplate> NewWithCache(
578 Isolate* isolate, FunctionCallback callback,
579 Local<Private> cache_property, Local<Value> data = Local<Value>(),
580 Local<Signature> signature = Local<Signature>(),
int length = 0,
581 SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
585 Local<Context> context);
603 FunctionCallback callback, Local<Data> data = {},
605 const MemorySpan<const CFunction>& c_function_overloads = {});
608 void SetLength(
int length);
611 Local<ObjectTemplate> InstanceTemplate();
618 void Inherit(Local<FunctionTemplate> parent);
624 Local<ObjectTemplate> PrototypeTemplate();
632 void SetPrototypeProviderTemplate(Local<FunctionTemplate> prototype_provider);
639 void SetClassName(Local<String> name);
645 void SetInterfaceName(Local<String> name);
651 void SetExceptionContext(ExceptionContext context);
657 void SetAcceptAnyReceiver(
bool value);
663 void ReadOnlyPrototype();
669 void RemovePrototype();
675 bool HasInstance(Local<Value>
object);
692 void SealAndPrepareForPromotionToReadOnly();
694 V8_INLINE static FunctionTemplate* Cast(Data* data);
699 static void CheckCast(
Data* that);
747 static_cast<int>(
flags) |
781 template <
typename TSetter = std::nullptr_t,
782 typename TDefiner = std::nullptr_t>
783 requires((std::is_same_v<TSetter, std::nullptr_t> ||
784 std::is_same_v<TSetter, NamedPropertySetterCallback> ||
785 std::is_same_v<TSetter, NamedPropertySetterCallbackV2>) &&
786 (std::is_same_v<TDefiner, std::nullptr_t> ||
787 std::is_same_v<TDefiner, NamedPropertyDefinerCallback> ||
788 std::is_same_v<TDefiner, NamedPropertyDefinerCallbackV2>))
811 template <
typename TSetter = std::
nullptr_t>
812 requires(std::is_same_v<TSetter, std::nullptr_t> ||
813 std::is_same_v<TSetter, NamedPropertySetterCallback> ||
814 std::is_same_v<TSetter, NamedPropertySetterCallbackV2>)
835 template <
typename TSetter = std::nullptr_t,
836 typename TDefiner = std::nullptr_t>
837 requires((std::is_same_v<TSetter, std::nullptr_t> ||
838 std::is_same_v<TSetter, NamedPropertySetterCallback> ||
839 std::is_same_v<TSetter, NamedPropertySetterCallbackV2>) &&
840 (std::is_same_v<TDefiner, std::nullptr_t> ||
841 std::is_same_v<TDefiner, NamedPropertyDefinerCallback> ||
842 std::is_same_v<TDefiner, NamedPropertyDefinerCallbackV2>))
878 static_cast<int>(
flags) |
912 template <
typename TSetter = std::nullptr_t,
913 typename TDefiner = std::nullptr_t>
914 requires((std::is_same_v<TSetter, std::nullptr_t> ||
915 std::is_same_v<TSetter, IndexedPropertySetterCallback> ||
916 std::is_same_v<TSetter, IndexedPropertySetterCallbackV2>) &&
917 (std::is_same_v<TDefiner, std::nullptr_t> ||
918 std::is_same_v<TDefiner, IndexedPropertyDefinerCallback> ||
919 std::is_same_v<TDefiner, IndexedPropertyDefinerCallbackV2>))
942 template <
typename TSetter = std::
nullptr_t>
943 requires(std::is_same_v<TSetter, std::nullptr_t> ||
944 std::is_same_v<TSetter, IndexedPropertySetterCallback> ||
945 std::is_same_v<TSetter, IndexedPropertySetterCallbackV2>)
966 template <
typename TSetter = std::nullptr_t,
967 typename TDefiner = std::nullptr_t>
968 requires((std::is_same_v<TSetter, std::nullptr_t> ||
969 std::is_same_v<TSetter, IndexedPropertySetterCallback> ||
970 std::is_same_v<TSetter, IndexedPropertySetterCallbackV2>) &&
971 (std::is_same_v<TDefiner, std::nullptr_t> ||
972 std::is_same_v<TDefiner, IndexedPropertyDefinerCallback> ||
973 std::is_same_v<TDefiner, IndexedPropertyDefinerCallbackV2>))
995 template <
typename TSetter = std::nullptr_t,
996 typename TDefiner = std::nullptr_t>
997 requires((std::is_same_v<TSetter, std::nullptr_t> ||
998 std::is_same_v<TSetter, IndexedPropertySetterCallback> ||
999 std::is_same_v<TSetter, IndexedPropertySetterCallbackV2>) &&
1000 (std::is_same_v<TDefiner, std::nullptr_t> ||
1001 std::is_same_v<TDefiner, IndexedPropertyDefinerCallback> ||
1002 std::is_same_v<TDefiner, IndexedPropertyDefinerCallbackV2>))
1099 void MarkAsUndetectable();
1118 void SetAccessCheckCallbackAndHandler(
1128 int InternalFieldCount()
const;
1134 void SetInternalFieldCount(
int value);
1139 bool IsImmutableProto()
const;
1145 void SetImmutableProto();
1157 bool IsCodeLike()
const;
1165 void SealAndPrepareForPromotionToReadOnly();
1206 static void CheckCast(
Data* that);
1219class V8_EXPORT Signature :
public Data {
1230 static void CheckCast(
Data* that);
1243#ifdef V8_ENABLE_CHECKS
1250#ifdef V8_ENABLE_CHECKS
1257#ifdef V8_ENABLE_CHECKS
1264#ifdef V8_ENABLE_CHECKS
1267 return reinterpret_cast<Signature*
>(data);
Definition: v8-context.h:48
Definition: v8-template.h:1178
static DictionaryTemplate * Cast(Data *data)
Definition: v8-template.h:1255
Definition: v8-template.h:551
static FunctionTemplate * Cast(Data *data)
Definition: v8-template.h:1241
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-primitive.h:81
Definition: v8-template.h:1042
static ObjectTemplate * Cast(Data *data)
Definition: v8-template.h:1248
Definition: v8-function-callback.h:224
Definition: v8-object.h:106
Definition: v8-container.h:148
Definition: v8-template.h:1218
static Signature * Cast(Data *data)
Definition: v8-template.h:1262
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: v8-value.h:32
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:240
Intercepted(*)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< Boolean > &info) IndexedPropertySetterCallback
Definition: v8-template.h:378
SideEffectType
Definition: v8-object.h:231
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) NamedPropertyDescriptorCallback
Definition: v8-template.h:363
Intercepted(*)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< void > &info) IndexedPropertySetterCallbackV2
Definition: v8-template.h:381
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) NamedPropertyGetterCallback
Definition: v8-template.h:206
Intercepted(*)(Local< Name > property, const PropertyDescriptor &desc, const PropertyCallbackInfo< void > &info) NamedPropertyDefinerCallback
Definition: v8-template.h:339
IndexedPropertyDescriptorCallback IndexedPropertyDescriptorCallbackV2
Definition: v8-template.h:425
IndexedPropertyGetterCallback IndexedPropertyGetterCallbackV2
Definition: v8-template.h:371
Intercepted(*)(uint32_t index, const PropertyDescriptor &desc, const PropertyCallbackInfo< Boolean > &info) IndexedPropertyDefinerCallback
Definition: v8-template.h:413
Intrinsic
Definition: v8-template.h:41
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Boolean > &info) IndexedPropertyDeleterCallback
Definition: v8-template.h:395
void(*)(const PropertyCallbackInfo< Array > &info) NamedPropertyEnumeratorCallback
Definition: v8-template.h:305
IndexedPropertyDeleterCallback IndexedPropertyDeleterCallbackV2
Definition: v8-template.h:397
ConstructorBehavior
Definition: v8-template.h:442
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:417
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyGetterCallback
Definition: v8-template.h:369
Intercepted(*)(Local< Name > property, const PropertyDescriptor &desc, const PropertyCallbackInfo< Boolean > &info) NamedPropertyDefinerCallbackV2
Definition: v8-template.h:335
void(*)(const PropertyCallbackInfo< Array > &info) IndexedPropertyEnumeratorCallback
Definition: v8-template.h:406
IndexedPropertyQueryCallback IndexedPropertyQueryCallbackV2
Definition: v8-template.h:389
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< Boolean > &info) AccessorNameSetterCallbackV2
Definition: v8-object.h:203
Intercepted
Definition: v8-template.h:160
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Integer > &info) NamedPropertyQueryCallback
Definition: v8-template.h:269
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) AccessorNameSetterCallback
Definition: v8-object.h:207
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:432
bool(*)(Local< Context > accessing_context, Local< Object > accessed_object, Local< Value > data) AccessCheckCallback
Definition: v8-template.h:440
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Boolean > &info) NamedPropertyDeleterCallback
Definition: v8-template.h:296
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyDescriptorCallback
Definition: v8-template.h:423
Intercepted(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< Boolean > &info) NamedPropertySetterCallbackV2
Definition: v8-template.h:236
PropertyHandlerFlags
Definition: v8-template.h:707
@ kInternalNewCallbacksSignatures
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Integer > &info) IndexedPropertyQueryCallback
Definition: v8-template.h:387
Definition: v8-template.h:872
IndexedPropertyGetterCallback getter
Definition: v8-template.h:1024
IndexedPropertyDefinerCallback definer
Definition: v8-template.h:1029
PropertyHandlerFlags flags
Definition: v8-template.h:1033
IndexedPropertyDescriptorCallback descriptor
Definition: v8-template.h:1030
IndexedPropertySetterCallback setter
Definition: v8-template.h:1025
IndexedPropertyIndexOfCallback index_of
Definition: v8-template.h:1031
IndexedPropertyEnumeratorCallback enumerator
Definition: v8-template.h:1028
IndexedPropertyQueryCallback query
Definition: v8-template.h:1026
Local< Value > data
Definition: v8-template.h:1032
IndexedPropertyDeleterCallback deleter
Definition: v8-template.h:1027
Definition: v8-template.h:741
NamedPropertyDescriptorCallback descriptor
Definition: v8-template.h:867
Local< Value > data
Definition: v8-template.h:868
NamedPropertyDeleterCallback deleter
Definition: v8-template.h:864
NamedPropertyDefinerCallbackV2 definer
Definition: v8-template.h:866
NamedPropertySetterCallbackV2 setter
Definition: v8-template.h:862
NamedPropertyEnumeratorCallback enumerator
Definition: v8-template.h:865
NamedPropertyQueryCallback query
Definition: v8-template.h:863
NamedPropertyGetterCallback getter
Definition: v8-template.h:861
PropertyHandlerFlags flags
Definition: v8-template.h:869
#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_DEPRECATE_SOON(message)
Definition: v8config.h:621
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:678