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,
204// TODO(https://crbug.com/348660658): deprecate and remove.
206 void (*)(Local<Name> property, Local<Value> value,
207 const PropertyCallbackInfo<void>& info);
208
218 SKIP_SYMBOLS = 16
220
231enum class SideEffectType {
235};
236
245
251
257
262
266class V8_EXPORT Object : public Value {
267 public:
273 Local<Value> key, Local<Value> value);
275 Local<Value> key, Local<Value> value,
276 MaybeLocal<Object> receiver);
277
279 Local<Value> value);
280
292 Local<Name> key,
293 Local<Value> value);
295 uint32_t index,
296 Local<Value> value);
297
308 Local<Context> context, Local<Name> key, Local<Value> value,
309 PropertyAttribute attributes = None);
310
328 Local<Context> context, Local<Name> key, PropertyDescriptor& descriptor);
329
331 Local<Value> key);
333 Local<Value> key,
334 MaybeLocal<Object> receiver);
335
337 uint32_t index);
338
345 Local<Context> context, Local<Value> key);
346
352 Local<Context> context, Local<Name> key);
353
370 Local<Value> key);
371
373 Local<Value> key);
374
376
378 uint32_t index);
379
386 PropertyAttribute attributes = None);
387
393 Local<Context> context, Local<Name> name,
395 Local<Value> data = Local<Value>(), PropertyAttribute attributes = None,
396 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
397 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
399 Local<Context> context, Local<Name> name,
401 Local<Value> data = Local<Value>(), PropertyAttribute attributes = None,
402 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
403 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
404 // TODO(https://crbug.com/348660658): remove once AccessorNameSetterCallback
405 // is removed.
407 Local<Context> context, Local<Name> name,
408 AccessorNameGetterCallback getter, nullptr_t setter = nullptr,
409 Local<Value> data = Local<Value>(), PropertyAttribute attributes = None,
410 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
411 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect) {
412 return SetNativeDataProperty(
413 context, name, getter,
414 static_cast<AccessorNameSetterCallbackV2>(setter), data, attributes,
415 getter_side_effect_type, setter_side_effect_type);
416 }
417
427 Local<Context> context, Local<Name> name,
429 PropertyAttribute attributes = None,
430 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
431 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
432
441 Local<Value> value);
444
452 Local<Context> context);
454 Local<Context> context, KeyCollectionMode mode,
455 PropertyFilter property_filter, IndexFilter index_filter,
456 KeyConversionMode key_conversion = KeyConversionMode::kKeepNumbers);
457
464 Local<Context> context);
465
473 Local<Context> context, PropertyFilter filter,
474 KeyConversionMode key_conversion = KeyConversionMode::kKeepNumbers);
475
481 // TODO(http://crbug.com/333672197): deprecate and remove.
482 V8_DEPRECATE_SOON("Use GetPrototype().")
483 inline Local<Value> GetPrototypeV2() { return GetPrototype(); }
484
490 Local<Value> prototype);
491 // TODO(http://crbug.com/333672197): deprecate and remove.
492 V8_DEPRECATE_SOON("Use SetPrototype().")
493 V8_WARN_UNUSED_RESULT Maybe<bool> SetPrototypeV2(Local<Context> context,
494 Local<Value> prototype) {
495 return SetPrototype(context, prototype);
496 }
497
503
510 Local<Context> context);
511
516
521
524
527 const PersistentBase<Object>& object) {
528 return object.template value<Object>()->InternalFieldCount();
529 }
530
533 const BasicTracedReference<Object>& object) {
534 return object.template value<Object>()->InternalFieldCount();
535 }
536
547 V8_INLINE Local<Data> GetInternalField(int index);
548
550 void SetInternalField(int index, Local<Data> data);
551
557 V8_INLINE void* GetAlignedPointerFromInternalField(int index,
559 V8_INLINE void* GetAlignedPointerFromInternalField(v8::Isolate* isolate,
560 int index,
562
565 const PersistentBase<Object>& object, int index,
567 return object.template value<Object>()->GetAlignedPointerFromInternalField(
568 index, tag);
569 }
570
573 const BasicTracedReference<Object>& object, int index,
575 return object.template value<Object>()->GetAlignedPointerFromInternalField(
576 index, tag);
577 }
578
584 void SetAlignedPointerInInternalField(int index, void* value,
586
587 // Type information for a Wrappable object that got wrapped with
588 // `v8::Object::Wrap()`.
590 const int16_t type_id;
591 };
592
593 // v8::Object::Wrappable serves as the base class for all C++ objects that can
594 // be wrapped by a JavaScript object using `v8::Object::Wrap()`.
595 //
596 // Note that v8::Object::Wrappable` inherits from `NameProvider` and provides
597 // `GetWrapperTypeInfo` to allow subclasses to have smaller object sizes.
598 class Wrappable : public cppgc::GarbageCollected<Wrappable>,
599 public cppgc::NameProvider {
600 public:
601 virtual const WrapperTypeInfo* GetWrapperTypeInfo() const {
602 return nullptr;
603 }
604
605 const char* GetHumanReadableName() const override { return "internal"; }
606
607 virtual void Trace(cppgc::Visitor* visitor) const {}
608 };
609
620 template <CppHeapPointerTag tag, typename T = void>
621 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
622 const v8::Local<v8::Object>& wrapper);
623 template <CppHeapPointerTag tag, typename T = void>
624 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
625 const PersistentBase<Object>& wrapper);
626 template <CppHeapPointerTag tag, typename T = void>
627 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
628 const BasicTracedReference<Object>& wrapper);
629
630 template <typename T = void>
631 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
632 const v8::Local<v8::Object>& wrapper,
633 CppHeapPointerTagRange tag_range);
634 template <typename T = void>
635 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
636 const PersistentBase<Object>& wrapper,
637 CppHeapPointerTagRange tag_range);
638 template <typename T = void>
639 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
640 const BasicTracedReference<Object>& wrapper,
641 CppHeapPointerTagRange tag_range);
642
652 template <CppHeapPointerTag tag>
653 static V8_INLINE void Wrap(v8::Isolate* isolate,
654 const v8::Local<v8::Object>& wrapper,
655 Wrappable* wrappable);
656 template <CppHeapPointerTag tag>
657 static V8_INLINE void Wrap(v8::Isolate* isolate,
658 const PersistentBase<Object>& wrapper,
659 Wrappable* wrappable);
660 template <CppHeapPointerTag tag>
661 static V8_INLINE void Wrap(v8::Isolate* isolate,
662 const BasicTracedReference<Object>& wrapper,
663 Wrappable* wrappable);
664 static V8_INLINE void Wrap(v8::Isolate* isolate,
665 const v8::Local<v8::Object>& wrapper,
666 Wrappable* wrappable, CppHeapPointerTag tag);
667 static V8_INLINE void Wrap(v8::Isolate* isolate,
668 const PersistentBase<Object>& wrapper,
669 Wrappable* wrappable, CppHeapPointerTag tag);
670 static V8_INLINE void Wrap(v8::Isolate* isolate,
671 const BasicTracedReference<Object>& wrapper,
672 Wrappable* wrappable, CppHeapPointerTag tag);
673
674 // Version of Wrap() function for v8::Context::Global() objects.
675 // Unlike the functions above it wraps both JSGlobalProxy and its hidden
676 // prototype (JSGlobalObject or remote object).
677 static void WrapGlobal(v8::Isolate* isolate,
678 const v8::Local<v8::Object>& wrapper,
679 Wrappable* wrappable, CppHeapPointerTag tag);
680
681 // Checks that wrappables set on JSGlobalProxy and its hidden prototype are
682 // the same.
683 static bool CheckGlobalWrappable(v8::Isolate* isolate,
684 const v8::Local<v8::Object>& wrapper,
685 CppHeapPointerTagRange tag_range);
686
694 Local<Name> key);
696 uint32_t index);
711 Local<Name> key);
713 Local<Context> context, uint32_t index);
715 Local<Context> context, Local<Name> key);
716
722 Local<Context> context, Local<Name> key);
723
731 Local<Name> key);
732
739 Local<Context> context, Local<Name> key);
740
747 Local<Context> context, Local<Name> key);
748
751
754
763
772
779 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
780 MaybeLocal<Context> GetCreationContext();
781
787 Local<Context> GetCreationContextChecked(v8::Isolate* isolate);
788 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
789 Local<Context> GetCreationContextChecked();
790
792 V8_INLINE static MaybeLocal<Context> GetCreationContext(
793 v8::Isolate* isolate, const PersistentBase<Object>& object) {
794 return object.template value<Object>()->GetCreationContext(isolate);
795 }
796 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
797 V8_INLINE static MaybeLocal<Context> GetCreationContext(
798 const PersistentBase<Object>& object);
799
819 void* GetAlignedPointerFromEmbedderDataInCreationContext(
820 v8::Isolate* isolate, int index, EmbedderDataTypeTag tag);
821 void* GetAlignedPointerFromEmbedderDataInCreationContext(
822 int index, EmbedderDataTypeTag tag);
823
829 bool IsCallable() const;
830
834 bool IsConstructor() const;
835
847 bool IsApiWrapper() const;
848
854 bool IsUndetectable() const;
855
861 Local<Value> recv,
862 int argc,
863 Local<Value> argv[]);
864
871 Local<Context> context, int argc, Local<Value> argv[]);
872
882 MaybeLocal<Array> PreviewEntries(bool* is_key_value);
883
884 static Local<Object> New(Isolate* isolate);
885
894 static Local<Object> New(Isolate* isolate, Local<Value> prototype_or_null,
895 Local<Name>* names, Local<Value>* values,
896 size_t length);
897
898 V8_INLINE static Object* Cast(Value* obj);
899
908 bool IsCodeLike(Isolate* isolate) const;
909
910 private:
911 static void* Unwrap(v8::Isolate* isolate, internal::Address wrapper_obj,
912 CppHeapPointerTagRange tag_range);
913 static void Wrap(v8::Isolate* isolate, internal::Address wrapper_obj,
914 CppHeapPointerTag tag, void* wrappable);
915
916 Object();
917 static void CheckCast(Value* obj);
918 Local<Data> SlowGetInternalField(int index);
919 void* SlowGetAlignedPointerFromInternalField(int index,
921 void* SlowGetAlignedPointerFromInternalField(v8::Isolate* isolate, int index,
923};
924
925// --- Implementation ---
926
927Local<Data> Object::GetInternalField(int index) {
928#ifndef V8_ENABLE_CHECKS
929 using A = internal::Address;
930 using I = internal::Internals;
931 A obj = internal::ValueHelper::ValueAsAddress(this);
932 // Fast path: If the object is a plain JSObject, which is the common case, we
933 // know where to find the internal fields and can return the value directly.
934 int instance_type = I::GetInstanceType(obj);
935 if (I::CanHaveInternalField(instance_type)) {
936 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
937 (I::kEmbedderDataSlotSize * index);
938 A value = I::ReadRawField<A>(obj, offset);
939#ifdef V8_COMPRESS_POINTERS
940 // We read the full pointer value and then decompress it in order to avoid
941 // dealing with potential endianness issues.
942 value = I::DecompressTaggedField(obj, static_cast<uint32_t>(value));
943#endif
944
945 auto* isolate = I::GetCurrentIsolate();
946 return Local<Data>::New(isolate, value);
947 }
948#endif
949 return SlowGetInternalField(index);
950}
951
952void* Object::GetAlignedPointerFromInternalField(v8::Isolate* isolate,
953 int index,
955#if !defined(V8_ENABLE_CHECKS)
956 using A = internal::Address;
957 using I = internal::Internals;
958 A obj = internal::ValueHelper::ValueAsAddress(this);
959 // Fast path: If the object is a plain JSObject, which is the common case, we
960 // know where to find the internal fields and can return the value directly.
961 auto instance_type = I::GetInstanceType(obj);
962 if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
963 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
964 (I::kEmbedderDataSlotSize * index) +
965 I::kEmbedderDataSlotExternalPointerOffset;
966 A value = I::ReadExternalPointerField(isolate, obj, offset,
968 return reinterpret_cast<void*>(value);
969 }
970#endif
971 return SlowGetAlignedPointerFromInternalField(isolate, index, tag);
972}
973
974void* Object::GetAlignedPointerFromInternalField(int index,
976#if !defined(V8_ENABLE_CHECKS)
977 using A = internal::Address;
978 using I = internal::Internals;
979 A obj = internal::ValueHelper::ValueAsAddress(this);
980 // Fast path: If the object is a plain JSObject, which is the common case, we
981 // know where to find the internal fields and can return the value directly.
982 auto instance_type = I::GetInstanceType(obj);
983 if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
984 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
985 (I::kEmbedderDataSlotSize * index) +
986 I::kEmbedderDataSlotExternalPointerOffset;
987 Isolate* isolate = I::GetCurrentIsolateForSandbox();
988 A value = I::ReadExternalPointerField(isolate, obj, offset,
990 return reinterpret_cast<void*>(value);
991 }
992#endif
993 return SlowGetAlignedPointerFromInternalField(index, tag);
994}
995
996// static
997template <CppHeapPointerTag tag, typename T>
998T* Object::Unwrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper) {
999 CppHeapPointerTagRange tag_range(tag, tag);
1000 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
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 <CppHeapPointerTag tag, typename T>
1011T* Object::Unwrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper) {
1012 CppHeapPointerTagRange tag_range(tag, tag);
1013 auto obj =
1014 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1015#if !defined(V8_ENABLE_CHECKS)
1016 return internal::ReadCppHeapPointerField<T>(
1017 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1018#else // defined(V8_ENABLE_CHECKS)
1019 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1020#endif // defined(V8_ENABLE_CHECKS)
1021}
1022
1023// static
1024template <CppHeapPointerTag tag, typename T>
1025T* Object::Unwrap(v8::Isolate* isolate,
1026 const BasicTracedReference<Object>& wrapper) {
1027 CppHeapPointerTagRange tag_range(tag, tag);
1028 auto obj =
1029 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1030#if !defined(V8_ENABLE_CHECKS)
1031 return internal::ReadCppHeapPointerField<T>(
1032 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1033#else // defined(V8_ENABLE_CHECKS)
1034 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1035#endif // defined(V8_ENABLE_CHECKS)
1036}
1037
1038// static
1039template <typename T>
1040T* Object::Unwrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1041 CppHeapPointerTagRange tag_range) {
1042 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1043#if !defined(V8_ENABLE_CHECKS)
1044 return internal::ReadCppHeapPointerField<T>(
1045 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1046#else // defined(V8_ENABLE_CHECKS)
1047 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1048#endif // defined(V8_ENABLE_CHECKS)
1049}
1050
1051// static
1052template <typename T>
1053T* Object::Unwrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper,
1054 CppHeapPointerTagRange tag_range) {
1055 auto obj =
1056 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1057#if !defined(V8_ENABLE_CHECKS)
1058 return internal::ReadCppHeapPointerField<T>(
1059 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1060#else // defined(V8_ENABLE_CHECKS)
1061
1062 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1063#endif // defined(V8_ENABLE_CHECKS)
1064}
1065
1066// static
1067template <typename T>
1068T* Object::Unwrap(v8::Isolate* isolate,
1069 const BasicTracedReference<Object>& wrapper,
1070 CppHeapPointerTagRange tag_range) {
1071 auto obj =
1072 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1073#if !defined(V8_ENABLE_CHECKS)
1074 return internal::ReadCppHeapPointerField<T>(
1075 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1076#else // defined(V8_ENABLE_CHECKS)
1077 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1078#endif // defined(V8_ENABLE_CHECKS)
1079}
1080
1081// static
1082template <CppHeapPointerTag tag>
1083void Object::Wrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1084 v8::Object::Wrappable* wrappable) {
1085 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1086 Wrap(isolate, obj, tag, wrappable);
1087}
1088
1089// static
1090template <CppHeapPointerTag tag>
1091void Object::Wrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper,
1092 v8::Object::Wrappable* wrappable) {
1093 auto obj =
1094 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1095 Wrap(isolate, obj, tag, wrappable);
1096}
1097
1098// static
1099template <CppHeapPointerTag tag>
1100void Object::Wrap(v8::Isolate* isolate,
1101 const BasicTracedReference<Object>& wrapper,
1102 v8::Object::Wrappable* wrappable) {
1103 auto obj =
1104 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1105 Wrap(isolate, obj, tag, wrappable);
1106}
1107
1108// static
1109void Object::Wrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1110 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1111 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1112 Wrap(isolate, obj, tag, wrappable);
1113}
1114
1115// static
1116void Object::Wrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper,
1117 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1118 auto obj =
1119 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1120 Wrap(isolate, obj, tag, wrappable);
1121}
1122
1123// static
1124void Object::Wrap(v8::Isolate* isolate,
1125 const BasicTracedReference<Object>& wrapper,
1126 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1127 auto obj =
1128 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1129 Wrap(isolate, obj, tag, wrappable);
1130}
1131
1132Private* Private::Cast(Data* data) {
1133#ifdef V8_ENABLE_CHECKS
1134 CheckCast(data);
1135#endif
1136 return reinterpret_cast<Private*>(data);
1137}
1138
1139Object* Object::Cast(v8::Value* value) {
1140#ifdef V8_ENABLE_CHECKS
1141 CheckCast(value);
1142#endif
1143 return static_cast<Object*>(value);
1144}
1145
1146} // namespace v8
1147
1148#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:599
const char * GetHumanReadableName() const override
Definition: v8-object.h:605
virtual const WrapperTypeInfo * GetWrapperTypeInfo() const
Definition: v8-object.h:601
virtual void Trace(cppgc::Visitor *visitor) const
Definition: v8-object.h:607
Definition: v8-object.h:266
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 > SetPrototype(Local< Context > context, Local< Value > prototype)
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:564
static int InternalFieldCount(const PersistentBase< Object > &object)
Definition: v8-object.h:526
MaybeLocal< Value > GetRealNamedPropertyInPrototypeChain(Local< Context > context, Local< Name > key)
static int InternalFieldCount(const BasicTracedReference< Object > &object)
Definition: v8-object.h:532
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)
Local< Value > GetPrototype()
MaybeLocal< Value > GetPrivate(Local< Context > context, Local< Private > key)
Maybe< bool > SetNativeDataProperty(Local< Context > context, Local< Name > name, AccessorNameGetterCallback getter, nullptr_t setter=nullptr, Local< Value > data=Local< Value >(), PropertyAttribute attributes=None, SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect, SideEffectType setter_side_effect_type=SideEffectType::kHasSideEffect)
Definition: v8-object.h:406
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:572
Maybe< bool > HasRealIndexedProperty(Local< Context > context, uint32_t index)
MaybeLocal< String > ObjectProtoToString(Local< Context > context)
Maybe< bool > SetNativeDataProperty(Local< Context > context, Local< Name > name, AccessorNameGetterCallback getter, AccessorNameSetterCallback setter, Local< Value > data=Local< Value >(), PropertyAttribute attributes=None, SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect, SideEffectType setter_side_effect_type=SideEffectType::kHasSideEffect)
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
Maybe< PropertyAttribute > GetRealNamedPropertyAttributes(Local< Context > context, Local< Name > key)
Maybe< bool > SetNativeDataProperty(Local< Context > context, Local< Name > name, AccessorNameGetterCallback getter, AccessorNameSetterCallbackV2 setter, Local< Value > data=Local< Value >(), PropertyAttribute attributes=None, SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect, SideEffectType setter_side_effect_type=SideEffectType::kHasSideEffect)
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:984
ExternalPointerTag
Definition: v8-internal.h:636
uintptr_t Address
Definition: v8-internal.h:38
Definition: libplatform.h:15
IntegrityLevel
Definition: v8-object.h:261
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:244
void(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) AccessorNameGetterCallback
Definition: v8-object.h:180
SideEffectType
Definition: v8-object.h:231
IndexFilter
Definition: v8-object.h:250
KeyConversionMode
Definition: v8-object.h:256
CppHeapPointerTag
Definition: v8-sandbox.h:28
constexpr EmbedderDataTypeTag kEmbedderDataTypeTagDefault
Definition: v8-object.h:36
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< Boolean > &info) AccessorNameSetterCallbackV2
Definition: v8-object.h:203
uint16_t EmbedderDataTypeTag
Definition: v8-object.h:34
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) AccessorNameSetterCallback
Definition: v8-object.h:207
PropertyFilter
Definition: v8-object.h:212
@ ONLY_CONFIGURABLE
Definition: v8-object.h:216
@ SKIP_SYMBOLS
Definition: v8-object.h:218
@ ONLY_WRITABLE
Definition: v8-object.h:214
@ ALL_PROPERTIES
Definition: v8-object.h:213
@ SKIP_STRINGS
Definition: v8-object.h:217
@ ONLY_ENUMERABLE
Definition: v8-object.h:215
Definition: v8-object.h:589
const int16_t type_id
Definition: v8-object.h:590
Definition: v8-internal.h:486
#define V8_EXPORT
Definition: v8config.h:854
#define V8_INLINE
Definition: v8config.h:508
#define V8_DEPRECATE_SOON(message)
Definition: v8config.h:621
#define V8_LIKELY(condition)
Definition: v8config.h:668
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:678