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);
214 Intercepted (*)(Local<Name> property, Local<Value> value,
215 const PropertyCallbackInfo<void>& info);
244 Local<Name> property,
const PropertyCallbackInfo<Integer>& info);
271 Local<Name> property,
const PropertyCallbackInfo<Boolean>& info);
280 void (*)(
const PropertyCallbackInfo<Array>& info);
309 Intercepted (*)(Local<Name> property,
const PropertyDescriptor& desc,
310 const PropertyCallbackInfo<void>& info);
334 Local<Name> property,
const PropertyCallbackInfo<Value>& info);
344 Intercepted (*)(uint32_t index,
const PropertyCallbackInfo<Value>& info);
350 uint32_t index, Local<Value> value,
const PropertyCallbackInfo<void>& 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<void>& info);
384 Intercepted (*)(uint32_t index,
const PropertyCallbackInfo<Value>& info);
391 Local<Object> accessed_object,
503class V8_EXPORT FunctionTemplate :
public Template {
506 static Local<FunctionTemplate> New(
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 CFunction* c_function =
nullptr, uint16_t instance_type = 0,
513 uint16_t allowed_receiver_instance_type_range_start = 0,
514 uint16_t allowed_receiver_instance_type_range_end = 0);
517 static Local<FunctionTemplate> NewWithCFunctionOverloads(
518 Isolate* isolate, FunctionCallback callback =
nullptr,
519 Local<Value> data = Local<Value>(),
520 Local<Signature> signature = Local<Signature>(),
int length = 0,
521 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
522 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
523 const MemorySpan<const CFunction>& c_function_overloads = {});
528 static Local<FunctionTemplate> NewWithCache(
529 Isolate* isolate, FunctionCallback callback,
530 Local<Private> cache_property, Local<Value> data = Local<Value>(),
531 Local<Signature> signature = Local<Signature>(),
int length = 0,
532 SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
536 Local<Context> context);
554 FunctionCallback callback, Local<Data> data = {},
556 const MemorySpan<const CFunction>& c_function_overloads = {});
559 void SetLength(
int length);
562 Local<ObjectTemplate> InstanceTemplate();
569 void Inherit(Local<FunctionTemplate> parent);
575 Local<ObjectTemplate> PrototypeTemplate();
583 void SetPrototypeProviderTemplate(Local<FunctionTemplate> prototype_provider);
590 void SetClassName(Local<String> name);
596 void SetInterfaceName(Local<String> name);
602 void SetExceptionContext(ExceptionContext context);
608 void SetAcceptAnyReceiver(
bool value);
614 void ReadOnlyPrototype();
620 void RemovePrototype();
626 bool HasInstance(Local<Value>
object);
643 void SealAndPrepareForPromotionToReadOnly();
645 V8_INLINE static FunctionTemplate* Cast(Data* data);
650 static void CheckCast(
Data* that);
698 static_cast<int>(
flags) |
777 static_cast<int>(
flags) |
913 void MarkAsUndetectable();
932 void SetAccessCheckCallbackAndHandler(
942 int InternalFieldCount()
const;
948 void SetInternalFieldCount(
int value);
953 bool IsImmutableProto()
const;
959 void SetImmutableProto();
971 bool IsCodeLike()
const;
979 void SealAndPrepareForPromotionToReadOnly();
986 static void CheckCast(
Data* that);
1020 static void CheckCast(
Data* that);
1033class V8_EXPORT Signature :
public Data {
1044 static void CheckCast(
Data* that);
1057#ifdef V8_ENABLE_CHECKS
1064#ifdef V8_ENABLE_CHECKS
1071#ifdef V8_ENABLE_CHECKS
1078#ifdef V8_ENABLE_CHECKS
1081 return reinterpret_cast<Signature*
>(data);
Definition: v8-context.h:48
Definition: v8-template.h:992
static DictionaryTemplate * Cast(Data *data)
Definition: v8-template.h:1069
Definition: v8-template.h:502
static FunctionTemplate * Cast(Data *data)
Definition: v8-template.h:1055
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:856
static ObjectTemplate * Cast(Data *data)
Definition: v8-template.h:1062
Definition: v8-container.h:148
Definition: v8-template.h:1032
static Signature * Cast(Data *data)
Definition: v8-template.h:1076
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:214
SideEffectType
Definition: v8-object.h:227
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) NamedPropertyDescriptorCallback
Definition: v8-template.h:333
Intercepted(*)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< void > &info) IndexedPropertySetterCallbackV2
Definition: v8-template.h:349
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:309
Intrinsic
Definition: v8-template.h:41
void(*)(const PropertyCallbackInfo< Array > &info) NamedPropertyEnumeratorCallback
Definition: v8-template.h:279
ConstructorBehavior
Definition: v8-template.h:393
void(*)(const FunctionCallbackInfo< Value > &info) FunctionCallback
Definition: v8-function-callback.h:309
Intercepted(*)(uint32_t index, const PropertyDescriptor &desc, const PropertyCallbackInfo< void > &info) IndexedPropertyDefinerCallbackV2
Definition: v8-template.h:377
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Boolean > &info) IndexedPropertyDeleterCallbackV2
Definition: v8-template.h:361
void(*)(const PropertyCallbackInfo< Array > &info) IndexedPropertyEnumeratorCallback
Definition: v8-template.h:370
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyDescriptorCallbackV2
Definition: v8-template.h:383
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Integer > &info) NamedPropertyQueryCallback
Definition: v8-template.h:243
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) AccessorNameSetterCallback
Definition: v8-object.h:203
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyGetterCallbackV2
Definition: v8-template.h:343
bool(*)(Local< Context > accessing_context, Local< Object > accessed_object, Local< Value > data) AccessCheckCallback
Definition: v8-template.h:391
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Boolean > &info) NamedPropertyDeleterCallback
Definition: v8-template.h:270
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Integer > &info) IndexedPropertyQueryCallbackV2
Definition: v8-template.h:355
PropertyHandlerFlags
Definition: v8-template.h:658
@ kInternalNewCallbacksSignatures
Intercepted
Definition: v8-template.h:138
Definition: v8-template.h:771
PropertyHandlerFlags flags
Definition: v8-template.h:847
IndexedPropertyQueryCallbackV2 query
Definition: v8-template.h:841
IndexedPropertyDeleterCallbackV2 deleter
Definition: v8-template.h:842
IndexedPropertyGetterCallbackV2 getter
Definition: v8-template.h:839
IndexedPropertyEnumeratorCallback enumerator
Definition: v8-template.h:843
Local< Value > data
Definition: v8-template.h:846
IndexedPropertyDescriptorCallbackV2 descriptor
Definition: v8-template.h:845
IndexedPropertySetterCallbackV2 setter
Definition: v8-template.h:840
IndexedPropertyDefinerCallbackV2 definer
Definition: v8-template.h:844
Definition: v8-template.h:692
NamedPropertyDescriptorCallback descriptor
Definition: v8-template.h:766
Local< Value > data
Definition: v8-template.h:767
NamedPropertySetterCallback setter
Definition: v8-template.h:761
NamedPropertyDeleterCallback deleter
Definition: v8-template.h:763
NamedPropertyEnumeratorCallback enumerator
Definition: v8-template.h:764
NamedPropertyQueryCallback query
Definition: v8-template.h:762
NamedPropertyGetterCallback getter
Definition: v8-template.h:760
NamedPropertyDefinerCallback definer
Definition: v8-template.h:765
PropertyHandlerFlags flags
Definition: v8-template.h:768
#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