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);
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<Boolean>& info);
337 Local<Name> property,
const PropertyCallbackInfo<Value>& info);
343 Intercepted (*)(uint32_t index,
const PropertyCallbackInfo<Value>& info);
349 Intercepted (*)(uint32_t index, Local<Value> value,
350 const PropertyCallbackInfo<Boolean>& info);
356 Intercepted (*)(uint32_t index,
const PropertyCallbackInfo<Integer>& info);
362 Intercepted (*)(uint32_t index,
const PropertyCallbackInfo<Boolean>& info);
371 void (*)(
const PropertyCallbackInfo<Array>& info);
377 Intercepted (*)(uint32_t index,
const PropertyDescriptor& desc,
378 const PropertyCallbackInfo<Boolean>& info);
384 Intercepted (*)(uint32_t index,
const PropertyCallbackInfo<Value>& info);
390 uint32_t (*)(Local<Value> value, uint32_t start_index, uint32_t end_index,
391 uint32_t* out_length,
const PropertyCallbackInfo<void>& info);
397 void (*)(
const PropertyCallbackInfo<Value>& info);
404 Local<Object> accessed_object,
516class V8_EXPORT FunctionTemplate :
public Template {
519 static Local<FunctionTemplate> New(
520 Isolate* isolate, FunctionCallback callback =
nullptr,
521 Local<Data> data = Local<Data>(),
522 Local<Signature> signature = Local<Signature>(),
int length = 0,
523 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
524 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
525 const CFunction* c_function =
nullptr, uint16_t instance_type = 0,
526 uint16_t allowed_receiver_instance_type_range_start = 0,
527 uint16_t allowed_receiver_instance_type_range_end = 0);
530 static Local<FunctionTemplate> NewWithCFunctionOverloads(
531 Isolate* isolate, FunctionCallback callback =
nullptr,
532 Local<Data> data = Local<Data>(),
533 Local<Signature> signature = Local<Signature>(),
int length = 0,
534 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
535 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
536 const std::span<const CFunction>& c_function_overloads = {});
541 static Local<FunctionTemplate> NewWithCache(
542 Isolate* isolate, FunctionCallback callback,
543 Local<Private> cache_property, Local<Data> data = Local<Data>(),
544 Local<Signature> signature = Local<Signature>(),
int length = 0,
545 SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
549 Local<Context> context);
567 FunctionCallback callback, Local<Data> data = {},
569 const std::span<const CFunction>& c_function_overloads = {});
572 void SetLength(
int length);
575 Local<ObjectTemplate> InstanceTemplate();
582 void Inherit(Local<FunctionTemplate> parent);
588 Local<ObjectTemplate> PrototypeTemplate();
596 void SetPrototypeProviderTemplate(Local<FunctionTemplate> prototype_provider);
603 void SetClassName(Local<String> name);
609 void SetInterfaceName(Local<String> name);
615 void SetExceptionContext(ExceptionContext context);
621 void SetAcceptAnyReceiver(
bool value);
627 void ReadOnlyPrototype();
633 void RemovePrototype();
639 bool HasInstance(Local<Value>
object);
656 void SealAndPrepareForPromotionToReadOnly();
658 V8_INLINE static FunctionTemplate* Cast(Data* data);
663 static void CheckCast(
Data* that);
718 static_cast<int>(
flags) |
797 static_cast<int>(
flags) |
861 "Use IndexedPropertyHandlerConfiguration with iterable_to_list")
984 void MarkAsUndetectable();
1003 void SetAccessCheckCallbackAndHandler(
1013 int InternalFieldCount()
const;
1019 void SetInternalFieldCount(
int value);
1024 bool IsImmutableProto()
const;
1030 void SetImmutableProto();
1042 bool IsCodeLike()
const;
1050 void SealAndPrepareForPromotionToReadOnly();
1074 std::span<const std::string_view> names);
1091 static void CheckCast(
Data* that);
1104class V8_EXPORT Signature :
public Data {
1115 static void CheckCast(
Data* that);
1128#ifdef V8_ENABLE_CHECKS
1135#ifdef V8_ENABLE_CHECKS
1142#ifdef V8_ENABLE_CHECKS
1149#ifdef V8_ENABLE_CHECKS
1152 return reinterpret_cast<Signature*
>(data);
Definition: v8-context.h:55
Definition: v8-template.h:1063
static DictionaryTemplate * Cast(Data *data)
Definition: v8-template.h:1140
Definition: v8-template.h:515
static FunctionTemplate * Cast(Data *data)
Definition: v8-template.h:1126
Definition: v8-isolate.h:305
Definition: v8-local-handle.h:359
Definition: v8-local-handle.h:730
Definition: v8-template.h:927
static ObjectTemplate * Cast(Data *data)
Definition: v8-template.h:1133
Definition: v8-container.h:147
Definition: v8-template.h:1103
static Signature * Cast(Data *data)
Definition: v8-template.h:1147
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(*)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< Boolean > &info) IndexedPropertySetterCallback
Definition: v8-template.h:349
SideEffectType
Definition: v8-object.h:227
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) NamedPropertyDescriptorCallback
Definition: v8-template.h:336
void(*)(const PropertyCallbackInfo< Value > &info) IndexedPropertyIterableToListCallback
Definition: v8-template.h:396
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) NamedPropertyGetterCallback
Definition: v8-template.h:187
Intercepted(*)(uint32_t index, const PropertyDescriptor &desc, const PropertyCallbackInfo< Boolean > &info) IndexedPropertyDefinerCallback
Definition: v8-template.h:377
Intrinsic
Definition: v8-template.h:41
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Boolean > &info) IndexedPropertyDeleterCallback
Definition: v8-template.h:361
void(*)(const PropertyCallbackInfo< Array > &info) NamedPropertyEnumeratorCallback
Definition: v8-template.h:282
ConstructorBehavior
Definition: v8-template.h:406
void(*)(const FunctionCallbackInfo< Value > &info) FunctionCallback
Definition: v8-function-callback.h:354
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyGetterCallback
Definition: v8-template.h:342
Intercepted(*)(Local< Name > property, const PropertyDescriptor &desc, const PropertyCallbackInfo< Boolean > &info) NamedPropertyDefinerCallbackV2
Definition: v8-template.h:312
void(*)(const PropertyCallbackInfo< Array > &info) IndexedPropertyEnumeratorCallback
Definition: v8-template.h:370
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:246
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:390
bool(*)(Local< Context > accessing_context, Local< Object > accessed_object, Local< Value > data) AccessCheckCallback
Definition: v8-template.h:404
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Boolean > &info) NamedPropertyDeleterCallback
Definition: v8-template.h:273
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyDescriptorCallback
Definition: v8-template.h:383
Intercepted(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< Boolean > &info) NamedPropertySetterCallbackV2
Definition: v8-template.h:217
PropertyHandlerFlags
Definition: v8-template.h:671
@ kInternalNewCallbacksSignatures
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Integer > &info) IndexedPropertyQueryCallback
Definition: v8-template.h:355
Definition: v8-template.h:791
IndexedPropertyGetterCallback getter
Definition: v8-template.h:908
Local< Data > data
Definition: v8-template.h:917
IndexedPropertyDefinerCallback definer
Definition: v8-template.h:913
PropertyHandlerFlags flags
Definition: v8-template.h:918
IndexedPropertyDescriptorCallback descriptor
Definition: v8-template.h:914
IndexedPropertySetterCallback setter
Definition: v8-template.h:909
IndexedPropertyIndexOfCallback index_of
Definition: v8-template.h:915
IndexedPropertyEnumeratorCallback enumerator
Definition: v8-template.h:912
IndexedPropertyQueryCallback query
Definition: v8-template.h:910
IndexedPropertyDeleterCallback deleter
Definition: v8-template.h:911
IndexedPropertyIterableToListCallback iterable_to_list
Definition: v8-template.h:916
Definition: v8-template.h:712
NamedPropertyDescriptorCallback descriptor
Definition: v8-template.h:786
NamedPropertyDeleterCallback deleter
Definition: v8-template.h:783
NamedPropertyDefinerCallbackV2 definer
Definition: v8-template.h:785
NamedPropertySetterCallbackV2 setter
Definition: v8-template.h:781
NamedPropertyEnumeratorCallback enumerator
Definition: v8-template.h:784
NamedPropertyQueryCallback query
Definition: v8-template.h:782
NamedPropertyGetterCallback getter
Definition: v8-template.h:780
Local< Data > data
Definition: v8-template.h:787
PropertyHandlerFlags flags
Definition: v8-template.h:788
#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:875
#define V8_INLINE
Definition: v8config.h:519
#define V8_DEPRECATE_SOON(message)
Definition: v8config.h:632
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:689