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,
80 void SetAccessorProperty(
106 void SetNativeDataProperty(
117 void SetLazyDataProperty(
400 uint32_t (*)(
Local<Value> value, uint32_t start_index, uint32_t end_index,
526class V8_EXPORT FunctionTemplate :
public Template {
529 static Local<FunctionTemplate> New(
530 Isolate* isolate, FunctionCallback callback =
nullptr,
531 Local<Data> data = Local<Data>(),
532 Local<Signature> signature = Local<Signature>(),
int length = 0,
533 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
534 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
535 const CFunction* c_function =
nullptr, uint16_t instance_type = 0,
536 uint16_t allowed_receiver_instance_type_range_start = 0,
537 uint16_t allowed_receiver_instance_type_range_end = 0);
540 static Local<FunctionTemplate> NewWithCFunctionOverloads(
541 Isolate* isolate, FunctionCallback callback =
nullptr,
542 Local<Data> data = Local<Data>(),
543 Local<Signature> signature = Local<Signature>(),
int length = 0,
544 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
545 SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
546 const std::span<const CFunction>& c_function_overloads = {});
551 static Local<FunctionTemplate> NewWithCache(
552 Isolate* isolate, FunctionCallback callback,
553 Local<Private> cache_property, Local<Data> data = Local<Data>(),
554 Local<Signature> signature = Local<Signature>(),
int length = 0,
555 SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
559 Local<Context> context);
577 FunctionCallback callback, Local<Data> data = {},
579 const std::span<const CFunction>& c_function_overloads = {});
582 void SetLength(
int length);
585 Local<ObjectTemplate> InstanceTemplate();
592 void Inherit(Local<FunctionTemplate> parent);
598 Local<ObjectTemplate> PrototypeTemplate();
606 void SetPrototypeProviderTemplate(Local<FunctionTemplate> prototype_provider);
613 void SetClassName(Local<String> name);
619 void SetInterfaceName(Local<String> name);
625 void SetExceptionContext(ExceptionContext context);
631 void SetAcceptAnyReceiver(
bool value);
637 void ReadOnlyPrototype();
643 void RemovePrototype();
649 bool HasInstance(Local<Value>
object);
666 void SealAndPrepareForPromotionToReadOnly();
668 V8_INLINE static FunctionTemplate* Cast(Data* data);
673 static void CheckCast(
Data* that);
728 static_cast<int>(flags) |
730 PropertyHandlerFlags::kInternalNewCallbacksSignatures));
748 enumerator(enumerator),
750 descriptor(descriptor),
766 enumerator(enumerator),
785 enumerator(enumerator),
787 descriptor(descriptor),
807 static_cast<int>(flags) |
809 PropertyHandlerFlags::kInternalNewCallbacksSignatures));
827 enumerator(enumerator),
829 descriptor(descriptor),
845 enumerator(enumerator),
864 enumerator(enumerator),
866 descriptor(descriptor),
871 "Use IndexedPropertyHandlerConfiguration with iterable_to_list")
887 enumerator(enumerator),
889 descriptor(descriptor),
891 iterable_to_list(
nullptr),
911 enumerator(enumerator),
913 descriptor(descriptor),
915 iterable_to_list(iterable_to_list),
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;
1060 void SealAndPrepareForPromotionToReadOnly();
1084 std::span<const std::string_view> names);
1101 static void CheckCast(
Data* that);
1114class V8_EXPORT Signature :
public Data {
1125 static void CheckCast(
Data* that);
1132 Set(String::NewFromUtf8(isolate, name, NewStringType::kInternalized)
1138#ifdef V8_ENABLE_CHECKS
1145#ifdef V8_ENABLE_CHECKS
1152#ifdef V8_ENABLE_CHECKS
1159#ifdef V8_ENABLE_CHECKS
1162 return reinterpret_cast<Signature*
>(data);
Definition: v8-context.h:55
Definition: v8-template.h:1073
Definition: v8-template.h:525
Definition: v8-isolate.h:305
Definition: v8-local-handle.h:356
Definition: v8-local-handle.h:724
Definition: v8-primitive.h:82
Definition: v8-template.h:937
Definition: v8-object.h:49
Definition: v8-function-callback.h:231
Definition: v8-object.h:109
Definition: v8-container.h:147
Definition: v8-template.h:1113
Definition: v8-template.h:49
Definition: libplatform.h:15
PropertyAttribute
Definition: v8-object.h:157
void(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) AccessorNameGetterCallback
Definition: v8-object.h:183
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< Boolean > &info) AccessorNameSetterCallback
Definition: v8-object.h:206
Intercepted(*)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< Boolean > &info) IndexedPropertySetterCallback
Definition: v8-template.h:359
SideEffectType
Definition: v8-object.h:234
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) NamedPropertyDescriptorCallback
Definition: v8-template.h:346
void(*)(const PropertyCallbackInfo< Value > &info) IndexedPropertyIterableToListCallback
Definition: v8-template.h:406
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) NamedPropertyGetterCallback
Definition: v8-template.h:189
Intercepted(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< Boolean > &info) NamedPropertySetterCallback
Definition: v8-template.h:219
Intercepted(*)(uint32_t index, const PropertyDescriptor &desc, const PropertyCallbackInfo< Boolean > &info) IndexedPropertyDefinerCallback
Definition: v8-template.h:387
Intrinsic
Definition: v8-template.h:41
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Boolean > &info) IndexedPropertyDeleterCallback
Definition: v8-template.h:371
void(*)(const PropertyCallbackInfo< Array > &info) NamedPropertyEnumeratorCallback
Definition: v8-template.h:288
ConstructorBehavior
Definition: v8-template.h:416
void(*)(const FunctionCallbackInfo< Value > &info) FunctionCallback
Definition: v8-function-callback.h:355
Intercepted(*)(Local< Name > property, const PropertyDescriptor &desc, const PropertyCallbackInfo< Boolean > &info) NamedPropertyDefinerCallback
Definition: v8-template.h:318
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyGetterCallback
Definition: v8-template.h:352
NamedPropertyDefinerCallback NamedPropertyDefinerCallbackV2
Definition: v8-template.h:322
void(*)(const PropertyCallbackInfo< Array > &info) IndexedPropertyEnumeratorCallback
Definition: v8-template.h:380
Intercepted
Definition: v8-template.h:143
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Integer > &info) NamedPropertyQueryCallback
Definition: v8-template.h:252
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:400
bool(*)(Local< Context > accessing_context, Local< Object > accessed_object, Local< Value > data) AccessCheckCallback
Definition: v8-template.h:414
Intercepted(*)(Local< Name > property, const PropertyCallbackInfo< Boolean > &info) NamedPropertyDeleterCallback
Definition: v8-template.h:279
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyDescriptorCallback
Definition: v8-template.h:393
PropertyHandlerFlags
Definition: v8-template.h:681
@ kInternalNewCallbacksSignatures
NamedPropertySetterCallback NamedPropertySetterCallbackV2
Definition: v8-template.h:223
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Integer > &info) IndexedPropertyQueryCallback
Definition: v8-template.h:365
Definition: v8-template.h:801
Definition: v8-template.h:722
#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