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
349 Local<Context> context, Local<Value> key);
359 Local<Context> context, Local<Value> key,
360 PropertyAttribute* out_attributes);
361
367 Local<Context> context, Local<Name> key);
368
385 Local<Value> key);
386
388 Local<Value> key);
389
391
393 uint32_t index);
394
401 PropertyAttribute attributes = None);
402
408 Local<Context> context, Local<Name> name,
410 Local<Value> data = Local<Value>(), PropertyAttribute attributes = None,
411 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
412 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
414 Local<Context> context, Local<Name> name,
416 Local<Value> data = Local<Value>(), PropertyAttribute attributes = None,
417 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
418 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
419 // TODO(https://crbug.com/348660658): remove once AccessorNameSetterCallback
420 // is removed.
422 Local<Context> context, Local<Name> name,
423 AccessorNameGetterCallback getter, std::nullptr_t setter = nullptr,
424 Local<Value> data = Local<Value>(), PropertyAttribute attributes = None,
425 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
426 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect) {
427 return SetNativeDataProperty(
428 context, name, getter,
429 static_cast<AccessorNameSetterCallbackV2>(setter), data, attributes,
430 getter_side_effect_type, setter_side_effect_type);
431 }
432
442 Local<Context> context, Local<Name> name,
444 PropertyAttribute attributes = None,
445 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
446 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
447
456 Local<Value> value);
459
467 Local<Context> context);
469 Local<Context> context, KeyCollectionMode mode,
470 PropertyFilter property_filter, IndexFilter index_filter,
471 KeyConversionMode key_conversion = KeyConversionMode::kKeepNumbers);
472
479 Local<Context> context);
480
488 Local<Context> context, PropertyFilter filter,
489 KeyConversionMode key_conversion = KeyConversionMode::kKeepNumbers);
490
496 // TODO(http://crbug.com/333672197): deprecate and remove.
497 V8_DEPRECATE_SOON("Use GetPrototype().")
498 inline Local<Value> GetPrototypeV2() { return GetPrototype(); }
499
505 Local<Value> prototype);
506 // TODO(http://crbug.com/333672197): deprecate and remove.
507 V8_DEPRECATE_SOON("Use SetPrototype().")
508 V8_WARN_UNUSED_RESULT Maybe<bool> SetPrototypeV2(Local<Context> context,
509 Local<Value> prototype) {
510 return SetPrototype(context, prototype);
511 }
512
518
525 Local<Context> context);
526
531
536
539
542 const PersistentBase<Object>& object) {
543 return object.template value<Object>()->InternalFieldCount();
544 }
545
548 const BasicTracedReference<Object>& object) {
549 return object.template value<Object>()->InternalFieldCount();
550 }
551
562 V8_INLINE Local<Data> GetInternalField(int index);
563
565 void SetInternalField(int index, Local<Data> data);
566
572 V8_INLINE void* GetAlignedPointerFromInternalField(int index,
574 V8_INLINE void* GetAlignedPointerFromInternalField(v8::Isolate* isolate,
575 int index,
577
580 const PersistentBase<Object>& object, int index,
582 return object.template value<Object>()->GetAlignedPointerFromInternalField(
583 index, tag);
584 }
585
588 const BasicTracedReference<Object>& object, int index,
590 return object.template value<Object>()->GetAlignedPointerFromInternalField(
591 index, tag);
592 }
593
599 void SetAlignedPointerInInternalField(int index, void* value,
601
602 // Type information for a Wrappable object that got wrapped with
603 // `v8::Object::Wrap()`.
605 const int16_t type_id;
606 };
607
608 // v8::Object::Wrappable serves as the base class for all C++ objects that can
609 // be wrapped by a JavaScript object using `v8::Object::Wrap()`.
610 //
611 // Note that v8::Object::Wrappable` inherits from `NameProvider` and provides
612 // `GetWrapperTypeInfo` to allow subclasses to have smaller object sizes.
613 class Wrappable : public cppgc::GarbageCollected<Wrappable>,
614 public cppgc::NameProvider {
615 public:
616 virtual const WrapperTypeInfo* GetWrapperTypeInfo() const {
617 return nullptr;
618 }
619
620 const char* GetHumanReadableName() const override { return "internal"; }
621
622 virtual void Trace(cppgc::Visitor* visitor) const {}
623 };
624
635 template <CppHeapPointerTag tag, typename T = void>
636 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
637 const v8::Local<v8::Object>& wrapper);
638 template <CppHeapPointerTag tag, typename T = void>
639 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
640 const PersistentBase<Object>& wrapper);
641 template <CppHeapPointerTag tag, typename T = void>
642 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
643 const BasicTracedReference<Object>& wrapper);
644
645 template <typename T = void>
646 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
647 const v8::Local<v8::Object>& wrapper,
648 CppHeapPointerTagRange tag_range);
649 template <typename T = void>
650 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
651 const PersistentBase<Object>& wrapper,
652 CppHeapPointerTagRange tag_range);
653 template <typename T = void>
654 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
655 const BasicTracedReference<Object>& wrapper,
656 CppHeapPointerTagRange tag_range);
657
667 template <CppHeapPointerTag tag>
668 static V8_INLINE void Wrap(v8::Isolate* isolate,
669 const v8::Local<v8::Object>& wrapper,
670 Wrappable* wrappable);
671 template <CppHeapPointerTag tag>
672 static V8_INLINE void Wrap(v8::Isolate* isolate,
673 const PersistentBase<Object>& wrapper,
674 Wrappable* wrappable);
675 template <CppHeapPointerTag tag>
676 static V8_INLINE void Wrap(v8::Isolate* isolate,
677 const BasicTracedReference<Object>& wrapper,
678 Wrappable* wrappable);
679 static V8_INLINE void Wrap(v8::Isolate* isolate,
680 const v8::Local<v8::Object>& wrapper,
681 Wrappable* wrappable, CppHeapPointerTag tag);
682 static V8_INLINE void Wrap(v8::Isolate* isolate,
683 const PersistentBase<Object>& wrapper,
684 Wrappable* wrappable, CppHeapPointerTag tag);
685 static V8_INLINE void Wrap(v8::Isolate* isolate,
686 const BasicTracedReference<Object>& wrapper,
687 Wrappable* wrappable, CppHeapPointerTag tag);
688
689 // Version of Wrap() function for v8::Context::Global() objects.
690 // Unlike the functions above it wraps both JSGlobalProxy and its hidden
691 // prototype (JSGlobalObject or remote object).
692 static void WrapGlobal(v8::Isolate* isolate,
693 const v8::Local<v8::Object>& wrapper,
694 Wrappable* wrappable, CppHeapPointerTag tag);
695
696 // Checks that wrappables set on JSGlobalProxy and its hidden prototype are
697 // the same.
698 static bool CheckGlobalWrappable(v8::Isolate* isolate,
699 const v8::Local<v8::Object>& wrapper,
700 CppHeapPointerTagRange tag_range);
701
709 Local<Name> key);
711 uint32_t index);
726 Local<Name> key);
728 Local<Context> context, uint32_t index);
730 Local<Context> context, Local<Name> key);
731
737 Local<Context> context, Local<Name> key);
738
746 Local<Name> key);
747
754 Local<Context> context, Local<Name> key);
755
762 Local<Context> context, Local<Name> key);
763
766
769
778
787
794 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
795 MaybeLocal<Context> GetCreationContext();
796
802 Local<Context> GetCreationContextChecked(v8::Isolate* isolate);
803 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
804 Local<Context> GetCreationContextChecked();
805
807 V8_INLINE static MaybeLocal<Context> GetCreationContext(
808 v8::Isolate* isolate, const PersistentBase<Object>& object) {
809 return object.template value<Object>()->GetCreationContext(isolate);
810 }
811 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
812 V8_INLINE static MaybeLocal<Context> GetCreationContext(
813 const PersistentBase<Object>& object);
814
834 void* GetAlignedPointerFromEmbedderDataInCreationContext(
835 v8::Isolate* isolate, int index, EmbedderDataTypeTag tag);
836 void* GetAlignedPointerFromEmbedderDataInCreationContext(
837 int index, EmbedderDataTypeTag tag);
838
844 bool IsCallable() const;
845
849 bool IsConstructor() const;
850
862 bool IsApiWrapper() const;
863
869 bool IsUndetectable() const;
870
876 Local<Value> recv,
877 int argc,
878 Local<Value> argv[]);
879
886 Local<Context> context, int argc, Local<Value> argv[]);
887
897 MaybeLocal<Array> PreviewEntries(bool* is_key_value);
898
899 static Local<Object> New(Isolate* isolate);
900
909 static Local<Object> New(Isolate* isolate, Local<Value> prototype_or_null,
910 Local<Name>* names, Local<Value>* values,
911 size_t length);
912
913 V8_INLINE static Object* Cast(Value* obj);
914
923 bool IsCodeLike(Isolate* isolate) const;
924
925 private:
926 static void* Unwrap(v8::Isolate* isolate, internal::Address wrapper_obj,
927 CppHeapPointerTagRange tag_range);
928 static void Wrap(v8::Isolate* isolate, internal::Address wrapper_obj,
929 CppHeapPointerTag tag, void* wrappable);
930
931 Object();
932 static void CheckCast(Value* obj);
933 Local<Data> SlowGetInternalField(int index);
934 void* SlowGetAlignedPointerFromInternalField(int index,
936 void* SlowGetAlignedPointerFromInternalField(v8::Isolate* isolate, int index,
938};
939
940// --- Implementation ---
941
942Local<Data> Object::GetInternalField(int index) {
943#ifndef V8_ENABLE_CHECKS
944 using A = internal::Address;
945 using I = internal::Internals;
946 A obj = internal::ValueHelper::ValueAsAddress(this);
947 // Fast path: If the object is a plain JSObject, which is the common case, we
948 // know where to find the internal fields and can return the value directly.
949 int instance_type = I::GetInstanceType(obj);
950 if (I::CanHaveInternalField(instance_type)) {
951 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
952 (I::kEmbedderDataSlotSize * index);
953 A value = I::ReadRawField<A>(obj, offset);
954#ifdef V8_COMPRESS_POINTERS
955 // We read the full pointer value and then decompress it in order to avoid
956 // dealing with potential endianness issues.
957 value = I::DecompressTaggedField(obj, static_cast<uint32_t>(value));
958#endif
959
960 auto* isolate = I::GetCurrentIsolate();
961 return Local<Data>::New(isolate, value);
962 }
963#endif
964 return SlowGetInternalField(index);
965}
966
967void* Object::GetAlignedPointerFromInternalField(v8::Isolate* isolate,
968 int index,
970#if !defined(V8_ENABLE_CHECKS)
971 using A = internal::Address;
972 using I = internal::Internals;
973 A obj = internal::ValueHelper::ValueAsAddress(this);
974 // Fast path: If the object is a plain JSObject, which is the common case, we
975 // know where to find the internal fields and can return the value directly.
976 auto instance_type = I::GetInstanceType(obj);
977 if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
978 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
979 (I::kEmbedderDataSlotSize * index) +
980 I::kEmbedderDataSlotExternalPointerOffset;
981 A value = I::ReadExternalPointerField(isolate, obj, offset,
983 return reinterpret_cast<void*>(value);
984 }
985#endif
986 return SlowGetAlignedPointerFromInternalField(isolate, index, tag);
987}
988
989void* Object::GetAlignedPointerFromInternalField(int index,
991#if !defined(V8_ENABLE_CHECKS)
992 using A = internal::Address;
993 using I = internal::Internals;
994 A obj = internal::ValueHelper::ValueAsAddress(this);
995 // Fast path: If the object is a plain JSObject, which is the common case, we
996 // know where to find the internal fields and can return the value directly.
997 auto instance_type = I::GetInstanceType(obj);
998 if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
999 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
1000 (I::kEmbedderDataSlotSize * index) +
1001 I::kEmbedderDataSlotExternalPointerOffset;
1002 Isolate* isolate = I::GetCurrentIsolateForSandbox();
1003 A value = I::ReadExternalPointerField(isolate, obj, offset,
1005 return reinterpret_cast<void*>(value);
1006 }
1007#endif
1008 return SlowGetAlignedPointerFromInternalField(index, tag);
1009}
1010
1011// static
1012template <CppHeapPointerTag tag, typename T>
1013T* Object::Unwrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper) {
1014 CppHeapPointerTagRange tag_range(tag, tag);
1015 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1016#if !defined(V8_ENABLE_CHECKS)
1017 return internal::ReadCppHeapPointerField<T>(
1018 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1019#else // defined(V8_ENABLE_CHECKS)
1020 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1021#endif // defined(V8_ENABLE_CHECKS)
1022}
1023
1024// static
1025template <CppHeapPointerTag tag, typename T>
1026T* Object::Unwrap(v8::Isolate* isolate, const PersistentBase<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 <CppHeapPointerTag tag, typename T>
1040T* Object::Unwrap(v8::Isolate* isolate,
1041 const BasicTracedReference<Object>& wrapper) {
1042 CppHeapPointerTagRange tag_range(tag, tag);
1043 auto obj =
1044 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1045#if !defined(V8_ENABLE_CHECKS)
1046 return internal::ReadCppHeapPointerField<T>(
1047 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1048#else // defined(V8_ENABLE_CHECKS)
1049 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1050#endif // defined(V8_ENABLE_CHECKS)
1051}
1052
1053// static
1054template <typename T>
1055T* Object::Unwrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1056 CppHeapPointerTagRange tag_range) {
1057 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1058#if !defined(V8_ENABLE_CHECKS)
1059 return internal::ReadCppHeapPointerField<T>(
1060 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1061#else // defined(V8_ENABLE_CHECKS)
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, const PersistentBase<Object>& wrapper,
1069 CppHeapPointerTagRange tag_range) {
1070 auto obj =
1071 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1072#if !defined(V8_ENABLE_CHECKS)
1073 return internal::ReadCppHeapPointerField<T>(
1074 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1075#else // defined(V8_ENABLE_CHECKS)
1076
1077 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1078#endif // defined(V8_ENABLE_CHECKS)
1079}
1080
1081// static
1082template <typename T>
1083T* Object::Unwrap(v8::Isolate* isolate,
1084 const BasicTracedReference<Object>& wrapper,
1085 CppHeapPointerTagRange tag_range) {
1086 auto obj =
1087 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1088#if !defined(V8_ENABLE_CHECKS)
1089 return internal::ReadCppHeapPointerField<T>(
1090 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1091#else // defined(V8_ENABLE_CHECKS)
1092 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1093#endif // defined(V8_ENABLE_CHECKS)
1094}
1095
1096// static
1097template <CppHeapPointerTag tag>
1098void Object::Wrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1099 v8::Object::Wrappable* wrappable) {
1100 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1101 Wrap(isolate, obj, tag, wrappable);
1102}
1103
1104// static
1105template <CppHeapPointerTag tag>
1106void Object::Wrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper,
1107 v8::Object::Wrappable* wrappable) {
1108 auto obj =
1109 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1110 Wrap(isolate, obj, tag, wrappable);
1111}
1112
1113// static
1114template <CppHeapPointerTag tag>
1115void Object::Wrap(v8::Isolate* isolate,
1116 const BasicTracedReference<Object>& wrapper,
1117 v8::Object::Wrappable* wrappable) {
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, const v8::Local<v8::Object>& wrapper,
1125 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1126 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1127 Wrap(isolate, obj, tag, wrappable);
1128}
1129
1130// static
1131void Object::Wrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper,
1132 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1133 auto obj =
1134 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1135 Wrap(isolate, obj, tag, wrappable);
1136}
1137
1138// static
1139void Object::Wrap(v8::Isolate* isolate,
1140 const BasicTracedReference<Object>& wrapper,
1141 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1142 auto obj =
1143 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1144 Wrap(isolate, obj, tag, wrappable);
1145}
1146
1147Private* Private::Cast(Data* data) {
1148#ifdef V8_ENABLE_CHECKS
1149 CheckCast(data);
1150#endif
1151 return reinterpret_cast<Private*>(data);
1152}
1153
1154Object* Object::Cast(v8::Value* value) {
1155#ifdef V8_ENABLE_CHECKS
1156 CheckCast(value);
1157#endif
1158 return static_cast<Object*>(value);
1159}
1160
1161} // namespace v8
1162
1163#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:614
const char * GetHumanReadableName() const override
Definition: v8-object.h:620
virtual const WrapperTypeInfo * GetWrapperTypeInfo() const
Definition: v8-object.h:616
virtual void Trace(cppgc::Visitor *visitor) const
Definition: v8-object.h:622
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)
Maybe< bool > SetNativeDataProperty(Local< Context > context, Local< Name > name, AccessorNameGetterCallback getter, std::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:421
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:579
static int InternalFieldCount(const PersistentBase< Object > &object)
Definition: v8-object.h:541
MaybeLocal< Value > GetRealNamedPropertyInPrototypeChain(Local< Context > context, Local< Name > key)
static int InternalFieldCount(const BasicTracedReference< Object > &object)
Definition: v8-object.h:547
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)
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:587
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)
Maybe< bool > GetPropertyAttributes(Local< Context > context, Local< Value > key, PropertyAttribute *out_attributes)
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:1000
ExternalPointerTag
Definition: v8-internal.h:650
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:604
const int16_t type_id
Definition: v8-object.h:605
Definition: v8-internal.h:500
#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