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,
110 void SetNativeDataProperty(
114 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
115 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
118 void SetNativeDataProperty(
122 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
123 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect) {
124 SetNativeDataProperty(
126 attribute, getter_side_effect_type, setter_side_effect_type);
133 void SetLazyDataProperty(
136 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
137 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
206 Local<Name> property,
const PropertyCallbackInfo<Value>& info);
235 Intercepted (*)(Local<Name> property, Local<Value> value,
236 const PropertyCallbackInfo<Boolean>& info);
431 uint32_t (*)(
Local<Value> value, uint32_t start_index, uint32_t end_index,
551class V8_EXPORT FunctionTemplate :
public Template {
554 static Local<FunctionTemplate> New(
555 Isolate* isolate, FunctionCallback callback =
nullptr,
556 Local<Value> data = Local<Value>(),
557 Local<Signature> signature = Local<Signature>(),
int length = 0,
558 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
559 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
560 const CFunction* c_function =
nullptr, uint16_t instance_type = 0,
561 uint16_t allowed_receiver_instance_type_range_start = 0,
562 uint16_t allowed_receiver_instance_type_range_end = 0);
565 static Local<FunctionTemplate> NewWithCFunctionOverloads(
566 Isolate* isolate, FunctionCallback callback =
nullptr,
567 Local<Value> data = Local<Value>(),
568 Local<Signature> signature = Local<Signature>(),
int length = 0,
569 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
570 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
571 const MemorySpan<const CFunction>& c_function_overloads = {});
576 static Local<FunctionTemplate> NewWithCache(
577 Isolate* isolate, FunctionCallback callback,
578 Local<Private> cache_property, Local<Value> data = Local<Value>(),
579 Local<Signature> signature = Local<Signature>(),
int length = 0,
580 SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
584 Local<Context> context);
602 FunctionCallback callback, Local<Data> data = {},
604 const MemorySpan<const CFunction>& c_function_overloads = {});
607 void SetLength(
int length);
610 Local<ObjectTemplate> InstanceTemplate();
617 void Inherit(Local<FunctionTemplate> parent);
623 Local<ObjectTemplate> PrototypeTemplate();
631 void SetPrototypeProviderTemplate(Local<FunctionTemplate> prototype_provider);
638 void SetClassName(Local<String> name);
644 void SetInterfaceName(Local<String> name);
650 void SetExceptionContext(ExceptionContext context);
656 void SetAcceptAnyReceiver(
bool value);
662 void ReadOnlyPrototype();
668 void RemovePrototype();
674 bool HasInstance(Local<Value>
object);
691 void SealAndPrepareForPromotionToReadOnly();
693 V8_INLINE static FunctionTemplate* Cast(Data* data);
698 static void CheckCast(
Data* that);
746 static_cast<int>(
flags) |
778 template <
typename TSetter =
nullptr_t,
typename TDefiner =
nullptr_t>
779 requires((std::is_same_v<TSetter, nullptr_t> ||
780 std::is_same_v<TSetter, NamedPropertySetterCallback> ||
781 std::is_same_v<TSetter, NamedPropertySetterCallbackV2>) &&
782 (std::is_same_v<TDefiner, nullptr_t> ||
783 std::is_same_v<TDefiner, NamedPropertyDefinerCallback> ||
784 std::is_same_v<TDefiner, NamedPropertyDefinerCallbackV2>))
807 template <
typename TSetter =
nullptr_t>
808 requires(std::is_same_v<TSetter, nullptr_t> ||
809 std::is_same_v<TSetter, NamedPropertySetterCallback> ||
810 std::is_same_v<TSetter, NamedPropertySetterCallbackV2>)
831 template <
typename TSetter =
nullptr_t,
typename TDefiner =
nullptr_t>
832 requires((std::is_same_v<TSetter, nullptr_t> ||
833 std::is_same_v<TSetter, NamedPropertySetterCallback> ||
834 std::is_same_v<TSetter, NamedPropertySetterCallbackV2>) &&
835 (std::is_same_v<TDefiner, nullptr_t> ||
836 std::is_same_v<TDefiner, NamedPropertyDefinerCallback> ||
837 std::is_same_v<TDefiner, NamedPropertyDefinerCallbackV2>))
873 static_cast<int>(
flags) |
905 template <
typename TSetter =
nullptr_t,
typename TDefiner =
nullptr_t>
906 requires((std::is_same_v<TSetter, nullptr_t> ||
907 std::is_same_v<TSetter, IndexedPropertySetterCallback> ||
908 std::is_same_v<TSetter, IndexedPropertySetterCallbackV2>) &&
909 (std::is_same_v<TDefiner, nullptr_t> ||
910 std::is_same_v<TDefiner, IndexedPropertyDefinerCallback> ||
911 std::is_same_v<TDefiner, IndexedPropertyDefinerCallbackV2>))
934 template <
typename TSetter =
nullptr_t>
935 requires(std::is_same_v<TSetter, nullptr_t> ||
936 std::is_same_v<TSetter, IndexedPropertySetterCallback> ||
937 std::is_same_v<TSetter, IndexedPropertySetterCallbackV2>)
958 template <
typename TSetter =
nullptr_t,
typename TDefiner =
nullptr_t>
959 requires((std::is_same_v<TSetter, nullptr_t> ||
960 std::is_same_v<TSetter, IndexedPropertySetterCallback> ||
961 std::is_same_v<TSetter, IndexedPropertySetterCallbackV2>) &&
962 (std::is_same_v<TDefiner, nullptr_t> ||
963 std::is_same_v<TDefiner, IndexedPropertyDefinerCallback> ||
964 std::is_same_v<TDefiner, IndexedPropertyDefinerCallbackV2>))
986 template <
typename TSetter =
nullptr_t,
typename TDefiner =
nullptr_t>
987 requires((std::is_same_v<TSetter, nullptr_t> ||
988 std::is_same_v<TSetter, IndexedPropertySetterCallback> ||
989 std::is_same_v<TSetter, IndexedPropertySetterCallbackV2>) &&
990 (std::is_same_v<TDefiner, nullptr_t> ||
991 std::is_same_v<TDefiner, IndexedPropertyDefinerCallback> ||
992 std::is_same_v<TDefiner, IndexedPropertyDefinerCallbackV2>))
1089 void MarkAsUndetectable();
1108 void SetAccessCheckCallbackAndHandler(
1118 int InternalFieldCount()
const;
1124 void SetInternalFieldCount(
int value);
1129 bool IsImmutableProto()
const;
1135 void SetImmutableProto();
1147 bool IsCodeLike()
const;
1155 void SealAndPrepareForPromotionToReadOnly();
1196 static void CheckCast(
Data* that);
1209class V8_EXPORT Signature :
public Data {
1220 static void CheckCast(
Data* that);
1233#ifdef V8_ENABLE_CHECKS
1240#ifdef V8_ENABLE_CHECKS
1247#ifdef V8_ENABLE_CHECKS
1254#ifdef V8_ENABLE_CHECKS
1257 return reinterpret_cast<Signature*
>(data);
Definition: v8-context.h:48
Definition: v8-template.h:1168
static DictionaryTemplate * Cast(Data *data)
Definition: v8-template.h:1245
Definition: v8-template.h:550
static FunctionTemplate * Cast(Data *data)
Definition: v8-template.h:1231
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:1032
static ObjectTemplate * Cast(Data *data)
Definition: v8-template.h:1238
Definition: v8-function-callback.h:224
Definition: v8-object.h:106
Definition: v8-container.h:148
Definition: v8-template.h:1208
static Signature * Cast(Data *data)
Definition: v8-template.h:1252
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:239
Intercepted(*)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< Boolean > &info) IndexedPropertySetterCallback
Definition: v8-template.h:377
SideEffectType
Definition: v8-object.h:231
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) NamedPropertyDescriptorCallback
Definition: v8-template.h:362
Intercepted(*)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< void > &info) IndexedPropertySetterCallbackV2
Definition: v8-template.h:380
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) NamedPropertyGetterCallback
Definition: v8-template.h:205
Intercepted(*)(Local< Name > property, const PropertyDescriptor &desc, const PropertyCallbackInfo< void > &info) NamedPropertyDefinerCallback
Definition: v8-template.h:338
IndexedPropertyDescriptorCallback IndexedPropertyDescriptorCallbackV2
Definition: v8-template.h:424
IndexedPropertyGetterCallback IndexedPropertyGetterCallbackV2
Definition: v8-template.h:370
Intercepted(*)(uint32_t index, const PropertyDescriptor &desc, const PropertyCallbackInfo< Boolean > &info) IndexedPropertyDefinerCallback
Definition: v8-template.h:412
Intrinsic
Definition: v8-template.h:41
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Boolean > &info) IndexedPropertyDeleterCallback
Definition: v8-template.h:394
void(*)(const PropertyCallbackInfo< Array > &info) NamedPropertyEnumeratorCallback
Definition: v8-template.h:304
IndexedPropertyDeleterCallback IndexedPropertyDeleterCallbackV2
Definition: v8-template.h:396
ConstructorBehavior
Definition: v8-template.h:441
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:416
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyGetterCallback
Definition: v8-template.h:368
Intercepted(*)(Local< Name > property, const PropertyDescriptor &desc, const PropertyCallbackInfo< Boolean > &info) NamedPropertyDefinerCallbackV2
Definition: v8-template.h:334
void(*)(const PropertyCallbackInfo< Array > &info) IndexedPropertyEnumeratorCallback
Definition: v8-template.h:405
IndexedPropertyQueryCallback IndexedPropertyQueryCallbackV2
Definition: v8-template.h:388
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< Boolean > &info) AccessorNameSetterCallbackV2
Definition: v8-object.h:203
Intercepted
Definition: v8-template.h:159
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Integer > &info) NamedPropertyQueryCallback
Definition: v8-template.h:268
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:431
bool(*)(Local< Context > accessing_context, Local< Object > accessed_object, Local< Value > data) AccessCheckCallback
Definition: v8-template.h:439
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Boolean > &info) NamedPropertyDeleterCallback
Definition: v8-template.h:295
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyDescriptorCallback
Definition: v8-template.h:422
Intercepted(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< Boolean > &info) NamedPropertySetterCallbackV2
Definition: v8-template.h:235
PropertyHandlerFlags
Definition: v8-template.h:706
@ kInternalNewCallbacksSignatures
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Integer > &info) IndexedPropertyQueryCallback
Definition: v8-template.h:386
Definition: v8-template.h:867
IndexedPropertyGetterCallback getter
Definition: v8-template.h:1014
IndexedPropertyDefinerCallback definer
Definition: v8-template.h:1019
PropertyHandlerFlags flags
Definition: v8-template.h:1023
IndexedPropertyDescriptorCallback descriptor
Definition: v8-template.h:1020
IndexedPropertySetterCallback setter
Definition: v8-template.h:1015
IndexedPropertyIndexOfCallback index_of
Definition: v8-template.h:1021
IndexedPropertyEnumeratorCallback enumerator
Definition: v8-template.h:1018
IndexedPropertyQueryCallback query
Definition: v8-template.h:1016
Local< Value > data
Definition: v8-template.h:1022
IndexedPropertyDeleterCallback deleter
Definition: v8-template.h:1017
Definition: v8-template.h:740
NamedPropertyDescriptorCallback descriptor
Definition: v8-template.h:862
Local< Value > data
Definition: v8-template.h:863
NamedPropertyDeleterCallback deleter
Definition: v8-template.h:859
NamedPropertyDefinerCallbackV2 definer
Definition: v8-template.h:861
NamedPropertySetterCallbackV2 setter
Definition: v8-template.h:857
NamedPropertyEnumeratorCallback enumerator
Definition: v8-template.h:860
NamedPropertyQueryCallback query
Definition: v8-template.h:858
NamedPropertyGetterCallback getter
Definition: v8-template.h:856
PropertyHandlerFlags flags
Definition: v8-template.h:864
#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