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);
413 V8_DEPRECATE_SOON("Use AccessorNameSetterCallbackV2 setter instead")
414 V8_WARN_UNUSED_RESULT Maybe<bool> SetNativeDataProperty(
415 Local<Context> context, Local<Name> name,
417 Local<Value> data = Local<Value>(), PropertyAttribute attributes = None,
418 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
419 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
420 // TODO(https://crbug.com/348660658): remove once AccessorNameSetterCallback
421 // is removed.
422 V8_WARN_UNUSED_RESULT Maybe<bool> SetNativeDataProperty(
423 Local<Context> context, Local<Name> name,
424 AccessorNameGetterCallback getter, std::nullptr_t setter = nullptr,
425 Local<Value> data = Local<Value>(), PropertyAttribute attributes = None,
426 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
427 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect) {
428 return SetNativeDataProperty(
429 context, name, getter,
430 static_cast<AccessorNameSetterCallbackV2>(setter), data, attributes,
431 getter_side_effect_type, setter_side_effect_type);
432 }
433
443 Local<Context> context, Local<Name> name,
445 PropertyAttribute attributes = None,
446 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
447 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
448
457 Local<Value> value);
460
468 Local<Context> context);
470 Local<Context> context, KeyCollectionMode mode,
471 PropertyFilter property_filter, IndexFilter index_filter,
472 KeyConversionMode key_conversion = KeyConversionMode::kKeepNumbers);
473
480 Local<Context> context);
481
489 Local<Context> context, PropertyFilter filter,
490 KeyConversionMode key_conversion = KeyConversionMode::kKeepNumbers);
491
497 // TODO(http://crbug.com/333672197): deprecate and remove.
498 V8_DEPRECATE_SOON("Use GetPrototype().")
499 inline Local<Value> GetPrototypeV2() { return GetPrototype(); }
500
506 Local<Value> prototype);
507 // TODO(http://crbug.com/333672197): deprecate and remove.
508 V8_DEPRECATE_SOON("Use SetPrototype().")
509 V8_WARN_UNUSED_RESULT Maybe<bool> SetPrototypeV2(Local<Context> context,
510 Local<Value> prototype) {
511 return SetPrototype(context, prototype);
512 }
513
519
526 Local<Context> context);
527
532
537
540
543 const PersistentBase<Object>& object) {
544 return object.template value<Object>()->InternalFieldCount();
545 }
546
549 const BasicTracedReference<Object>& object) {
550 return object.template value<Object>()->InternalFieldCount();
551 }
552
563 V8_INLINE Local<Data> GetInternalField(int index);
564
566 void SetInternalField(int index, Local<Data> data);
567
573 V8_INLINE void* GetAlignedPointerFromInternalField(int index,
575 V8_INLINE void* GetAlignedPointerFromInternalField(v8::Isolate* isolate,
576 int index,
578
581 const PersistentBase<Object>& object, int index,
583 return object.template value<Object>()->GetAlignedPointerFromInternalField(
584 index, tag);
585 }
586
589 const BasicTracedReference<Object>& object, int index,
591 return object.template value<Object>()->GetAlignedPointerFromInternalField(
592 index, tag);
593 }
594
600 void SetAlignedPointerInInternalField(int index, void* value,
602
603 // Type information for a Wrappable object that got wrapped with
604 // `v8::Object::Wrap()`.
606 const int16_t type_id;
607 };
608
609 // v8::Object::Wrappable serves as the base class for all C++ objects that can
610 // be wrapped by a JavaScript object using `v8::Object::Wrap()`.
611 //
612 // Note that v8::Object::Wrappable` inherits from `NameProvider` and provides
613 // `GetWrapperTypeInfo` to allow subclasses to have smaller object sizes.
614 class Wrappable : public cppgc::GarbageCollected<Wrappable>,
615 public cppgc::NameProvider {
616 public:
617 virtual const WrapperTypeInfo* GetWrapperTypeInfo() const {
618 return nullptr;
619 }
620
621 const char* GetHumanReadableName() const override { return "internal"; }
622
623 virtual void Trace(cppgc::Visitor* visitor) const {}
624 };
625
636 template <CppHeapPointerTag tag, typename T = void>
637 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
638 const v8::Local<v8::Object>& wrapper);
639 template <CppHeapPointerTag tag, typename T = void>
640 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
641 const PersistentBase<Object>& wrapper);
642 template <CppHeapPointerTag tag, typename T = void>
643 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
644 const BasicTracedReference<Object>& wrapper);
645
646 template <typename T = void>
647 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
648 const v8::Local<v8::Object>& wrapper,
649 CppHeapPointerTagRange tag_range);
650 template <typename T = void>
651 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
652 const PersistentBase<Object>& wrapper,
653 CppHeapPointerTagRange tag_range);
654 template <typename T = void>
655 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
656 const BasicTracedReference<Object>& wrapper,
657 CppHeapPointerTagRange tag_range);
658
668 template <CppHeapPointerTag tag>
669 static V8_INLINE void Wrap(v8::Isolate* isolate,
670 const v8::Local<v8::Object>& wrapper,
671 Wrappable* wrappable);
672 template <CppHeapPointerTag tag>
673 static V8_INLINE void Wrap(v8::Isolate* isolate,
674 const PersistentBase<Object>& wrapper,
675 Wrappable* wrappable);
676 template <CppHeapPointerTag tag>
677 static V8_INLINE void Wrap(v8::Isolate* isolate,
678 const BasicTracedReference<Object>& wrapper,
679 Wrappable* wrappable);
680 static V8_INLINE void Wrap(v8::Isolate* isolate,
681 const v8::Local<v8::Object>& wrapper,
682 Wrappable* wrappable, CppHeapPointerTag tag);
683 static V8_INLINE void Wrap(v8::Isolate* isolate,
684 const PersistentBase<Object>& wrapper,
685 Wrappable* wrappable, CppHeapPointerTag tag);
686 static V8_INLINE void Wrap(v8::Isolate* isolate,
687 const BasicTracedReference<Object>& wrapper,
688 Wrappable* wrappable, CppHeapPointerTag tag);
689
690 // Version of Wrap() function for v8::Context::Global() objects.
691 // Unlike the functions above it wraps both JSGlobalProxy and its hidden
692 // prototype (JSGlobalObject or remote object).
693 static void WrapGlobal(v8::Isolate* isolate,
694 const v8::Local<v8::Object>& wrapper,
695 Wrappable* wrappable, CppHeapPointerTag tag);
696
697 // Checks that wrappables set on JSGlobalProxy and its hidden prototype are
698 // the same.
699 static bool CheckGlobalWrappable(v8::Isolate* isolate,
700 const v8::Local<v8::Object>& wrapper,
701 CppHeapPointerTagRange tag_range);
702
710 Local<Name> key);
712 uint32_t index);
727 Local<Name> key);
729 Local<Context> context, uint32_t index);
731 Local<Context> context, Local<Name> key);
732
738 Local<Context> context, Local<Name> key);
739
747 Local<Name> key);
748
755 Local<Context> context, Local<Name> key);
756
763 Local<Context> context, Local<Name> key);
764
767
770
779
788
795 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
796 MaybeLocal<Context> GetCreationContext();
797
803 Local<Context> GetCreationContextChecked(v8::Isolate* isolate);
804 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
805 Local<Context> GetCreationContextChecked();
806
808 V8_INLINE static MaybeLocal<Context> GetCreationContext(
809 v8::Isolate* isolate, const PersistentBase<Object>& object) {
810 return object.template value<Object>()->GetCreationContext(isolate);
811 }
812 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
813 V8_INLINE static MaybeLocal<Context> GetCreationContext(
814 const PersistentBase<Object>& object);
815
835 void* GetAlignedPointerFromEmbedderDataInCreationContext(
836 v8::Isolate* isolate, int index, EmbedderDataTypeTag tag);
837 void* GetAlignedPointerFromEmbedderDataInCreationContext(
838 int index, EmbedderDataTypeTag tag);
839
845 bool IsCallable() const;
846
850 bool IsConstructor() const;
851
863 bool IsApiWrapper() const;
864
870 bool IsUndetectable() const;
871
877 Local<Value> recv,
878 int argc,
879 Local<Value> argv[]);
880
887 Local<Context> context, int argc, Local<Value> argv[]);
888
898 MaybeLocal<Array> PreviewEntries(bool* is_key_value);
899
900 static Local<Object> New(Isolate* isolate);
901
910 static Local<Object> New(Isolate* isolate, Local<Value> prototype_or_null,
911 Local<Name>* names, Local<Value>* values,
912 size_t length);
913
914 V8_INLINE static Object* Cast(Value* obj);
915
924 bool IsCodeLike(Isolate* isolate) const;
925
926 private:
927 static void* Unwrap(v8::Isolate* isolate, internal::Address wrapper_obj,
928 CppHeapPointerTagRange tag_range);
929 static void Wrap(v8::Isolate* isolate, internal::Address wrapper_obj,
930 CppHeapPointerTag tag, void* wrappable);
931
932 Object();
933 static void CheckCast(Value* obj);
934 Local<Data> SlowGetInternalField(int index);
935 void* SlowGetAlignedPointerFromInternalField(int index,
937 void* SlowGetAlignedPointerFromInternalField(v8::Isolate* isolate, int index,
939};
940
941// --- Implementation ---
942
943Local<Data> Object::GetInternalField(int index) {
944#ifndef V8_ENABLE_CHECKS
945 using A = internal::Address;
946 using I = internal::Internals;
947 A obj = internal::ValueHelper::ValueAsAddress(this);
948 // Fast path: If the object is a plain JSObject, which is the common case, we
949 // know where to find the internal fields and can return the value directly.
950 int instance_type = I::GetInstanceType(obj);
951 if (I::CanHaveInternalField(instance_type)) {
952 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
953 (I::kEmbedderDataSlotSize * index);
954 A value = I::ReadRawField<A>(obj, offset);
955#ifdef V8_COMPRESS_POINTERS
956 // We read the full pointer value and then decompress it in order to avoid
957 // dealing with potential endianness issues.
958 value = I::DecompressTaggedField(obj, static_cast<uint32_t>(value));
959#endif
960
961 auto* isolate = I::GetCurrentIsolate();
962 return Local<Data>::New(isolate, value);
963 }
964#endif
965 return SlowGetInternalField(index);
966}
967
968void* Object::GetAlignedPointerFromInternalField(v8::Isolate* isolate,
969 int index,
971#if !defined(V8_ENABLE_CHECKS)
972 using A = internal::Address;
973 using I = internal::Internals;
974 A obj = internal::ValueHelper::ValueAsAddress(this);
975 // Fast path: If the object is a plain JSObject, which is the common case, we
976 // know where to find the internal fields and can return the value directly.
977 auto instance_type = I::GetInstanceType(obj);
978 if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
979 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
980 (I::kEmbedderDataSlotSize * index) +
981 I::kEmbedderDataSlotExternalPointerOffset;
982 A value = I::ReadExternalPointerField(isolate, obj, offset,
984 return reinterpret_cast<void*>(value);
985 }
986#endif
987 return SlowGetAlignedPointerFromInternalField(isolate, index, tag);
988}
989
990void* Object::GetAlignedPointerFromInternalField(int index,
992#if !defined(V8_ENABLE_CHECKS)
993 using A = internal::Address;
994 using I = internal::Internals;
995 A obj = internal::ValueHelper::ValueAsAddress(this);
996 // Fast path: If the object is a plain JSObject, which is the common case, we
997 // know where to find the internal fields and can return the value directly.
998 auto instance_type = I::GetInstanceType(obj);
999 if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
1000 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
1001 (I::kEmbedderDataSlotSize * index) +
1002 I::kEmbedderDataSlotExternalPointerOffset;
1003 Isolate* isolate = I::GetCurrentIsolateForSandbox();
1004 A value = I::ReadExternalPointerField(isolate, obj, offset,
1006 return reinterpret_cast<void*>(value);
1007 }
1008#endif
1009 return SlowGetAlignedPointerFromInternalField(index, tag);
1010}
1011
1012// static
1013template <CppHeapPointerTag tag, typename T>
1014T* Object::Unwrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper) {
1015 CppHeapPointerTagRange tag_range(tag, tag);
1016 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1017#if !defined(V8_ENABLE_CHECKS)
1018 return internal::ReadCppHeapPointerField<T>(
1019 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1020#else // defined(V8_ENABLE_CHECKS)
1021 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1022#endif // defined(V8_ENABLE_CHECKS)
1023}
1024
1025// static
1026template <CppHeapPointerTag tag, typename T>
1027T* Object::Unwrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper) {
1028 CppHeapPointerTagRange tag_range(tag, tag);
1029 auto obj =
1030 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1031#if !defined(V8_ENABLE_CHECKS)
1032 return internal::ReadCppHeapPointerField<T>(
1033 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1034#else // defined(V8_ENABLE_CHECKS)
1035 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1036#endif // defined(V8_ENABLE_CHECKS)
1037}
1038
1039// static
1040template <CppHeapPointerTag tag, typename T>
1041T* Object::Unwrap(v8::Isolate* isolate,
1042 const BasicTracedReference<Object>& wrapper) {
1043 CppHeapPointerTagRange tag_range(tag, tag);
1044 auto obj =
1045 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1046#if !defined(V8_ENABLE_CHECKS)
1047 return internal::ReadCppHeapPointerField<T>(
1048 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1049#else // defined(V8_ENABLE_CHECKS)
1050 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1051#endif // defined(V8_ENABLE_CHECKS)
1052}
1053
1054// static
1055template <typename T>
1056T* Object::Unwrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1057 CppHeapPointerTagRange tag_range) {
1058 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1059#if !defined(V8_ENABLE_CHECKS)
1060 return internal::ReadCppHeapPointerField<T>(
1061 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1062#else // defined(V8_ENABLE_CHECKS)
1063 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1064#endif // defined(V8_ENABLE_CHECKS)
1065}
1066
1067// static
1068template <typename T>
1069T* Object::Unwrap(v8::Isolate* isolate, const PersistentBase<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
1078 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1079#endif // defined(V8_ENABLE_CHECKS)
1080}
1081
1082// static
1083template <typename T>
1084T* Object::Unwrap(v8::Isolate* isolate,
1085 const BasicTracedReference<Object>& wrapper,
1086 CppHeapPointerTagRange tag_range) {
1087 auto obj =
1088 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1089#if !defined(V8_ENABLE_CHECKS)
1090 return internal::ReadCppHeapPointerField<T>(
1091 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1092#else // defined(V8_ENABLE_CHECKS)
1093 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1094#endif // defined(V8_ENABLE_CHECKS)
1095}
1096
1097// static
1098template <CppHeapPointerTag tag>
1099void Object::Wrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1100 v8::Object::Wrappable* wrappable) {
1101 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1102 Wrap(isolate, obj, tag, wrappable);
1103}
1104
1105// static
1106template <CppHeapPointerTag tag>
1107void Object::Wrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper,
1108 v8::Object::Wrappable* wrappable) {
1109 auto obj =
1110 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1111 Wrap(isolate, obj, tag, wrappable);
1112}
1113
1114// static
1115template <CppHeapPointerTag tag>
1116void Object::Wrap(v8::Isolate* isolate,
1117 const BasicTracedReference<Object>& wrapper,
1118 v8::Object::Wrappable* wrappable) {
1119 auto obj =
1120 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1121 Wrap(isolate, obj, tag, wrappable);
1122}
1123
1124// static
1125void Object::Wrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1126 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1127 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1128 Wrap(isolate, obj, tag, wrappable);
1129}
1130
1131// static
1132void Object::Wrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper,
1133 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1134 auto obj =
1135 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1136 Wrap(isolate, obj, tag, wrappable);
1137}
1138
1139// static
1140void Object::Wrap(v8::Isolate* isolate,
1141 const BasicTracedReference<Object>& wrapper,
1142 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1143 auto obj =
1144 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1145 Wrap(isolate, obj, tag, wrappable);
1146}
1147
1148Private* Private::Cast(Data* data) {
1149#ifdef V8_ENABLE_CHECKS
1150 CheckCast(data);
1151#endif
1152 return reinterpret_cast<Private*>(data);
1153}
1154
1155Object* Object::Cast(v8::Value* value) {
1156#ifdef V8_ENABLE_CHECKS
1157 CheckCast(value);
1158#endif
1159 return static_cast<Object*>(value);
1160}
1161
1162} // namespace v8
1163
1164#endif // INCLUDE_V8_OBJECT_H_
Definition: garbage-collected.h:53
Definition: name-provider.h:26
Definition: visitor.h:78
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:81
Definition: v8-object.h:615
const char * GetHumanReadableName() const override
Definition: v8-object.h:621
virtual const WrapperTypeInfo * GetWrapperTypeInfo() const
Definition: v8-object.h:617
virtual void Trace(cppgc::Visitor *visitor) const
Definition: v8-object.h:623
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:580
static int InternalFieldCount(const PersistentBase< Object > &object)
Definition: v8-object.h:542
MaybeLocal< Value > GetRealNamedPropertyInPrototypeChain(Local< Context > context, Local< Name > key)
static int InternalFieldCount(const BasicTracedReference< Object > &object)
Definition: v8-object.h:548
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:588
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
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:1010
ExternalPointerTag
Definition: v8-internal.h:660
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:605
const int16_t type_id
Definition: v8-object.h:606
Definition: v8-internal.h:510
#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