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<Boolean>& info);
426 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 std::span<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 std::span<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);
754 static_cast<int>(
flags) |
833 static_cast<int>(
flags) |
897 "Use IndexedPropertyHandlerConfiguration with iterable_to_list")
1020 void MarkAsUndetectable();
1039 void SetAccessCheckCallbackAndHandler(
1049 int InternalFieldCount()
const;
1055 void SetInternalFieldCount(
int value);
1060 bool IsImmutableProto()
const;
1066 void SetImmutableProto();
1078 bool IsCodeLike()
const;
1086 void SealAndPrepareForPromotionToReadOnly();
1110 std::span<const std::string_view> names);
1127 static void CheckCast(
Data* that);
1140class V8_EXPORT Signature :
public Data {
1151 static void CheckCast(
Data* that);
1164#ifdef V8_ENABLE_CHECKS
1171#ifdef V8_ENABLE_CHECKS
1178#ifdef V8_ENABLE_CHECKS
1185#ifdef V8_ENABLE_CHECKS
1188 return reinterpret_cast<Signature*
>(data);
Definition: v8-context.h:53
Definition: v8-template.h:1099
static DictionaryTemplate * Cast(Data *data)
Definition: v8-template.h:1176
Definition: v8-template.h:551
static FunctionTemplate * Cast(Data *data)
Definition: v8-template.h:1162
Definition: v8-isolate.h:292
Definition: v8-local-handle.h:366
Definition: v8-local-handle.h:734
Definition: v8-template.h:963
static ObjectTemplate * Cast(Data *data)
Definition: v8-template.h:1169
Definition: v8-function-callback.h:224
Definition: v8-object.h:106
Definition: v8-container.h:139
Definition: v8-template.h:1139
static Signature * Cast(Data *data)
Definition: v8-template.h:1183
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:222
Intercepted(*)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< Boolean > &info) IndexedPropertySetterCallback
Definition: v8-template.h:363
SideEffectType
Definition: v8-object.h:232
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) NamedPropertyDescriptorCallback
Definition: v8-template.h:346
void(*)(const PropertyCallbackInfo< Value > &info) IndexedPropertyIterableToListCallback
Definition: v8-template.h:432
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:322
IndexedPropertyDescriptorCallback IndexedPropertyDescriptorCallbackV2
Definition: v8-template.h:419
IndexedPropertyGetterCallback IndexedPropertyGetterCallbackV2
Definition: v8-template.h:356
Intercepted(*)(uint32_t index, const PropertyDescriptor &desc, const PropertyCallbackInfo< Boolean > &info) IndexedPropertyDefinerCallback
Definition: v8-template.h:404
Intrinsic
Definition: v8-template.h:41
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Boolean > &info) IndexedPropertyDeleterCallback
Definition: v8-template.h:384
void(*)(const PropertyCallbackInfo< Array > &info) NamedPropertyEnumeratorCallback
Definition: v8-template.h:287
IndexedPropertyDeleterCallback IndexedPropertyDeleterCallbackV2
Definition: v8-template.h:388
ConstructorBehavior
Definition: v8-template.h:442
void(*)(const FunctionCallbackInfo< Value > &info) FunctionCallback
Definition: v8-function-callback.h:351
Intercepted(*)(uint32_t index, const PropertyDescriptor &desc, const PropertyCallbackInfo< void > &info) IndexedPropertyDefinerCallbackV2
Definition: v8-template.h:409
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyGetterCallback
Definition: v8-template.h:352
Intercepted(*)(Local< Name > property, const PropertyDescriptor &desc, const PropertyCallbackInfo< Boolean > &info) NamedPropertyDefinerCallbackV2
Definition: v8-template.h:317
void(*)(const PropertyCallbackInfo< Array > &info) IndexedPropertyEnumeratorCallback
Definition: v8-template.h:397
IndexedPropertyQueryCallback IndexedPropertyQueryCallbackV2
Definition: v8-template.h:378
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< Boolean > &info) AccessorNameSetterCallbackV2
Definition: v8-object.h:203
Intercepted
Definition: v8-template.h:141
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Integer > &info) NamedPropertyQueryCallback
Definition: v8-template.h:251
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:426
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:278
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyDescriptorCallback
Definition: v8-template.h:415
Intercepted(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< Boolean > &info) NamedPropertySetterCallbackV2
Definition: v8-template.h:217
PropertyHandlerFlags
Definition: v8-template.h:707
@ kInternalNewCallbacksSignatures
Intercepted(*)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< void > &info) IndexedPropertySetterCallbackV2
Definition: v8-template.h:368
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Integer > &info) IndexedPropertyQueryCallback
Definition: v8-template.h:374
Definition: v8-template.h:827
IndexedPropertyGetterCallback getter
Definition: v8-template.h:944
IndexedPropertyDefinerCallback definer
Definition: v8-template.h:949
PropertyHandlerFlags flags
Definition: v8-template.h:954
IndexedPropertyDescriptorCallback descriptor
Definition: v8-template.h:950
IndexedPropertySetterCallback setter
Definition: v8-template.h:945
IndexedPropertyIndexOfCallback index_of
Definition: v8-template.h:951
IndexedPropertyEnumeratorCallback enumerator
Definition: v8-template.h:948
IndexedPropertyQueryCallback query
Definition: v8-template.h:946
Local< Value > data
Definition: v8-template.h:953
IndexedPropertyDeleterCallback deleter
Definition: v8-template.h:947
IndexedPropertyIterableToListCallback iterable_to_list
Definition: v8-template.h:952
Definition: v8-template.h:748
NamedPropertyDescriptorCallback descriptor
Definition: v8-template.h:822
Local< Value > data
Definition: v8-template.h:823
NamedPropertyDeleterCallback deleter
Definition: v8-template.h:819
NamedPropertyDefinerCallbackV2 definer
Definition: v8-template.h:821
NamedPropertySetterCallbackV2 setter
Definition: v8-template.h:817
NamedPropertyEnumeratorCallback enumerator
Definition: v8-template.h:820
NamedPropertyQueryCallback query
Definition: v8-template.h:818
NamedPropertyGetterCallback getter
Definition: v8-template.h:816
PropertyHandlerFlags flags
Definition: v8-template.h:824
#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:867
#define V8_INLINE
Definition: v8config.h:511
#define V8_DEPRECATE_SOON(message)
Definition: v8config.h:624
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:681