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
171 void (*)(Local<Name> property, const PropertyCallbackInfo<Value>& info);
172
174 void (*)(Local<Name> property, Local<Value> value,
175 const PropertyCallbackInfo<void>& info);
176
186 "This enum is no longer used and will be removed in V8 14.3.")
189 };
190
200 SKIP_SYMBOLS = 16
202
213enum class SideEffectType {
217};
218
227
233
239
244
248class V8_EXPORT Object : public Value {
249 public:
255 Local<Value> key, Local<Value> value);
257 Local<Value> key, Local<Value> value,
258 MaybeLocal<Object> receiver);
259
261 Local<Value> value);
262
274 Local<Name> key,
275 Local<Value> value);
277 uint32_t index,
278 Local<Value> value);
279
290 Local<Context> context, Local<Name> key, Local<Value> value,
291 PropertyAttribute attributes = None);
292
310 Local<Context> context, Local<Name> key, PropertyDescriptor& descriptor);
311
313 Local<Value> key);
315 Local<Value> key,
316 MaybeLocal<Object> receiver);
317
319 uint32_t index);
320
327 Local<Context> context, Local<Value> key);
328
334 Local<Context> context, Local<Name> key);
335
352 Local<Value> key);
353
355 Local<Value> key);
356
358
360 uint32_t index);
361
368 PropertyAttribute attributes = None);
369
375 Local<Context> context, Local<Name> name,
377 AccessorNameSetterCallback setter = nullptr,
378 Local<Value> data = Local<Value>(), PropertyAttribute attributes = None,
379 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
380 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
381
391 Local<Context> context, Local<Name> name,
393 PropertyAttribute attributes = None,
394 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
395 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
396
405 Local<Value> value);
408
416 Local<Context> context);
418 Local<Context> context, KeyCollectionMode mode,
419 PropertyFilter property_filter, IndexFilter index_filter,
420 KeyConversionMode key_conversion = KeyConversionMode::kKeepNumbers);
421
428 Local<Context> context);
429
437 Local<Context> context, PropertyFilter filter,
438 KeyConversionMode key_conversion = KeyConversionMode::kKeepNumbers);
439
446
453 Local<Value> prototype);
454
460
467 Local<Context> context);
468
473
478
481
484 const PersistentBase<Object>& object) {
485 return object.template value<Object>()->InternalFieldCount();
486 }
487
490 const BasicTracedReference<Object>& object) {
491 return object.template value<Object>()->InternalFieldCount();
492 }
493
504 V8_INLINE Local<Data> GetInternalField(int index);
505
507 void SetInternalField(int index, Local<Data> data);
508
514 V8_INLINE void* GetAlignedPointerFromInternalField(int index,
516 V8_INLINE void* GetAlignedPointerFromInternalField(v8::Isolate* isolate,
517 int index,
519
521 "Use GetAlignedPointerFromInternalField with EmbedderDataTypeTag "
522 "parameter instead.")
523 V8_INLINE void* GetAlignedPointerFromInternalField(int index) {
524 return GetAlignedPointerFromInternalField(index,
526 }
527
529 "Use GetAlignedPointerFromInternalField with EmbedderDataTypeTag "
530 "parameter instead.")
531 V8_INLINE void* GetAlignedPointerFromInternalField(v8::Isolate* isolate,
532 int index) {
533 return GetAlignedPointerFromInternalField(isolate, index,
535 }
536
539 const PersistentBase<Object>& object, int index,
541 return object.template value<Object>()->GetAlignedPointerFromInternalField(
542 index, tag);
543 }
544
546 "Use GetAlignedPointerFromInternalField with EmbedderDataTypeTag "
547 "parameter instead.")
548 V8_INLINE static void* GetAlignedPointerFromInternalField(
549 const PersistentBase<Object>& object, int index) {
550 return object.template value<Object>()->GetAlignedPointerFromInternalField(
551 index);
552 }
553
556 const BasicTracedReference<Object>& object, int index,
558 return object.template value<Object>()->GetAlignedPointerFromInternalField(
559 index, tag);
560 }
561
563 "Use GetAlignedPointerFromInternalField with EmbedderDataTypeTag "
564 "parameter instead.")
565 V8_INLINE static void* GetAlignedPointerFromInternalField(
566 const BasicTracedReference<Object>& object, int index) {
567 return object.template value<Object>()->GetAlignedPointerFromInternalField(
568 index);
569 }
570
576 void SetAlignedPointerInInternalField(int index, void* value,
578
580 "Use SetAlignedPointerInInternalField with EmbedderDataTypeTag parameter "
581 "instead.")
582 void SetAlignedPointerInInternalField(int index, void* value) {
583 SetAlignedPointerInInternalField(index, value, kEmbedderDataTypeTagDefault);
584 }
585
587 "Use SetAlignedPointerInInternalField with EmbedderDataTypeTag "
588 "parameter instead.")
589 void SetAlignedPointerInInternalFields(int argc, int indices[],
590 void* values[]);
591
592 // Type information for a Wrappable object that got wrapped with
593 // `v8::Object::Wrap()`.
595 const int16_t type_id;
596 };
597
598 // v8::Object::Wrappable serves as the base class for all C++ objects that can
599 // be wrapped by a JavaScript object using `v8::Object::Wrap()`.
600 //
601 // Note that v8::Object::Wrappable` inherits from `NameProvider` and provides
602 // `GetWrapperTypeInfo` to allow subclasses to have smaller object sizes.
603 class Wrappable : public cppgc::GarbageCollected<Wrappable>,
604 public cppgc::NameProvider {
605 public:
606 virtual const WrapperTypeInfo* GetWrapperTypeInfo() const {
607 return nullptr;
608 }
609
610 const char* GetHumanReadableName() const override { return "internal"; }
611
612 virtual void Trace(cppgc::Visitor* visitor) const {}
613 };
614
625 template <CppHeapPointerTag tag, typename T = void>
626 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
627 const v8::Local<v8::Object>& wrapper);
628 template <CppHeapPointerTag tag, typename T = void>
629 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
630 const PersistentBase<Object>& wrapper);
631 template <CppHeapPointerTag tag, typename T = void>
632 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
633 const BasicTracedReference<Object>& wrapper);
634
635 template <typename T = void>
636 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
637 const v8::Local<v8::Object>& wrapper,
638 CppHeapPointerTagRange tag_range);
639 template <typename T = void>
640 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
641 const PersistentBase<Object>& wrapper,
642 CppHeapPointerTagRange tag_range);
643 template <typename T = void>
644 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
645 const BasicTracedReference<Object>& wrapper,
646 CppHeapPointerTagRange tag_range);
647
657 template <CppHeapPointerTag tag>
658 static V8_INLINE void Wrap(v8::Isolate* isolate,
659 const v8::Local<v8::Object>& wrapper,
660 Wrappable* wrappable);
661 template <CppHeapPointerTag tag>
662 static V8_INLINE void Wrap(v8::Isolate* isolate,
663 const PersistentBase<Object>& wrapper,
664 Wrappable* wrappable);
665 template <CppHeapPointerTag tag>
666 static V8_INLINE void Wrap(v8::Isolate* isolate,
667 const BasicTracedReference<Object>& wrapper,
668 Wrappable* wrappable);
669 static V8_INLINE void Wrap(v8::Isolate* isolate,
670 const v8::Local<v8::Object>& wrapper,
671 Wrappable* wrappable, CppHeapPointerTag tag);
672 static V8_INLINE void Wrap(v8::Isolate* isolate,
673 const PersistentBase<Object>& wrapper,
674 Wrappable* wrappable, CppHeapPointerTag tag);
675 static V8_INLINE void Wrap(v8::Isolate* isolate,
676 const BasicTracedReference<Object>& wrapper,
677 Wrappable* wrappable, CppHeapPointerTag tag);
678
679 // Version of Wrap() function for v8::Context::Global() objects.
680 // Unlike the functions above it wraps both JSGlobalProxy and its hidden
681 // prototype (JSGlobalObject or remote object).
682 static void WrapGlobal(v8::Isolate* isolate,
683 const v8::Local<v8::Object>& wrapper,
684 Wrappable* wrappable, CppHeapPointerTag tag);
685
686 // Checks that wrappables set on JSGlobalProxy and its hidden prototype are
687 // the same.
688 static bool CheckGlobalWrappable(v8::Isolate* isolate,
689 const v8::Local<v8::Object>& wrapper,
690 CppHeapPointerTagRange tag_range);
691
699 Local<Name> key);
701 uint32_t index);
716 Local<Name> key);
718 Local<Context> context, uint32_t index);
720 Local<Context> context, Local<Name> key);
721
727 Local<Context> context, Local<Name> key);
728
736 Local<Name> key);
737
744 Local<Context> context, Local<Name> key);
745
752 Local<Context> context, Local<Name> key);
753
756
759
768
777
784 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
785 MaybeLocal<Context> GetCreationContext();
786
792 Local<Context> GetCreationContextChecked(v8::Isolate* isolate);
793 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
794 Local<Context> GetCreationContextChecked();
795
797 V8_INLINE static MaybeLocal<Context> GetCreationContext(
798 v8::Isolate* isolate, const PersistentBase<Object>& object) {
799 return object.template value<Object>()->GetCreationContext(isolate);
800 }
801 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
802 V8_INLINE static MaybeLocal<Context> GetCreationContext(
803 const PersistentBase<Object>& object);
804
819 void* GetAlignedPointerFromEmbedderDataInCreationContext(
820 v8::Isolate* isolate, int index, EmbedderDataTypeTag tag);
821 void* GetAlignedPointerFromEmbedderDataInCreationContext(
822 int index, EmbedderDataTypeTag tag);
823
825 "Use GetAlignedPointerFromEmbedderDataInCreationContext with "
826 "EmbedderDataTypeTag parameter instead.")
827 void* GetAlignedPointerFromEmbedderDataInCreationContext(v8::Isolate* isolate,
828 int index) {
829 return GetAlignedPointerFromEmbedderDataInCreationContext(
830 isolate, index, kEmbedderDataTypeTagDefault);
831 }
832
834 "Use GetAlignedPointerFromEmbedderDataInCreationContext with "
835 "EmbedderDataTypeTag parameter instead.")
836 void* GetAlignedPointerFromEmbedderDataInCreationContext(int index) {
837 return GetAlignedPointerFromEmbedderDataInCreationContext(
839 }
840
846 bool IsCallable() const;
847
851 bool IsConstructor() const;
852
864 bool IsApiWrapper() const;
865
871 bool IsUndetectable() const;
872
878 Local<Value> recv,
879 int argc,
880 Local<Value> argv[]);
881
888 Local<Context> context, int argc, Local<Value> argv[]);
889
900
901 static Local<Object> New(Isolate* isolate);
902
911 static Local<Object> New(Isolate* isolate, Local<Value> prototype_or_null,
912 Local<Name>* names, Local<Value>* values,
913 size_t length);
914
915 V8_INLINE static Object* Cast(Value* obj);
916
925 bool IsCodeLike(Isolate* isolate) const;
926
927 private:
928 static void* Unwrap(v8::Isolate* isolate, internal::Address wrapper_obj,
929 CppHeapPointerTagRange tag_range);
930 static void Wrap(v8::Isolate* isolate, internal::Address wrapper_obj,
931 CppHeapPointerTag tag, void* wrappable);
932
933 Object();
934 static void CheckCast(Value* obj);
935 Local<Data> SlowGetInternalField(int index);
936 void* SlowGetAlignedPointerFromInternalField(int index,
938 void* SlowGetAlignedPointerFromInternalField(v8::Isolate* isolate, int index,
940};
941
942// --- Implementation ---
943
945#ifndef V8_ENABLE_CHECKS
946 using A = internal::Address;
947 using I = internal::Internals;
949 // Fast path: If the object is a plain JSObject, which is the common case, we
950 // know where to find the internal fields and can return the value directly.
951 int instance_type = I::GetInstanceType(obj);
952 if (I::CanHaveInternalField(instance_type)) {
953 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
954 (I::kEmbedderDataSlotSize * index);
955 A value = I::ReadRawField<A>(obj, offset);
956#ifdef V8_COMPRESS_POINTERS
957 // We read the full pointer value and then decompress it in order to avoid
958 // dealing with potential endianness issues.
959 value = I::DecompressTaggedField(obj, static_cast<uint32_t>(value));
960#endif
961
962 auto* isolate = I::GetCurrentIsolate();
963 return Local<Data>::New(isolate, value);
964 }
965#endif
966 return SlowGetInternalField(index);
967}
968
970 int index,
972#if !defined(V8_ENABLE_CHECKS)
973 using A = internal::Address;
974 using I = internal::Internals;
976 // Fast path: If the object is a plain JSObject, which is the common case, we
977 // know where to find the internal fields and can return the value directly.
978 auto instance_type = I::GetInstanceType(obj);
979 if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
980 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
981 (I::kEmbedderDataSlotSize * index) +
982 I::kEmbedderDataSlotExternalPointerOffset;
983 A value = I::ReadExternalPointerField(isolate, obj, offset,
985 return reinterpret_cast<void*>(value);
986 }
987#endif
988 return SlowGetAlignedPointerFromInternalField(isolate, index, tag);
989}
990
993#if !defined(V8_ENABLE_CHECKS)
994 using A = internal::Address;
995 using I = internal::Internals;
997 // Fast path: If the object is a plain JSObject, which is the common case, we
998 // know where to find the internal fields and can return the value directly.
999 auto instance_type = I::GetInstanceType(obj);
1000 if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
1001 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
1002 (I::kEmbedderDataSlotSize * index) +
1003 I::kEmbedderDataSlotExternalPointerOffset;
1004 Isolate* isolate = I::GetCurrentIsolateForSandbox();
1005 A value = I::ReadExternalPointerField(isolate, obj, offset,
1007 return reinterpret_cast<void*>(value);
1008 }
1009#endif
1010 return SlowGetAlignedPointerFromInternalField(index, tag);
1011}
1012
1013// static
1014template <CppHeapPointerTag tag, typename T>
1016 CppHeapPointerTagRange tag_range(tag, tag);
1017 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1018#if !defined(V8_ENABLE_CHECKS)
1019 return internal::ReadCppHeapPointerField<T>(
1020 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1021#else // defined(V8_ENABLE_CHECKS)
1022 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1023#endif // defined(V8_ENABLE_CHECKS)
1024}
1025
1026// static
1027template <CppHeapPointerTag tag, typename T>
1029 CppHeapPointerTagRange tag_range(tag, tag);
1030 auto obj =
1031 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1032#if !defined(V8_ENABLE_CHECKS)
1033 return internal::ReadCppHeapPointerField<T>(
1034 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1035#else // defined(V8_ENABLE_CHECKS)
1036 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1037#endif // defined(V8_ENABLE_CHECKS)
1038}
1039
1040// static
1041template <CppHeapPointerTag tag, typename T>
1043 const BasicTracedReference<Object>& wrapper) {
1044 CppHeapPointerTagRange tag_range(tag, tag);
1045 auto obj =
1046 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1047#if !defined(V8_ENABLE_CHECKS)
1048 return internal::ReadCppHeapPointerField<T>(
1049 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1050#else // defined(V8_ENABLE_CHECKS)
1051 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1052#endif // defined(V8_ENABLE_CHECKS)
1053}
1054
1055// static
1056template <typename T>
1058 CppHeapPointerTagRange tag_range) {
1059 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1060#if !defined(V8_ENABLE_CHECKS)
1061 return internal::ReadCppHeapPointerField<T>(
1062 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1063#else // defined(V8_ENABLE_CHECKS)
1064 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1065#endif // defined(V8_ENABLE_CHECKS)
1066}
1067
1068// static
1069template <typename T>
1071 CppHeapPointerTagRange tag_range) {
1072 auto obj =
1073 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1074#if !defined(V8_ENABLE_CHECKS)
1075 return internal::ReadCppHeapPointerField<T>(
1076 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1077#else // defined(V8_ENABLE_CHECKS)
1078
1079 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1080#endif // defined(V8_ENABLE_CHECKS)
1081}
1082
1083// static
1084template <typename T>
1086 const BasicTracedReference<Object>& wrapper,
1087 CppHeapPointerTagRange tag_range) {
1088 auto obj =
1089 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1090#if !defined(V8_ENABLE_CHECKS)
1091 return internal::ReadCppHeapPointerField<T>(
1092 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1093#else // defined(V8_ENABLE_CHECKS)
1094 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1095#endif // defined(V8_ENABLE_CHECKS)
1096}
1097
1098// static
1099template <CppHeapPointerTag tag>
1100void Object::Wrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1101 v8::Object::Wrappable* wrappable) {
1102 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1103 Wrap(isolate, obj, tag, wrappable);
1104}
1105
1106// static
1107template <CppHeapPointerTag tag>
1109 v8::Object::Wrappable* wrappable) {
1110 auto obj =
1111 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1112 Wrap(isolate, obj, tag, wrappable);
1113}
1114
1115// static
1116template <CppHeapPointerTag tag>
1118 const BasicTracedReference<Object>& wrapper,
1119 v8::Object::Wrappable* wrappable) {
1120 auto obj =
1121 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1122 Wrap(isolate, obj, tag, wrappable);
1123}
1124
1125// static
1126void Object::Wrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1127 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1128 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1129 Wrap(isolate, obj, tag, wrappable);
1130}
1131
1132// static
1134 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1135 auto obj =
1136 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1137 Wrap(isolate, obj, tag, wrappable);
1138}
1139
1140// static
1142 const BasicTracedReference<Object>& wrapper,
1143 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1144 auto obj =
1145 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1146 Wrap(isolate, obj, tag, wrappable);
1147}
1148
1150#ifdef V8_ENABLE_CHECKS
1151 CheckCast(data);
1152#endif
1153 return reinterpret_cast<Private*>(data);
1154}
1155
1157#ifdef V8_ENABLE_CHECKS
1158 CheckCast(value);
1159#endif
1160 return static_cast<Object*>(value);
1161}
1162
1163} // namespace v8
1164
1165#endif // INCLUDE_V8_OBJECT_H_
Definition: garbage-collected.h:53
Definition: name-provider.h:26
Definition: visitor.h:75
Definition: v8-traced-handle.h:124
Definition: v8-context.h:48
Definition: v8-data.h:18
Definition: v8-isolate.h:290
Definition: v8-local-handle.h:366
static Local< T > New(Isolate *isolate, Local< T > that)
Definition: v8-local-handle.h:448
Definition: v8-local-handle.h:734
Definition: v8-maybe.h:39
Definition: v8-object.h:604
const char * GetHumanReadableName() const override
Definition: v8-object.h:610
virtual const WrapperTypeInfo * GetWrapperTypeInfo() const
Definition: v8-object.h:606
virtual void Trace(cppgc::Visitor *visitor) const
Definition: v8-object.h:612
Definition: v8-object.h:248
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)
static Object * Cast(Value *obj)
Definition: v8-object.h:1156
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)
bool IsConstructor() const
bool IsUndetectable() const
MaybeLocal< Value > CallAsFunction(Local< Context > context, Local< Value > recv, int argc, Local< Value > argv[])
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:538
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:483
MaybeLocal< Value > GetRealNamedPropertyInPrototypeChain(Local< Context > context, Local< Name > key)
static int InternalFieldCount(const BasicTracedReference< Object > &object)
Definition: v8-object.h:489
Maybe< bool > Has(Local< Context > context, Local< Value > key)
void SetAlignedPointerInInternalField(int index, void *value, EmbedderDataTypeTag tag)
void * GetAlignedPointerFromInternalField(int index, EmbedderDataTypeTag tag)
Definition: v8-object.h:991
MaybeLocal< Array > GetOwnPropertyNames(Local< Context > context)
bool IsCodeLike(Isolate *isolate) const
Maybe< bool > Set(Local< Context > context, Local< Value > key, Local< Value > value)
MaybeLocal< Value > CallAsConstructor(Local< Context > context, int argc, Local< Value > argv[])
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:555
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)
bool IsApiWrapper() const
static void Wrap(v8::Isolate *isolate, const v8::Local< v8::Object > &wrapper, Wrappable *wrappable)
Definition: v8-object.h:1100
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< Data > GetInternalField(int index)
Definition: v8-object.h:944
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)
static Local< Object > New(Isolate *isolate)
int GetIdentityHash()
MaybeLocal< Context > GetCreationContext(v8::Isolate *isolate)
void SetInternalField(int index, Local< Data > data)
static T * Unwrap(v8::Isolate *isolate, const v8::Local< v8::Object > &wrapper)
Definition: v8-object.h:1015
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)
MaybeLocal< Array > PreviewEntries(bool *is_key_value)
bool IsCallable() const
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)
static Local< Object > New(Isolate *isolate, Local< Value > prototype_or_null, Local< Name > *names, Local< Value > *values, size_t length)
bool HasIndexedLookupInterceptor() const
Definition: v8-persistent-handle.h:93
Definition: v8-object.h:46
static Private * Cast(Data *data)
Definition: v8-object.h:1149
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:187
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:882
static const int kJSObjectHeaderSize
Definition: v8-internal.h:899
static Address ValueAsAddress(const T *value)
Definition: v8-internal.h:1727
ExternalPointerTag
Definition: v8-internal.h:548
uintptr_t Address
Definition: v8-internal.h:38
Definition: libplatform.h:15
IntegrityLevel
Definition: v8-object.h:243
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:226
void(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) AccessorNameGetterCallback
Definition: v8-object.h:171
SideEffectType
Definition: v8-object.h:213
AccessControl
Definition: v8-object.h:187
@ DEFAULT
Definition: v8-object.h:188
IndexFilter
Definition: v8-object.h:232
KeyConversionMode
Definition: v8-object.h:238
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:175
PropertyFilter
Definition: v8-object.h:194
@ ONLY_CONFIGURABLE
Definition: v8-object.h:198
@ SKIP_SYMBOLS
Definition: v8-object.h:200
@ ONLY_WRITABLE
Definition: v8-object.h:196
@ ALL_PROPERTIES
Definition: v8-object.h:195
@ SKIP_STRINGS
Definition: v8-object.h:199
@ ONLY_ENUMERABLE
Definition: v8-object.h:197
Definition: v8-sandbox.h:70
Definition: v8-object.h:594
const int16_t type_id
Definition: v8-object.h:595
#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_DEPRECATED(message)
Definition: v8config.h:614
#define V8_LIKELY(condition)
Definition: v8config.h:669
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:679
#define V8_ENUM_DEPRECATED(message)
Definition: v8config.h:658