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);
192 "Use NamedPropertyGetterCallback instead") =
226 "Use NamedPropertySetterCallback instead") =
265 "Use NamedPropertyQueryCallback instead") =
303 "Use NamedPropertyDeleterCallback instead") =
317 "Use NamedPropertyEnumeratorCallback instead") =
351 "Use NamedPropertyDefinerCallback instead") =
388 "Use NamedPropertyDescriptorCallback instead") =
402 "Use IndexedPropertyGetterCallbackV2 instead") =
412 "Use IndexedPropertySetterCallbackV2 instead") =
423 "Use IndexedPropertyQueryCallbackV2 instead") =
433 "Use IndexedPropertyDeleterCallbackV2 instead") =
453 "Use IndexedPropertyDefinerCallbackV2 instead") =
464 "Use IndexedPropertyDescriptorCallbackV2 instead") =
584class V8_EXPORT FunctionTemplate :
public Template {
587 static Local<FunctionTemplate> New(
588 Isolate* isolate, FunctionCallback callback =
nullptr,
589 Local<Value> data = Local<Value>(),
590 Local<Signature> signature = Local<Signature>(),
int length = 0,
591 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
592 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
593 const CFunction* c_function =
nullptr, uint16_t instance_type = 0,
594 uint16_t allowed_receiver_instance_type_range_start = 0,
595 uint16_t allowed_receiver_instance_type_range_end = 0);
598 static Local<FunctionTemplate> NewWithCFunctionOverloads(
599 Isolate* isolate, FunctionCallback callback =
nullptr,
600 Local<Value> data = Local<Value>(),
601 Local<Signature> signature = Local<Signature>(),
int length = 0,
602 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
603 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
604 const MemorySpan<const CFunction>& c_function_overloads = {});
609 static Local<FunctionTemplate> NewWithCache(
610 Isolate* isolate, FunctionCallback callback,
611 Local<Private> cache_property, Local<Value> data = Local<Value>(),
612 Local<Signature> signature = Local<Signature>(),
int length = 0,
613 SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
617 Local<Context> context);
635 FunctionCallback callback, Local<Value> data = Local<Value>(),
636 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
637 const MemorySpan<const CFunction>& c_function_overloads = {});
640 void SetLength(
int length);
643 Local<ObjectTemplate> InstanceTemplate();
650 void Inherit(Local<FunctionTemplate> parent);
656 Local<ObjectTemplate> PrototypeTemplate();
664 void SetPrototypeProviderTemplate(Local<FunctionTemplate> prototype_provider);
671 void SetClassName(Local<String> name);
677 void SetInterfaceName(Local<String> name);
683 void SetExceptionContext(ExceptionContext context);
689 void SetAcceptAnyReceiver(
bool value);
695 void ReadOnlyPrototype();
701 void RemovePrototype();
707 bool HasInstance(Local<Value>
object);
724 void SealAndPrepareForPromotionToReadOnly();
726 V8_INLINE static FunctionTemplate* Cast(Data* data);
731 static void CheckCast(
Data* that);
779 static_cast<int>(
flags) |
858 static_cast<int>(
flags) |
994 void MarkAsUndetectable();
1013 void SetAccessCheckCallbackAndHandler(
1023 int InternalFieldCount()
const;
1029 void SetInternalFieldCount(
int value);
1034 bool IsImmutableProto()
const;
1040 void SetImmutableProto();
1052 bool IsCodeLike()
const;
1093 static void CheckCast(
Data* that);
1106class V8_EXPORT Signature :
public Data {
1117 static void CheckCast(
Data* that);
1130#ifdef V8_ENABLE_CHECKS
1137#ifdef V8_ENABLE_CHECKS
1144#ifdef V8_ENABLE_CHECKS
1151#ifdef V8_ENABLE_CHECKS
1154 return reinterpret_cast<Signature*
>(data);
Definition: v8-context.h:48
Definition: v8-template.h:1065
static DictionaryTemplate * Cast(Data *data)
Definition: v8-template.h:1142
Definition: v8-template.h:583
static FunctionTemplate * Cast(Data *data)
Definition: v8-template.h:1128
Definition: v8-isolate.h:274
Definition: v8-local-handle.h:267
Definition: v8-local-handle.h:635
Definition: v8-memory-span.h:64
Definition: v8-template.h:937
static ObjectTemplate * Cast(Data *data)
Definition: v8-template.h:1135
Definition: v8-function-callback.h:187
Definition: v8-object.h:91
Definition: v8-container.h:148
Definition: v8-template.h:1105
static Signature * Cast(Data *data)
Definition: v8-template.h:1149
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:423
PropertyAttribute
Definition: v8-object.h:139
void(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) AccessorNameGetterCallback
Definition: v8-object.h:156
void(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) GenericNamedPropertyGetterCallback
Definition: v8-template.h:192
Intercepted(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) NamedPropertySetterCallback
Definition: v8-template.h:215
void(*)(Local< Name > property, const PropertyDescriptor &desc, const PropertyCallbackInfo< Value > &info) GenericNamedPropertyDefinerCallback
Definition: v8-template.h:352
void(*)(uint32_t index, const PropertyDescriptor &desc, const PropertyCallbackInfo< Value > &info) IndexedPropertyDefinerCallback
Definition: v8-template.h:454
void(*)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< Value > &info) IndexedPropertySetterCallback
Definition: v8-template.h:413
SideEffectType
Definition: v8-object.h:198
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) NamedPropertyDescriptorCallback
Definition: v8-template.h:379
void(*)(uint32_t index, const PropertyCallbackInfo< Boolean > &info) IndexedPropertyDeleterCallback
Definition: v8-template.h:433
Intercepted(*)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< void > &info) IndexedPropertySetterCallbackV2
Definition: v8-template.h:408
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) NamedPropertyGetterCallback
Definition: v8-template.h:184
NamedPropertyEnumeratorCallback GenericNamedPropertyEnumeratorCallback
Definition: v8-template.h:317
void(*)(Local< Name > property, const PropertyCallbackInfo< Integer > &info) GenericNamedPropertyQueryCallback
Definition: v8-template.h:265
Intercepted(*)(Local< Name > property, const PropertyDescriptor &desc, const PropertyCallbackInfo< void > &info) NamedPropertyDefinerCallback
Definition: v8-template.h:340
void(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyDescriptorCallback
Definition: v8-template.h:464
Intrinsic
Definition: v8-template.h:41
void(*)(const PropertyCallbackInfo< Array > &info) NamedPropertyEnumeratorCallback
Definition: v8-template.h:312
ConstructorBehavior
Definition: v8-template.h:474
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:449
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Boolean > &info) IndexedPropertyDeleterCallbackV2
Definition: v8-template.h:429
void(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyGetterCallback
Definition: v8-template.h:402
void(*)(const PropertyCallbackInfo< Array > &info) IndexedPropertyEnumeratorCallback
Definition: v8-template.h:442
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyDescriptorCallbackV2
Definition: v8-template.h:460
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Integer > &info) NamedPropertyQueryCallback
Definition: v8-template.h:256
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) AccessorNameSetterCallback
Definition: v8-object.h:160
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< Value > &info) GenericNamedPropertySetterCallback
Definition: v8-template.h:227
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyGetterCallbackV2
Definition: v8-template.h:398
void(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) GenericNamedPropertyDescriptorCallback
Definition: v8-template.h:388
bool(*)(Local< Context > accessing_context, Local< Object > accessed_object, Local< Value > data) AccessCheckCallback
Definition: v8-template.h:472
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Boolean > &info) NamedPropertyDeleterCallback
Definition: v8-template.h:292
void(*)(Local< Name > property, const PropertyCallbackInfo< Boolean > &info) GenericNamedPropertyDeleterCallback
Definition: v8-template.h:303
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Integer > &info) IndexedPropertyQueryCallbackV2
Definition: v8-template.h:419
PropertyHandlerFlags
Definition: v8-template.h:739
@ kInternalNewCallbacksSignatures
Intercepted
Definition: v8-template.h:138
Definition: v8-template.h:852
PropertyHandlerFlags flags
Definition: v8-template.h:928
IndexedPropertyQueryCallbackV2 query
Definition: v8-template.h:922
IndexedPropertyDeleterCallbackV2 deleter
Definition: v8-template.h:923
IndexedPropertyGetterCallbackV2 getter
Definition: v8-template.h:920
IndexedPropertyEnumeratorCallback enumerator
Definition: v8-template.h:924
Local< Value > data
Definition: v8-template.h:927
IndexedPropertyDescriptorCallbackV2 descriptor
Definition: v8-template.h:926
IndexedPropertySetterCallbackV2 setter
Definition: v8-template.h:921
IndexedPropertyDefinerCallbackV2 definer
Definition: v8-template.h:925
Definition: v8-template.h:773
NamedPropertyDescriptorCallback descriptor
Definition: v8-template.h:847
Local< Value > data
Definition: v8-template.h:848
NamedPropertySetterCallback setter
Definition: v8-template.h:842
NamedPropertyDeleterCallback deleter
Definition: v8-template.h:844
NamedPropertyEnumeratorCallback enumerator
Definition: v8-template.h:845
NamedPropertyQueryCallback query
Definition: v8-template.h:843
NamedPropertyGetterCallback getter
Definition: v8-template.h:841
NamedPropertyDefinerCallback definer
Definition: v8-template.h:846
PropertyHandlerFlags flags
Definition: v8-template.h:849
#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:800
#define V8_INLINE
Definition: v8config.h:500
#define V8_DEPRECATE_SOON(message)
Definition: v8config.h:614
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:671