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);
207 Intercepted (*)(Local<Name> property, Local<Value> value,
208 const PropertyCallbackInfo<void>& info);
237 Local<Name> property,
const PropertyCallbackInfo<Integer>& info);
264 Local<Name> property,
const PropertyCallbackInfo<Boolean>& info);
273 void (*)(
const PropertyCallbackInfo<Array>& info);
295 Intercepted (*)(Local<Name> property,
const PropertyDescriptor& desc,
296 const PropertyCallbackInfo<void>& info);
323 Local<Name> property,
const PropertyCallbackInfo<Value>& info);
333 Intercepted (*)(uint32_t index,
const PropertyCallbackInfo<Value>& info);
339 uint32_t index, Local<Value> value,
const PropertyCallbackInfo<void>& info);
345 Intercepted (*)(uint32_t index,
const PropertyCallbackInfo<Integer>& info);
351 Intercepted (*)(uint32_t index,
const PropertyCallbackInfo<Boolean>& info);
360 void (*)(
const PropertyCallbackInfo<Array>& info);
366 Intercepted (*)(uint32_t index,
const PropertyDescriptor& desc,
367 const PropertyCallbackInfo<void>& info);
373 Intercepted (*)(uint32_t index,
const PropertyCallbackInfo<Value>& info);
380 Local<Object> accessed_object,
492class V8_EXPORT FunctionTemplate :
public Template {
495 static Local<FunctionTemplate> New(
496 Isolate* isolate, FunctionCallback callback =
nullptr,
497 Local<Value> data = Local<Value>(),
498 Local<Signature> signature = Local<Signature>(),
int length = 0,
499 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
500 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
501 const CFunction* c_function =
nullptr, uint16_t instance_type = 0,
502 uint16_t allowed_receiver_instance_type_range_start = 0,
503 uint16_t allowed_receiver_instance_type_range_end = 0);
506 static Local<FunctionTemplate> NewWithCFunctionOverloads(
507 Isolate* isolate, FunctionCallback callback =
nullptr,
508 Local<Value> data = Local<Value>(),
509 Local<Signature> signature = Local<Signature>(),
int length = 0,
510 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
511 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
512 const MemorySpan<const CFunction>& c_function_overloads = {});
517 static Local<FunctionTemplate> NewWithCache(
518 Isolate* isolate, FunctionCallback callback,
519 Local<Private> cache_property, Local<Value> data = Local<Value>(),
520 Local<Signature> signature = Local<Signature>(),
int length = 0,
521 SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
525 Local<Context> context);
543 FunctionCallback callback, Local<Value> data = Local<Value>(),
544 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
545 const MemorySpan<const CFunction>& c_function_overloads = {});
548 void SetLength(
int length);
551 Local<ObjectTemplate> InstanceTemplate();
558 void Inherit(Local<FunctionTemplate> parent);
564 Local<ObjectTemplate> PrototypeTemplate();
572 void SetPrototypeProviderTemplate(Local<FunctionTemplate> prototype_provider);
579 void SetClassName(Local<String> name);
585 void SetInterfaceName(Local<String> name);
591 void SetExceptionContext(ExceptionContext context);
597 void SetAcceptAnyReceiver(
bool value);
603 void ReadOnlyPrototype();
609 void RemovePrototype();
615 bool HasInstance(Local<Value>
object);
632 void SealAndPrepareForPromotionToReadOnly();
634 V8_INLINE static FunctionTemplate* Cast(Data* data);
639 static void CheckCast(
Data* that);
687 static_cast<int>(
flags) |
766 static_cast<int>(
flags) |
902 void MarkAsUndetectable();
921 void SetAccessCheckCallbackAndHandler(
931 int InternalFieldCount()
const;
937 void SetInternalFieldCount(
int value);
942 bool IsImmutableProto()
const;
948 void SetImmutableProto();
960 bool IsCodeLike()
const;
968 void SealAndPrepareForPromotionToReadOnly();
975 static void CheckCast(
Data* that);
1009 static void CheckCast(
Data* that);
1022class V8_EXPORT Signature :
public Data {
1033 static void CheckCast(
Data* that);
1046#ifdef V8_ENABLE_CHECKS
1053#ifdef V8_ENABLE_CHECKS
1060#ifdef V8_ENABLE_CHECKS
1067#ifdef V8_ENABLE_CHECKS
1070 return reinterpret_cast<Signature*
>(data);
Definition: v8-context.h:48
Definition: v8-template.h:981
static DictionaryTemplate * Cast(Data *data)
Definition: v8-template.h:1058
Definition: v8-template.h:491
static FunctionTemplate * Cast(Data *data)
Definition: v8-template.h:1044
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:845
static ObjectTemplate * Cast(Data *data)
Definition: v8-template.h:1051
Definition: v8-container.h:148
Definition: v8-template.h:1021
static Signature * Cast(Data *data)
Definition: v8-template.h:1065
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:171
Intercepted(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) NamedPropertySetterCallback
Definition: v8-template.h:207
SideEffectType
Definition: v8-object.h:199
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) NamedPropertyDescriptorCallback
Definition: v8-template.h:322
Intercepted(*)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< void > &info) IndexedPropertySetterCallbackV2
Definition: v8-template.h:338
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) NamedPropertyGetterCallback
Definition: v8-template.h:184
Intercepted(*)(Local< Name > property, const PropertyDescriptor &desc, const PropertyCallbackInfo< void > &info) NamedPropertyDefinerCallback
Definition: v8-template.h:295
Intrinsic
Definition: v8-template.h:41
void(*)(const PropertyCallbackInfo< Array > &info) NamedPropertyEnumeratorCallback
Definition: v8-template.h:272
ConstructorBehavior
Definition: v8-template.h:382
void(*)(const FunctionCallbackInfo< Value > &info) FunctionCallback
Definition: v8-function-callback.h:299
Intercepted(*)(uint32_t index, const PropertyDescriptor &desc, const PropertyCallbackInfo< void > &info) IndexedPropertyDefinerCallbackV2
Definition: v8-template.h:366
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Boolean > &info) IndexedPropertyDeleterCallbackV2
Definition: v8-template.h:350
void(*)(const PropertyCallbackInfo< Array > &info) IndexedPropertyEnumeratorCallback
Definition: v8-template.h:359
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyDescriptorCallbackV2
Definition: v8-template.h:372
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Integer > &info) NamedPropertyQueryCallback
Definition: v8-template.h:236
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) AccessorNameSetterCallback
Definition: v8-object.h:175
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyGetterCallbackV2
Definition: v8-template.h:332
bool(*)(Local< Context > accessing_context, Local< Object > accessed_object, Local< Value > data) AccessCheckCallback
Definition: v8-template.h:380
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Boolean > &info) NamedPropertyDeleterCallback
Definition: v8-template.h:263
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Integer > &info) IndexedPropertyQueryCallbackV2
Definition: v8-template.h:344
PropertyHandlerFlags
Definition: v8-template.h:647
@ kInternalNewCallbacksSignatures
Intercepted
Definition: v8-template.h:138
Definition: v8-template.h:760
PropertyHandlerFlags flags
Definition: v8-template.h:836
IndexedPropertyQueryCallbackV2 query
Definition: v8-template.h:830
IndexedPropertyDeleterCallbackV2 deleter
Definition: v8-template.h:831
IndexedPropertyGetterCallbackV2 getter
Definition: v8-template.h:828
IndexedPropertyEnumeratorCallback enumerator
Definition: v8-template.h:832
Local< Value > data
Definition: v8-template.h:835
IndexedPropertyDescriptorCallbackV2 descriptor
Definition: v8-template.h:834
IndexedPropertySetterCallbackV2 setter
Definition: v8-template.h:829
IndexedPropertyDefinerCallbackV2 definer
Definition: v8-template.h:833
Definition: v8-template.h:681
NamedPropertyDescriptorCallback descriptor
Definition: v8-template.h:755
Local< Value > data
Definition: v8-template.h:756
NamedPropertySetterCallback setter
Definition: v8-template.h:750
NamedPropertyDeleterCallback deleter
Definition: v8-template.h:752
NamedPropertyEnumeratorCallback enumerator
Definition: v8-template.h:753
NamedPropertyQueryCallback query
Definition: v8-template.h:751
NamedPropertyGetterCallback getter
Definition: v8-template.h:749
NamedPropertyDefinerCallback definer
Definition: v8-template.h:754
PropertyHandlerFlags flags
Definition: v8-template.h:757
#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_WARN_UNUSED_RESULT
Definition: v8config.h:679