Loading...
Searching...
No Matches
v8-object.h
Go to the documentation of this file.
1// Copyright 2021 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef INCLUDE_V8_OBJECT_H_
6#define INCLUDE_V8_OBJECT_H_
7
10#include "v8-internal.h" // NOLINT(build/include_directory)
11#include "v8-local-handle.h" // NOLINT(build/include_directory)
12#include "v8-maybe.h" // NOLINT(build/include_directory)
13#include "v8-persistent-handle.h" // NOLINT(build/include_directory)
14#include "v8-primitive.h" // NOLINT(build/include_directory)
15#include "v8-sandbox.h" // NOLINT(build/include_directory)
16#include "v8-traced-handle.h" // NOLINT(build/include_directory)
17#include "v8-value.h" // NOLINT(build/include_directory)
18#include "v8config.h" // NOLINT(build/include_directory)
19
20namespace v8 {
21
22class Array;
23class Function;
24class FunctionTemplate;
25template <typename T>
26class PropertyCallbackInfo;
27
34using EmbedderDataTypeTag = uint16_t;
35
37
40
46class V8_EXPORT Private : public Data {
47 public:
52
56 static Local<Private> New(Isolate* isolate,
58
69
70 V8_INLINE static Private* Cast(Data* data);
71
72 private:
73 Private();
74
75 static void CheckCast(Data* that);
76};
77
107 public:
108 // GenericDescriptor
110
111 // DataDescriptor
113
114 // DataDescriptor with writable property
115 PropertyDescriptor(Local<Value> value, bool writable);
116
117 // AccessorDescriptor
119
121
123 bool has_value() const;
124
126 bool has_get() const;
128 bool has_set() const;
129
130 void set_enumerable(bool enumerable);
131 bool enumerable() const;
132 bool has_enumerable() const;
133
134 void set_configurable(bool configurable);
135 bool configurable() const;
136 bool has_configurable() const;
137
138 bool writable() const;
139 bool has_writable() const;
140
141 struct PrivateData;
142 PrivateData* get_private() const { return private_; }
143
145 void operator=(const PropertyDescriptor&) = delete;
146
147 private:
148 PrivateData* private_;
149};
150
156 None = 0,
158 ReadOnly = 1 << 0,
160 DontEnum = 1 << 1,
162 DontDelete = 1 << 2
164
180 void (*)(Local<Name> property, const PropertyCallbackInfo<Value>& info);
181
202 void (*)(Local<Name> property, Local<Value> value,
203 const PropertyCallbackInfo<void>& info);
204
214 SKIP_SYMBOLS = 16
216
227enum class SideEffectType {
231};
232
241
247
253
258
262class V8_EXPORT Object : public Value {
263 public:
269 Local<Value> key, Local<Value> value);
271 Local<Value> key, Local<Value> value,
272 MaybeLocal<Object> receiver);
273
275 Local<Value> value);
276
288 Local<Name> key,
289 Local<Value> value);
291 uint32_t index,
292 Local<Value> value);
293
304 Local<Context> context, Local<Name> key, Local<Value> value,
305 PropertyAttribute attributes = None);
306
324 Local<Context> context, Local<Name> key, PropertyDescriptor& descriptor);
325
327 Local<Value> key);
329 Local<Value> key,
330 MaybeLocal<Object> receiver);
331
333 uint32_t index);
334
341 Local<Context> context, Local<Value> key);
342
348 Local<Context> context, Local<Name> key);
349
366 Local<Value> key);
367
369 Local<Value> key);
370
372
374 uint32_t index);
375
382 PropertyAttribute attributes = None);
383
389 Local<Context> context, Local<Name> name,
391 AccessorNameSetterCallback setter = nullptr,
392 Local<Value> data = Local<Value>(), PropertyAttribute attributes = None,
393 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
394 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
395
405 Local<Context> context, Local<Name> name,
407 PropertyAttribute attributes = None,
408 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
409 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
410
419 Local<Value> value);
422
430 Local<Context> context);
432 Local<Context> context, KeyCollectionMode mode,
433 PropertyFilter property_filter, IndexFilter index_filter,
434 KeyConversionMode key_conversion = KeyConversionMode::kKeepNumbers);
435
442 Local<Context> context);
443
451 Local<Context> context, PropertyFilter filter,
452 KeyConversionMode key_conversion = KeyConversionMode::kKeepNumbers);
453
460
467 Local<Value> prototype);
468
474
481 Local<Context> context);
482
487
492
495
498 const PersistentBase<Object>& object) {
499 return object.template value<Object>()->InternalFieldCount();
500 }
501
504 const BasicTracedReference<Object>& object) {
505 return object.template value<Object>()->InternalFieldCount();
506 }
507
518 V8_INLINE Local<Data> GetInternalField(int index);
519
521 void SetInternalField(int index, Local<Data> data);
522
528 V8_INLINE void* GetAlignedPointerFromInternalField(int index,
530 V8_INLINE void* GetAlignedPointerFromInternalField(v8::Isolate* isolate,
531 int index,
533
536 const PersistentBase<Object>& object, int index,
538 return object.template value<Object>()->GetAlignedPointerFromInternalField(
539 index, tag);
540 }
541
544 const BasicTracedReference<Object>& object, int index,
546 return object.template value<Object>()->GetAlignedPointerFromInternalField(
547 index, tag);
548 }
549
555 void SetAlignedPointerInInternalField(int index, void* value,
557
558 // Type information for a Wrappable object that got wrapped with
559 // `v8::Object::Wrap()`.
561 const int16_t type_id;
562 };
563
564 // v8::Object::Wrappable serves as the base class for all C++ objects that can
565 // be wrapped by a JavaScript object using `v8::Object::Wrap()`.
566 //
567 // Note that v8::Object::Wrappable` inherits from `NameProvider` and provides
568 // `GetWrapperTypeInfo` to allow subclasses to have smaller object sizes.
569 class Wrappable : public cppgc::GarbageCollected<Wrappable>,
570 public cppgc::NameProvider {
571 public:
572 virtual const WrapperTypeInfo* GetWrapperTypeInfo() const {
573 return nullptr;
574 }
575
576 const char* GetHumanReadableName() const override { return "internal"; }
577
578 virtual void Trace(cppgc::Visitor* visitor) const {}
579 };
580
591 template <CppHeapPointerTag tag, typename T = void>
592 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
593 const v8::Local<v8::Object>& wrapper);
594 template <CppHeapPointerTag tag, typename T = void>
595 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
596 const PersistentBase<Object>& wrapper);
597 template <CppHeapPointerTag tag, typename T = void>
598 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
599 const BasicTracedReference<Object>& wrapper);
600
601 template <typename T = void>
602 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
603 const v8::Local<v8::Object>& wrapper,
604 CppHeapPointerTagRange tag_range);
605 template <typename T = void>
606 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
607 const PersistentBase<Object>& wrapper,
608 CppHeapPointerTagRange tag_range);
609 template <typename T = void>
610 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
611 const BasicTracedReference<Object>& wrapper,
612 CppHeapPointerTagRange tag_range);
613
623 template <CppHeapPointerTag tag>
624 static V8_INLINE void Wrap(v8::Isolate* isolate,
625 const v8::Local<v8::Object>& wrapper,
626 Wrappable* wrappable);
627 template <CppHeapPointerTag tag>
628 static V8_INLINE void Wrap(v8::Isolate* isolate,
629 const PersistentBase<Object>& wrapper,
630 Wrappable* wrappable);
631 template <CppHeapPointerTag tag>
632 static V8_INLINE void Wrap(v8::Isolate* isolate,
633 const BasicTracedReference<Object>& wrapper,
634 Wrappable* wrappable);
635 static V8_INLINE void Wrap(v8::Isolate* isolate,
636 const v8::Local<v8::Object>& wrapper,
637 Wrappable* wrappable, CppHeapPointerTag tag);
638 static V8_INLINE void Wrap(v8::Isolate* isolate,
639 const PersistentBase<Object>& wrapper,
640 Wrappable* wrappable, CppHeapPointerTag tag);
641 static V8_INLINE void Wrap(v8::Isolate* isolate,
642 const BasicTracedReference<Object>& wrapper,
643 Wrappable* wrappable, CppHeapPointerTag tag);
644
645 // Version of Wrap() function for v8::Context::Global() objects.
646 // Unlike the functions above it wraps both JSGlobalProxy and its hidden
647 // prototype (JSGlobalObject or remote object).
648 static void WrapGlobal(v8::Isolate* isolate,
649 const v8::Local<v8::Object>& wrapper,
650 Wrappable* wrappable, CppHeapPointerTag tag);
651
652 // Checks that wrappables set on JSGlobalProxy and its hidden prototype are
653 // the same.
654 static bool CheckGlobalWrappable(v8::Isolate* isolate,
655 const v8::Local<v8::Object>& wrapper,
656 CppHeapPointerTagRange tag_range);
657
665 Local<Name> key);
667 uint32_t index);
682 Local<Name> key);
684 Local<Context> context, uint32_t index);
686 Local<Context> context, Local<Name> key);
687
693 Local<Context> context, Local<Name> key);
694
702 Local<Name> key);
703
710 Local<Context> context, Local<Name> key);
711
718 Local<Context> context, Local<Name> key);
719
722
725
734
743
750 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
751 MaybeLocal<Context> GetCreationContext();
752
758 Local<Context> GetCreationContextChecked(v8::Isolate* isolate);
759 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
760 Local<Context> GetCreationContextChecked();
761
763 V8_INLINE static MaybeLocal<Context> GetCreationContext(
764 v8::Isolate* isolate, const PersistentBase<Object>& object) {
765 return object.template value<Object>()->GetCreationContext(isolate);
766 }
767 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
768 V8_INLINE static MaybeLocal<Context> GetCreationContext(
769 const PersistentBase<Object>& object);
770
790 void* GetAlignedPointerFromEmbedderDataInCreationContext(
791 v8::Isolate* isolate, int index, EmbedderDataTypeTag tag);
792 void* GetAlignedPointerFromEmbedderDataInCreationContext(
793 int index, EmbedderDataTypeTag tag);
794
800 bool IsCallable() const;
801
805 bool IsConstructor() const;
806
818 bool IsApiWrapper() const;
819
825 bool IsUndetectable() const;
826
832 Local<Value> recv,
833 int argc,
834 Local<Value> argv[]);
835
842 Local<Context> context, int argc, Local<Value> argv[]);
843
853 MaybeLocal<Array> PreviewEntries(bool* is_key_value);
854
855 static Local<Object> New(Isolate* isolate);
856
865 static Local<Object> New(Isolate* isolate, Local<Value> prototype_or_null,
866 Local<Name>* names, Local<Value>* values,
867 size_t length);
868
869 V8_INLINE static Object* Cast(Value* obj);
870
879 bool IsCodeLike(Isolate* isolate) const;
880
881 private:
882 static void* Unwrap(v8::Isolate* isolate, internal::Address wrapper_obj,
883 CppHeapPointerTagRange tag_range);
884 static void Wrap(v8::Isolate* isolate, internal::Address wrapper_obj,
885 CppHeapPointerTag tag, void* wrappable);
886
887 Object();
888 static void CheckCast(Value* obj);
889 Local<Data> SlowGetInternalField(int index);
890 void* SlowGetAlignedPointerFromInternalField(int index,
892 void* SlowGetAlignedPointerFromInternalField(v8::Isolate* isolate, int index,
894};
895
896// --- Implementation ---
897
898Local<Data> Object::GetInternalField(int index) {
899#ifndef V8_ENABLE_CHECKS
900 using A = internal::Address;
901 using I = internal::Internals;
902 A obj = internal::ValueHelper::ValueAsAddress(this);
903 // Fast path: If the object is a plain JSObject, which is the common case, we
904 // know where to find the internal fields and can return the value directly.
905 int instance_type = I::GetInstanceType(obj);
906 if (I::CanHaveInternalField(instance_type)) {
907 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
908 (I::kEmbedderDataSlotSize * index);
909 A value = I::ReadRawField<A>(obj, offset);
910#ifdef V8_COMPRESS_POINTERS
911 // We read the full pointer value and then decompress it in order to avoid
912 // dealing with potential endianness issues.
913 value = I::DecompressTaggedField(obj, static_cast<uint32_t>(value));
914#endif
915
916 auto* isolate = I::GetCurrentIsolate();
917 return Local<Data>::New(isolate, value);
918 }
919#endif
920 return SlowGetInternalField(index);
921}
922
923void* Object::GetAlignedPointerFromInternalField(v8::Isolate* isolate,
924 int index,
926#if !defined(V8_ENABLE_CHECKS)
927 using A = internal::Address;
928 using I = internal::Internals;
929 A obj = internal::ValueHelper::ValueAsAddress(this);
930 // Fast path: If the object is a plain JSObject, which is the common case, we
931 // know where to find the internal fields and can return the value directly.
932 auto instance_type = I::GetInstanceType(obj);
933 if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
934 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
935 (I::kEmbedderDataSlotSize * index) +
936 I::kEmbedderDataSlotExternalPointerOffset;
937 A value = I::ReadExternalPointerField(isolate, obj, offset,
939 return reinterpret_cast<void*>(value);
940 }
941#endif
942 return SlowGetAlignedPointerFromInternalField(isolate, index, tag);
943}
944
945void* Object::GetAlignedPointerFromInternalField(int index,
947#if !defined(V8_ENABLE_CHECKS)
948 using A = internal::Address;
949 using I = internal::Internals;
950 A obj = internal::ValueHelper::ValueAsAddress(this);
951 // Fast path: If the object is a plain JSObject, which is the common case, we
952 // know where to find the internal fields and can return the value directly.
953 auto instance_type = I::GetInstanceType(obj);
954 if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
955 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
956 (I::kEmbedderDataSlotSize * index) +
957 I::kEmbedderDataSlotExternalPointerOffset;
958 Isolate* isolate = I::GetCurrentIsolateForSandbox();
959 A value = I::ReadExternalPointerField(isolate, obj, offset,
961 return reinterpret_cast<void*>(value);
962 }
963#endif
964 return SlowGetAlignedPointerFromInternalField(index, tag);
965}
966
967// static
968template <CppHeapPointerTag tag, typename T>
969T* Object::Unwrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper) {
970 CppHeapPointerTagRange tag_range(tag, tag);
971 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
972#if !defined(V8_ENABLE_CHECKS)
973 return internal::ReadCppHeapPointerField<T>(
974 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
975#else // defined(V8_ENABLE_CHECKS)
976 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
977#endif // defined(V8_ENABLE_CHECKS)
978}
979
980// static
981template <CppHeapPointerTag tag, typename T>
982T* Object::Unwrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper) {
983 CppHeapPointerTagRange tag_range(tag, tag);
984 auto obj =
985 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
986#if !defined(V8_ENABLE_CHECKS)
987 return internal::ReadCppHeapPointerField<T>(
988 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
989#else // defined(V8_ENABLE_CHECKS)
990 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
991#endif // defined(V8_ENABLE_CHECKS)
992}
993
994// static
995template <CppHeapPointerTag tag, typename T>
996T* Object::Unwrap(v8::Isolate* isolate,
997 const BasicTracedReference<Object>& wrapper) {
998 CppHeapPointerTagRange tag_range(tag, tag);
999 auto obj =
1000 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1001#if !defined(V8_ENABLE_CHECKS)
1002 return internal::ReadCppHeapPointerField<T>(
1003 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1004#else // defined(V8_ENABLE_CHECKS)
1005 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1006#endif // defined(V8_ENABLE_CHECKS)
1007}
1008
1009// static
1010template <typename T>
1011T* Object::Unwrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1012 CppHeapPointerTagRange tag_range) {
1013 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1014#if !defined(V8_ENABLE_CHECKS)
1015 return internal::ReadCppHeapPointerField<T>(
1016 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1017#else // defined(V8_ENABLE_CHECKS)
1018 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1019#endif // defined(V8_ENABLE_CHECKS)
1020}
1021
1022// static
1023template <typename T>
1024T* Object::Unwrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper,
1025 CppHeapPointerTagRange tag_range) {
1026 auto obj =
1027 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1028#if !defined(V8_ENABLE_CHECKS)
1029 return internal::ReadCppHeapPointerField<T>(
1030 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1031#else // defined(V8_ENABLE_CHECKS)
1032
1033 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1034#endif // defined(V8_ENABLE_CHECKS)
1035}
1036
1037// static
1038template <typename T>
1039T* Object::Unwrap(v8::Isolate* isolate,
1040 const BasicTracedReference<Object>& wrapper,
1041 CppHeapPointerTagRange tag_range) {
1042 auto obj =
1043 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1044#if !defined(V8_ENABLE_CHECKS)
1045 return internal::ReadCppHeapPointerField<T>(
1046 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1047#else // defined(V8_ENABLE_CHECKS)
1048 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1049#endif // defined(V8_ENABLE_CHECKS)
1050}
1051
1052// static
1053template <CppHeapPointerTag tag>
1054void Object::Wrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1055 v8::Object::Wrappable* wrappable) {
1056 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1057 Wrap(isolate, obj, tag, wrappable);
1058}
1059
1060// static
1061template <CppHeapPointerTag tag>
1062void Object::Wrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper,
1063 v8::Object::Wrappable* wrappable) {
1064 auto obj =
1065 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1066 Wrap(isolate, obj, tag, wrappable);
1067}
1068
1069// static
1070template <CppHeapPointerTag tag>
1071void Object::Wrap(v8::Isolate* isolate,
1072 const BasicTracedReference<Object>& wrapper,
1073 v8::Object::Wrappable* wrappable) {
1074 auto obj =
1075 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1076 Wrap(isolate, obj, tag, wrappable);
1077}
1078
1079// static
1080void Object::Wrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1081 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1082 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1083 Wrap(isolate, obj, tag, wrappable);
1084}
1085
1086// static
1087void Object::Wrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper,
1088 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1089 auto obj =
1090 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1091 Wrap(isolate, obj, tag, wrappable);
1092}
1093
1094// static
1095void Object::Wrap(v8::Isolate* isolate,
1096 const BasicTracedReference<Object>& wrapper,
1097 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1098 auto obj =
1099 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1100 Wrap(isolate, obj, tag, wrappable);
1101}
1102
1103Private* Private::Cast(Data* data) {
1104#ifdef V8_ENABLE_CHECKS
1105 CheckCast(data);
1106#endif
1107 return reinterpret_cast<Private*>(data);
1108}
1109
1110Object* Object::Cast(v8::Value* value) {
1111#ifdef V8_ENABLE_CHECKS
1112 CheckCast(value);
1113#endif
1114 return static_cast<Object*>(value);
1115}
1116
1117} // namespace v8
1118
1119#endif // INCLUDE_V8_OBJECT_H_
Definition: garbage-collected.h:53
Definition: name-provider.h:26
Definition: visitor.h:75
Definition: v8-container.h:25
Definition: v8-traced-handle.h:124
Definition: v8-context.h:48
Definition: v8-data.h:18
Definition: v8-isolate.h:291
Definition: v8-local-handle.h:366
Definition: v8-local-handle.h:734
Definition: v8-maybe.h:39
Definition: v8-primitive.h:79
Definition: v8-object.h:570
const char * GetHumanReadableName() const override
Definition: v8-object.h:576
virtual const WrapperTypeInfo * GetWrapperTypeInfo() const
Definition: v8-object.h:572
virtual void Trace(cppgc::Visitor *visitor) const
Definition: v8-object.h:578
Definition: v8-object.h:262
Maybe< PropertyAttribute > GetRealNamedPropertyAttributesInPrototypeChain(Local< Context > context, Local< Name > key)
Maybe< PropertyAttribute > GetPropertyAttributes(Local< Context > context, Local< Value > key)
Maybe< bool > CreateDataProperty(Local< Context > context, uint32_t index, Local< Value > value)
MaybeLocal< Value > GetOwnPropertyDescriptor(Local< Context > context, Local< Name > key)
bool HasNamedLookupInterceptor() const
Maybe< bool > SetPrivate(Local< Context > context, Local< Private > key, Local< Value > value)
Maybe< bool > HasRealNamedProperty(Local< Context > context, Local< Name > key)
MaybeLocal< Array > GetPropertyNames(Local< Context > context)
Maybe< bool > Delete(Local< Context > context, uint32_t index)
MaybeLocal< Value > GetRealNamedProperty(Local< Context > context, Local< Name > key)
Maybe< bool > DefineProperty(Local< Context > context, Local< Name > key, PropertyDescriptor &descriptor)
Maybe< bool > Delete(Local< Context > context, Local< Value > key)
Local< Object > Clone()
Maybe< bool > DefineOwnProperty(Local< Context > context, Local< Name > key, Local< Value > value, PropertyAttribute attributes=None)
static void * GetAlignedPointerFromInternalField(const PersistentBase< Object > &object, int index, EmbedderDataTypeTag tag)
Definition: v8-object.h:535
Maybe< bool > SetNativeDataProperty(Local< Context > context, Local< Name > name, AccessorNameGetterCallback getter, AccessorNameSetterCallback setter=nullptr, Local< Value > data=Local< Value >(), PropertyAttribute attributes=None, SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect, SideEffectType setter_side_effect_type=SideEffectType::kHasSideEffect)
static int InternalFieldCount(const PersistentBase< Object > &object)
Definition: v8-object.h:497
MaybeLocal< Value > GetRealNamedPropertyInPrototypeChain(Local< Context > context, Local< Name > key)
static int InternalFieldCount(const BasicTracedReference< Object > &object)
Definition: v8-object.h:503
Maybe< bool > Has(Local< Context > context, Local< Value > key)
void SetAlignedPointerInInternalField(int index, void *value, EmbedderDataTypeTag tag)
MaybeLocal< Array > GetOwnPropertyNames(Local< Context > context)
Maybe< bool > Set(Local< Context > context, Local< Value > key, Local< Value > value)
MaybeLocal< Value > GetPrivate(Local< Context > context, Local< Private > key)
Maybe< bool > SetPrototypeV2(Local< Context > context, Local< Value > prototype)
void SetAccessorProperty(Local< Name > name, Local< Function > getter, Local< Function > setter=Local< Function >(), PropertyAttribute attributes=None)
Maybe< bool > CreateDataProperty(Local< Context > context, Local< Name > key, Local< Value > value)
static void * GetAlignedPointerFromInternalField(const BasicTracedReference< Object > &object, int index, EmbedderDataTypeTag tag)
Definition: v8-object.h:543
Maybe< bool > HasRealIndexedProperty(Local< Context > context, uint32_t index)
MaybeLocal< String > ObjectProtoToString(Local< Context > context)
Maybe< bool > SetLazyDataProperty(Local< Context > context, Local< Name > name, AccessorNameGetterCallback getter, Local< Value > data=Local< Value >(), PropertyAttribute attributes=None, SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect, SideEffectType setter_side_effect_type=SideEffectType::kHasSideEffect)
MaybeLocal< Value > Get(Local< Context > context, uint32_t index)
static void WrapGlobal(v8::Isolate *isolate, const v8::Local< v8::Object > &wrapper, Wrappable *wrappable, CppHeapPointerTag tag)
Maybe< bool > SetIntegrityLevel(Local< Context > context, IntegrityLevel level)
MaybeLocal< Array > GetPropertyNames(Local< Context > context, KeyCollectionMode mode, PropertyFilter property_filter, IndexFilter index_filter, KeyConversionMode key_conversion=KeyConversionMode::kKeepNumbers)
int InternalFieldCount() const
Local< Value > GetPrototypeV2()
Maybe< PropertyAttribute > GetRealNamedPropertyAttributes(Local< Context > context, Local< Name > key)
static bool CheckGlobalWrappable(v8::Isolate *isolate, const v8::Local< v8::Object > &wrapper, CppHeapPointerTagRange tag_range)
Maybe< bool > HasPrivate(Local< Context > context, Local< Private > key)
Local< Object > FindInstanceInPrototypeChain(Local< FunctionTemplate > tmpl)
MaybeLocal< Value > Get(Local< Context > context, Local< Value > key)
int GetIdentityHash()
MaybeLocal< Context > GetCreationContext(v8::Isolate *isolate)
void SetInternalField(int index, Local< Data > data)
MaybeLocal< Array > GetOwnPropertyNames(Local< Context > context, PropertyFilter filter, KeyConversionMode key_conversion=KeyConversionMode::kKeepNumbers)
Maybe< bool > Set(Local< Context > context, uint32_t index, Local< Value > value)
Local< Object > Clone(v8::Isolate *isolate)
Maybe< bool > HasOwnProperty(Local< Context > context, Local< Name > key)
Maybe< bool > Has(Local< Context > context, uint32_t index)
Maybe< bool > DeletePrivate(Local< Context > context, Local< Private > key)
Local< String > GetConstructorName()
MaybeLocal< Value > Get(Local< Context > context, Local< Value > key, MaybeLocal< Object > receiver)
Maybe< bool > HasRealNamedCallbackProperty(Local< Context > context, Local< Name > key)
Maybe< bool > Set(Local< Context > context, Local< Value > key, Local< Value > value, MaybeLocal< Object > receiver)
Maybe< bool > HasOwnProperty(Local< Context > context, uint32_t index)
bool HasIndexedLookupInterceptor() const
Definition: v8-persistent-handle.h:93
Definition: v8-object.h:46
Local< Value > Name() const
static Local< Private > ForApi(Isolate *isolate, Local< String > name)
static Local< Private > New(Isolate *isolate, Local< String > name=Local< String >())
Definition: v8-function-callback.h:224
Definition: v8-object.h:106
void set_enumerable(bool enumerable)
bool has_writable() const
bool has_value() const
Local< Value > get() const
Local< Value > set() const
PropertyDescriptor(Local< Value > get, Local< Value > set)
bool has_enumerable() const
PropertyDescriptor(Local< Value > value)
PrivateData * get_private() const
Definition: v8-object.h:142
void operator=(const PropertyDescriptor &)=delete
Local< Value > value() const
bool enumerable() const
PropertyDescriptor(Local< Value > value, bool writable)
void set_configurable(bool configurable)
PropertyDescriptor(const PropertyDescriptor &)=delete
bool has_configurable() const
bool configurable() const
Definition: v8-value.h:32
Definition: v8-internal.h:920
ExternalPointerTag
Definition: v8-internal.h:589
uintptr_t Address
Definition: v8-internal.h:38
Definition: libplatform.h:15
IntegrityLevel
Definition: v8-object.h:257
PropertyAttribute
Definition: v8-object.h:154
@ DontEnum
Definition: v8-object.h:160
@ None
Definition: v8-object.h:156
@ DontDelete
Definition: v8-object.h:162
@ ReadOnly
Definition: v8-object.h:158
internal::ExternalPointerTag ToExternalPointerTag(v8::EmbedderDataTypeTag api_tag)
KeyCollectionMode
Definition: v8-object.h:240
void(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) AccessorNameGetterCallback
Definition: v8-object.h:180
SideEffectType
Definition: v8-object.h:227
IndexFilter
Definition: v8-object.h:246
KeyConversionMode
Definition: v8-object.h:252
CppHeapPointerTag
Definition: v8-sandbox.h:28
constexpr EmbedderDataTypeTag kEmbedderDataTypeTagDefault
Definition: v8-object.h:36
uint16_t EmbedderDataTypeTag
Definition: v8-object.h:34
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) AccessorNameSetterCallback
Definition: v8-object.h:203
PropertyFilter
Definition: v8-object.h:208
@ ONLY_CONFIGURABLE
Definition: v8-object.h:212
@ SKIP_SYMBOLS
Definition: v8-object.h:214
@ ONLY_WRITABLE
Definition: v8-object.h:210
@ ALL_PROPERTIES
Definition: v8-object.h:209
@ SKIP_STRINGS
Definition: v8-object.h:213
@ ONLY_ENUMERABLE
Definition: v8-object.h:211
Definition: v8-object.h:560
const int16_t type_id
Definition: v8-object.h:561
Definition: v8-internal.h:484
#define V8_EXPORT
Definition: v8config.h:855
#define V8_INLINE
Definition: v8config.h:508
#define V8_DEPRECATE_SOON(message)
Definition: v8config.h:622
#define V8_LIKELY(condition)
Definition: v8config.h:669
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:679