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);
185 Local<Name> property,
const PropertyCallbackInfo<Value>& info);
188 "Use NamedPropertyGetterCallback instead") =
215 "Use NamedPropertySetterCallback instead") =
249 "Use NamedPropertyQueryCallback instead") =
280 "Use NamedPropertyDeleterCallback instead") =
294 "Use NamedPropertyEnumeratorCallback instead") =
321 "Use NamedPropertyDefinerCallback instead") =
353 "Use NamedPropertyDescriptorCallback instead") =
367 "Use IndexedPropertyGetterCallbackV2 instead") =
377 "Use IndexedPropertySetterCallbackV2 instead") =
388 "Use IndexedPropertyQueryCallbackV2 instead") =
398 "Use IndexedPropertyDeleterCallbackV2 instead") =
418 "Use IndexedPropertyDefinerCallbackV2 instead") =
429 "Use IndexedPropertyDescriptorCallbackV2 instead") =
549class V8_EXPORT FunctionTemplate :
public Template {
552 static Local<FunctionTemplate> New(
553 Isolate* isolate, FunctionCallback callback =
nullptr,
554 Local<Value> data = Local<Value>(),
555 Local<Signature> signature = Local<Signature>(),
int length = 0,
556 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
557 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
558 const CFunction* c_function =
nullptr, uint16_t instance_type = 0,
559 uint16_t allowed_receiver_instance_type_range_start = 0,
560 uint16_t allowed_receiver_instance_type_range_end = 0);
563 static Local<FunctionTemplate> NewWithCFunctionOverloads(
564 Isolate* isolate, FunctionCallback callback =
nullptr,
565 Local<Value> data = Local<Value>(),
566 Local<Signature> signature = Local<Signature>(),
int length = 0,
567 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
568 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
569 const MemorySpan<const CFunction>& c_function_overloads = {});
574 static Local<FunctionTemplate> NewWithCache(
575 Isolate* isolate, FunctionCallback callback,
576 Local<Private> cache_property, Local<Value> data = Local<Value>(),
577 Local<Signature> signature = Local<Signature>(),
int length = 0,
578 SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
582 Local<Context> context);
600 FunctionCallback callback, Local<Value> data = Local<Value>(),
601 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
602 const MemorySpan<const CFunction>& c_function_overloads = {});
605 void SetLength(
int length);
608 Local<ObjectTemplate> InstanceTemplate();
615 void Inherit(Local<FunctionTemplate> parent);
621 Local<ObjectTemplate> PrototypeTemplate();
629 void SetPrototypeProviderTemplate(Local<FunctionTemplate> prototype_provider);
636 void SetClassName(Local<String> name);
642 void SetInterfaceName(Local<String> name);
648 void SetExceptionContext(ExceptionContext context);
654 void SetAcceptAnyReceiver(
bool value);
660 void ReadOnlyPrototype();
666 void RemovePrototype();
672 bool HasInstance(Local<Value>
object);
689 void SealAndPrepareForPromotionToReadOnly();
691 V8_INLINE static FunctionTemplate* Cast(Data* data);
696 static void CheckCast(
Data* that);
744 static_cast<int>(
flags) |
823 static_cast<int>(
flags) |
959 void MarkAsUndetectable();
978 void SetAccessCheckCallbackAndHandler(
988 int InternalFieldCount()
const;
994 void SetInternalFieldCount(
int value);
999 bool IsImmutableProto()
const;
1005 void SetImmutableProto();
1017 bool IsCodeLike()
const;
1025 void SealAndPrepareForPromotionToReadOnly();
1066 static void CheckCast(
Data* that);
1079class V8_EXPORT Signature :
public Data {
1090 static void CheckCast(
Data* that);
1103#ifdef V8_ENABLE_CHECKS
1110#ifdef V8_ENABLE_CHECKS
1117#ifdef V8_ENABLE_CHECKS
1124#ifdef V8_ENABLE_CHECKS
1127 return reinterpret_cast<Signature*
>(data);
Definition: v8-context.h:48
Definition: v8-template.h:1038
static DictionaryTemplate * Cast(Data *data)
Definition: v8-template.h:1115
Definition: v8-template.h:548
static FunctionTemplate * Cast(Data *data)
Definition: v8-template.h:1101
Definition: v8-isolate.h:290
Definition: v8-local-handle.h:366
Definition: v8-local-handle.h:734
Definition: v8-memory-span.h:48
Definition: v8-template.h:902
static ObjectTemplate * Cast(Data *data)
Definition: v8-template.h:1108
Definition: v8-function-callback.h:187
Definition: v8-object.h:106
Definition: v8-container.h:148
Definition: v8-template.h:1078
static Signature * Cast(Data *data)
Definition: v8-template.h:1122
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
void(*)(uint32_t index, const PropertyCallbackInfo< Integer > &info) IndexedPropertyQueryCallback
Definition: v8-template.h:388
PropertyAttribute
Definition: v8-object.h:154
void(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) AccessorNameGetterCallback
Definition: v8-object.h:171
void(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) GenericNamedPropertyGetterCallback
Definition: v8-template.h:188
Intercepted(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) NamedPropertySetterCallback
Definition: v8-template.h:211
void(*)(Local< Name > property, const PropertyDescriptor &desc, const PropertyCallbackInfo< Value > &info) GenericNamedPropertyDefinerCallback
Definition: v8-template.h:322
void(*)(uint32_t index, const PropertyDescriptor &desc, const PropertyCallbackInfo< Value > &info) IndexedPropertyDefinerCallback
Definition: v8-template.h:419
void(*)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< Value > &info) IndexedPropertySetterCallback
Definition: v8-template.h:378
SideEffectType
Definition: v8-object.h:213
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) NamedPropertyDescriptorCallback
Definition: v8-template.h:349
void(*)(uint32_t index, const PropertyCallbackInfo< Boolean > &info) IndexedPropertyDeleterCallback
Definition: v8-template.h:398
Intercepted(*)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< void > &info) IndexedPropertySetterCallbackV2
Definition: v8-template.h:373
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) NamedPropertyGetterCallback
Definition: v8-template.h:184
NamedPropertyEnumeratorCallback GenericNamedPropertyEnumeratorCallback
Definition: v8-template.h:294
void(*)(Local< Name > property, const PropertyCallbackInfo< Integer > &info) GenericNamedPropertyQueryCallback
Definition: v8-template.h:249
Intercepted(*)(Local< Name > property, const PropertyDescriptor &desc, const PropertyCallbackInfo< void > &info) NamedPropertyDefinerCallback
Definition: v8-template.h:317
void(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyDescriptorCallback
Definition: v8-template.h:429
Intrinsic
Definition: v8-template.h:41
void(*)(const PropertyCallbackInfo< Array > &info) NamedPropertyEnumeratorCallback
Definition: v8-template.h:289
ConstructorBehavior
Definition: v8-template.h:439
void(*)(const FunctionCallbackInfo< Value > &info) FunctionCallback
Definition: v8-function-callback.h:314
Intercepted(*)(uint32_t index, const PropertyDescriptor &desc, const PropertyCallbackInfo< void > &info) IndexedPropertyDefinerCallbackV2
Definition: v8-template.h:414
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Boolean > &info) IndexedPropertyDeleterCallbackV2
Definition: v8-template.h:394
void(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyGetterCallback
Definition: v8-template.h:367
void(*)(const PropertyCallbackInfo< Array > &info) IndexedPropertyEnumeratorCallback
Definition: v8-template.h:407
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyDescriptorCallbackV2
Definition: v8-template.h:425
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Integer > &info) NamedPropertyQueryCallback
Definition: v8-template.h:245
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) AccessorNameSetterCallback
Definition: v8-object.h:175
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< Value > &info) GenericNamedPropertySetterCallback
Definition: v8-template.h:216
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyGetterCallbackV2
Definition: v8-template.h:363
void(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) GenericNamedPropertyDescriptorCallback
Definition: v8-template.h:353
bool(*)(Local< Context > accessing_context, Local< Object > accessed_object, Local< Value > data) AccessCheckCallback
Definition: v8-template.h:437
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Boolean > &info) NamedPropertyDeleterCallback
Definition: v8-template.h:276
void(*)(Local< Name > property, const PropertyCallbackInfo< Boolean > &info) GenericNamedPropertyDeleterCallback
Definition: v8-template.h:280
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Integer > &info) IndexedPropertyQueryCallbackV2
Definition: v8-template.h:384
PropertyHandlerFlags
Definition: v8-template.h:704
@ kInternalNewCallbacksSignatures
Intercepted
Definition: v8-template.h:138
Definition: v8-template.h:817
PropertyHandlerFlags flags
Definition: v8-template.h:893
IndexedPropertyQueryCallbackV2 query
Definition: v8-template.h:887
IndexedPropertyDeleterCallbackV2 deleter
Definition: v8-template.h:888
IndexedPropertyGetterCallbackV2 getter
Definition: v8-template.h:885
IndexedPropertyEnumeratorCallback enumerator
Definition: v8-template.h:889
Local< Value > data
Definition: v8-template.h:892
IndexedPropertyDescriptorCallbackV2 descriptor
Definition: v8-template.h:891
IndexedPropertySetterCallbackV2 setter
Definition: v8-template.h:886
IndexedPropertyDefinerCallbackV2 definer
Definition: v8-template.h:890
Definition: v8-template.h:738
NamedPropertyDescriptorCallback descriptor
Definition: v8-template.h:812
Local< Value > data
Definition: v8-template.h:813
NamedPropertySetterCallback setter
Definition: v8-template.h:807
NamedPropertyDeleterCallback deleter
Definition: v8-template.h:809
NamedPropertyEnumeratorCallback enumerator
Definition: v8-template.h:810
NamedPropertyQueryCallback query
Definition: v8-template.h:808
NamedPropertyGetterCallback getter
Definition: v8-template.h:806
NamedPropertyDefinerCallback definer
Definition: v8-template.h:811
PropertyHandlerFlags flags
Definition: v8-template.h:814
#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:855
#define V8_INLINE
Definition: v8config.h:508
#define V8_DEPRECATED(message)
Definition: v8config.h:614
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:679