Loading...
Searching...
No Matches
v8-object.h
Go to the documentation of this file.
1// Copyright 2021 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef INCLUDE_V8_OBJECT_H_
6#define INCLUDE_V8_OBJECT_H_
7
10#include "v8-internal.h" // NOLINT(build/include_directory)
11#include "v8-local-handle.h" // NOLINT(build/include_directory)
12#include "v8-maybe.h" // NOLINT(build/include_directory)
13#include "v8-persistent-handle.h" // NOLINT(build/include_directory)
14#include "v8-primitive.h" // NOLINT(build/include_directory)
15#include "v8-sandbox.h" // NOLINT(build/include_directory)
16#include "v8-traced-handle.h" // NOLINT(build/include_directory)
17#include "v8-value.h" // NOLINT(build/include_directory)
18#include "v8config.h" // NOLINT(build/include_directory)
19
20namespace v8 {
21
22class Array;
23class Function;
24class FunctionTemplate;
25template <typename T>
26class PropertyCallbackInfo;
27
34using EmbedderDataTypeTag = uint16_t;
35
37
40
46class V8_EXPORT Private : public Data {
47 public:
52
56 static Local<Private> New(Isolate* isolate,
58
69
70 V8_INLINE static Private* Cast(Data* data);
71
72 private:
73 Private();
74
75 static void CheckCast(Data* that);
76};
77
107 public:
108 // GenericDescriptor
110
111 // DataDescriptor
113
114 // DataDescriptor with writable property
115 PropertyDescriptor(Local<Value> value, bool writable);
116
117 // AccessorDescriptor
119
121
123 bool has_value() const;
124
126 bool has_get() const;
128 bool has_set() const;
129
130 void set_enumerable(bool enumerable);
131 bool enumerable() const;
132 bool has_enumerable() const;
133
134 void set_configurable(bool configurable);
135 bool configurable() const;
136 bool has_configurable() const;
137
138 bool writable() const;
139 bool has_writable() const;
140
141 struct PrivateData;
142 PrivateData* get_private() const { return private_; }
143
145 void operator=(const PropertyDescriptor&) = delete;
146
147 private:
148 PrivateData* private_;
149};
150
156 None = 0,
158 ReadOnly = 1 << 0,
160 DontEnum = 1 << 1,
162 DontDelete = 1 << 2
164
180 void (*)(Local<Name> property, const PropertyCallbackInfo<Value>& info);
181
202 void (*)(Local<Name> property, Local<Value> value,
203 const PropertyCallbackInfo<void>& info);
204
214 SKIP_SYMBOLS = 16
216
227enum class SideEffectType {
231};
232
241
247
253
258
262class V8_EXPORT Object : public Value {
263 public:
269 Local<Value> key, Local<Value> value);
271 Local<Value> key, Local<Value> value,
272 MaybeLocal<Object> receiver);
273
275 Local<Value> value);
276
288 Local<Name> key,
289 Local<Value> value);
291 uint32_t index,
292 Local<Value> value);
293
304 Local<Context> context, Local<Name> key, Local<Value> value,
305 PropertyAttribute attributes = None);
306
324 Local<Context> context, Local<Name> key, PropertyDescriptor& descriptor);
325
327 Local<Value> key);
329 Local<Value> key,
330 MaybeLocal<Object> receiver);
331
333 uint32_t index);
334
341 Local<Context> context, Local<Value> key);
342
348 Local<Context> context, Local<Name> key);
349
366 Local<Value> key);
367
369 Local<Value> key);
370
372
374 uint32_t index);
375
382 PropertyAttribute attributes = None);
383
389 Local<Context> context, Local<Name> name,
391 AccessorNameSetterCallback setter = nullptr,
392 Local<Value> data = Local<Value>(), PropertyAttribute attributes = None,
393 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
394 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
395
405 Local<Context> context, Local<Name> name,
407 PropertyAttribute attributes = None,
408 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
409 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
410
419 Local<Value> value);
422
430 Local<Context> context);
432 Local<Context> context, KeyCollectionMode mode,
433 PropertyFilter property_filter, IndexFilter index_filter,
434 KeyConversionMode key_conversion = KeyConversionMode::kKeepNumbers);
435
442 Local<Context> context);
443
451 Local<Context> context, PropertyFilter filter,
452 KeyConversionMode key_conversion = KeyConversionMode::kKeepNumbers);
453
460
467 Local<Value> prototype);
468
474
481 Local<Context> context);
482
487
492
495
498 const PersistentBase<Object>& object) {
499 return object.template value<Object>()->InternalFieldCount();
500 }
501
504 const BasicTracedReference<Object>& object) {
505 return object.template value<Object>()->InternalFieldCount();
506 }
507
518 V8_INLINE Local<Data> GetInternalField(int index);
519
521 void SetInternalField(int index, Local<Data> data);
522
528 V8_INLINE void* GetAlignedPointerFromInternalField(int index,
530 V8_INLINE void* GetAlignedPointerFromInternalField(v8::Isolate* isolate,
531 int index,
533
535 "Use GetAlignedPointerFromInternalField with EmbedderDataTypeTag "
536 "parameter instead.")
537 V8_INLINE void* GetAlignedPointerFromInternalField(int index) {
538 return GetAlignedPointerFromInternalField(index,
540 }
541
543 "Use GetAlignedPointerFromInternalField with EmbedderDataTypeTag "
544 "parameter instead.")
545 V8_INLINE void* GetAlignedPointerFromInternalField(v8::Isolate* isolate,
546 int index) {
547 return GetAlignedPointerFromInternalField(isolate, index,
549 }
550
553 const PersistentBase<Object>& object, int index,
555 return object.template value<Object>()->GetAlignedPointerFromInternalField(
556 index, tag);
557 }
558
560 "Use GetAlignedPointerFromInternalField with EmbedderDataTypeTag "
561 "parameter instead.")
562 V8_INLINE static void* GetAlignedPointerFromInternalField(
563 const PersistentBase<Object>& object, int index) {
564 return object.template value<Object>()->GetAlignedPointerFromInternalField(
565 index);
566 }
567
570 const BasicTracedReference<Object>& object, int index,
572 return object.template value<Object>()->GetAlignedPointerFromInternalField(
573 index, tag);
574 }
575
577 "Use GetAlignedPointerFromInternalField with EmbedderDataTypeTag "
578 "parameter instead.")
579 V8_INLINE static void* GetAlignedPointerFromInternalField(
580 const BasicTracedReference<Object>& object, int index) {
581 return object.template value<Object>()->GetAlignedPointerFromInternalField(
582 index);
583 }
584
590 void SetAlignedPointerInInternalField(int index, void* value,
592
594 "Use SetAlignedPointerInInternalField with EmbedderDataTypeTag parameter "
595 "instead.")
596 void SetAlignedPointerInInternalField(int index, void* value) {
597 SetAlignedPointerInInternalField(index, value, kEmbedderDataTypeTagDefault);
598 }
599
601 "Use SetAlignedPointerInInternalField with EmbedderDataTypeTag "
602 "parameter instead.")
603 void SetAlignedPointerInInternalFields(int argc, int indices[],
604 void* values[]);
605
606 // Type information for a Wrappable object that got wrapped with
607 // `v8::Object::Wrap()`.
609 const int16_t type_id;
610 };
611
612 // v8::Object::Wrappable serves as the base class for all C++ objects that can
613 // be wrapped by a JavaScript object using `v8::Object::Wrap()`.
614 //
615 // Note that v8::Object::Wrappable` inherits from `NameProvider` and provides
616 // `GetWrapperTypeInfo` to allow subclasses to have smaller object sizes.
617 class Wrappable : public cppgc::GarbageCollected<Wrappable>,
618 public cppgc::NameProvider {
619 public:
620 virtual const WrapperTypeInfo* GetWrapperTypeInfo() const {
621 return nullptr;
622 }
623
624 const char* GetHumanReadableName() const override { return "internal"; }
625
626 virtual void Trace(cppgc::Visitor* visitor) const {}
627 };
628
639 template <CppHeapPointerTag tag, typename T = void>
640 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
641 const v8::Local<v8::Object>& wrapper);
642 template <CppHeapPointerTag tag, typename T = void>
643 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
644 const PersistentBase<Object>& wrapper);
645 template <CppHeapPointerTag tag, typename T = void>
646 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
647 const BasicTracedReference<Object>& wrapper);
648
649 template <typename T = void>
650 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
651 const v8::Local<v8::Object>& wrapper,
652 CppHeapPointerTagRange tag_range);
653 template <typename T = void>
654 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
655 const PersistentBase<Object>& wrapper,
656 CppHeapPointerTagRange tag_range);
657 template <typename T = void>
658 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
659 const BasicTracedReference<Object>& wrapper,
660 CppHeapPointerTagRange tag_range);
661
671 template <CppHeapPointerTag tag>
672 static V8_INLINE void Wrap(v8::Isolate* isolate,
673 const v8::Local<v8::Object>& wrapper,
674 Wrappable* wrappable);
675 template <CppHeapPointerTag tag>
676 static V8_INLINE void Wrap(v8::Isolate* isolate,
677 const PersistentBase<Object>& wrapper,
678 Wrappable* wrappable);
679 template <CppHeapPointerTag tag>
680 static V8_INLINE void Wrap(v8::Isolate* isolate,
681 const BasicTracedReference<Object>& wrapper,
682 Wrappable* wrappable);
683 static V8_INLINE void Wrap(v8::Isolate* isolate,
684 const v8::Local<v8::Object>& wrapper,
685 Wrappable* wrappable, CppHeapPointerTag tag);
686 static V8_INLINE void Wrap(v8::Isolate* isolate,
687 const PersistentBase<Object>& wrapper,
688 Wrappable* wrappable, CppHeapPointerTag tag);
689 static V8_INLINE void Wrap(v8::Isolate* isolate,
690 const BasicTracedReference<Object>& wrapper,
691 Wrappable* wrappable, CppHeapPointerTag tag);
692
693 // Version of Wrap() function for v8::Context::Global() objects.
694 // Unlike the functions above it wraps both JSGlobalProxy and its hidden
695 // prototype (JSGlobalObject or remote object).
696 static void WrapGlobal(v8::Isolate* isolate,
697 const v8::Local<v8::Object>& wrapper,
698 Wrappable* wrappable, CppHeapPointerTag tag);
699
700 // Checks that wrappables set on JSGlobalProxy and its hidden prototype are
701 // the same.
702 static bool CheckGlobalWrappable(v8::Isolate* isolate,
703 const v8::Local<v8::Object>& wrapper,
704 CppHeapPointerTagRange tag_range);
705
713 Local<Name> key);
715 uint32_t index);
730 Local<Name> key);
732 Local<Context> context, uint32_t index);
734 Local<Context> context, Local<Name> key);
735
741 Local<Context> context, Local<Name> key);
742
750 Local<Name> key);
751
758 Local<Context> context, Local<Name> key);
759
766 Local<Context> context, Local<Name> key);
767
770
773
782
791
798 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
799 MaybeLocal<Context> GetCreationContext();
800
806 Local<Context> GetCreationContextChecked(v8::Isolate* isolate);
807 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
808 Local<Context> GetCreationContextChecked();
809
811 V8_INLINE static MaybeLocal<Context> GetCreationContext(
812 v8::Isolate* isolate, const PersistentBase<Object>& object) {
813 return object.template value<Object>()->GetCreationContext(isolate);
814 }
815 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
816 V8_INLINE static MaybeLocal<Context> GetCreationContext(
817 const PersistentBase<Object>& object);
818
833 void* GetAlignedPointerFromEmbedderDataInCreationContext(
834 v8::Isolate* isolate, int index, EmbedderDataTypeTag tag);
835 void* GetAlignedPointerFromEmbedderDataInCreationContext(
836 int index, EmbedderDataTypeTag tag);
837
839 "Use GetAlignedPointerFromEmbedderDataInCreationContext with "
840 "EmbedderDataTypeTag parameter instead.")
841 void* GetAlignedPointerFromEmbedderDataInCreationContext(v8::Isolate* isolate,
842 int index) {
843 return GetAlignedPointerFromEmbedderDataInCreationContext(
844 isolate, index, kEmbedderDataTypeTagDefault);
845 }
846
848 "Use GetAlignedPointerFromEmbedderDataInCreationContext with "
849 "EmbedderDataTypeTag parameter instead.")
850 void* GetAlignedPointerFromEmbedderDataInCreationContext(int index) {
851 return GetAlignedPointerFromEmbedderDataInCreationContext(
853 }
854
860 bool IsCallable() const;
861
865 bool IsConstructor() const;
866
878 bool IsApiWrapper() const;
879
885 bool IsUndetectable() const;
886
892 Local<Value> recv,
893 int argc,
894 Local<Value> argv[]);
895
902 Local<Context> context, int argc, Local<Value> argv[]);
903
914
915 static Local<Object> New(Isolate* isolate);
916
925 static Local<Object> New(Isolate* isolate, Local<Value> prototype_or_null,
926 Local<Name>* names, Local<Value>* values,
927 size_t length);
928
929 V8_INLINE static Object* Cast(Value* obj);
930
939 bool IsCodeLike(Isolate* isolate) const;
940
941 private:
942 static void* Unwrap(v8::Isolate* isolate, internal::Address wrapper_obj,
943 CppHeapPointerTagRange tag_range);
944 static void Wrap(v8::Isolate* isolate, internal::Address wrapper_obj,
945 CppHeapPointerTag tag, void* wrappable);
946
947 Object();
948 static void CheckCast(Value* obj);
949 Local<Data> SlowGetInternalField(int index);
950 void* SlowGetAlignedPointerFromInternalField(int index,
952 void* SlowGetAlignedPointerFromInternalField(v8::Isolate* isolate, int index,
954};
955
956// --- Implementation ---
957
959#ifndef V8_ENABLE_CHECKS
960 using A = internal::Address;
961 using I = internal::Internals;
963 // Fast path: If the object is a plain JSObject, which is the common case, we
964 // know where to find the internal fields and can return the value directly.
965 int instance_type = I::GetInstanceType(obj);
966 if (I::CanHaveInternalField(instance_type)) {
967 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
968 (I::kEmbedderDataSlotSize * index);
969 A value = I::ReadRawField<A>(obj, offset);
970#ifdef V8_COMPRESS_POINTERS
971 // We read the full pointer value and then decompress it in order to avoid
972 // dealing with potential endianness issues.
973 value = I::DecompressTaggedField(obj, static_cast<uint32_t>(value));
974#endif
975
976 auto* isolate = I::GetCurrentIsolate();
977 return Local<Data>::New(isolate, value);
978 }
979#endif
980 return SlowGetInternalField(index);
981}
982
984 int index,
986#if !defined(V8_ENABLE_CHECKS)
987 using A = internal::Address;
988 using I = internal::Internals;
990 // Fast path: If the object is a plain JSObject, which is the common case, we
991 // know where to find the internal fields and can return the value directly.
992 auto instance_type = I::GetInstanceType(obj);
993 if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
994 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
995 (I::kEmbedderDataSlotSize * index) +
996 I::kEmbedderDataSlotExternalPointerOffset;
997 A value = I::ReadExternalPointerField(isolate, obj, offset,
999 return reinterpret_cast<void*>(value);
1000 }
1001#endif
1002 return SlowGetAlignedPointerFromInternalField(isolate, index, tag);
1003}
1004
1006 EmbedderDataTypeTag tag) {
1007#if !defined(V8_ENABLE_CHECKS)
1008 using A = internal::Address;
1009 using I = internal::Internals;
1011 // Fast path: If the object is a plain JSObject, which is the common case, we
1012 // know where to find the internal fields and can return the value directly.
1013 auto instance_type = I::GetInstanceType(obj);
1014 if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
1015 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
1016 (I::kEmbedderDataSlotSize * index) +
1017 I::kEmbedderDataSlotExternalPointerOffset;
1018 Isolate* isolate = I::GetCurrentIsolateForSandbox();
1019 A value = I::ReadExternalPointerField(isolate, obj, offset,
1021 return reinterpret_cast<void*>(value);
1022 }
1023#endif
1024 return SlowGetAlignedPointerFromInternalField(index, tag);
1025}
1026
1027// static
1028template <CppHeapPointerTag tag, typename T>
1030 CppHeapPointerTagRange tag_range(tag, tag);
1031 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
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 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 <CppHeapPointerTag tag, typename T>
1057 const BasicTracedReference<Object>& wrapper) {
1058 CppHeapPointerTagRange tag_range(tag, tag);
1059 auto obj =
1060 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1061#if !defined(V8_ENABLE_CHECKS)
1062 return internal::ReadCppHeapPointerField<T>(
1063 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1064#else // defined(V8_ENABLE_CHECKS)
1065 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1066#endif // defined(V8_ENABLE_CHECKS)
1067}
1068
1069// static
1070template <typename T>
1072 CppHeapPointerTagRange tag_range) {
1073 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
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 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1079#endif // defined(V8_ENABLE_CHECKS)
1080}
1081
1082// static
1083template <typename T>
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
1093 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1094#endif // defined(V8_ENABLE_CHECKS)
1095}
1096
1097// static
1098template <typename T>
1100 const BasicTracedReference<Object>& wrapper,
1101 CppHeapPointerTagRange tag_range) {
1102 auto obj =
1103 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1104#if !defined(V8_ENABLE_CHECKS)
1105 return internal::ReadCppHeapPointerField<T>(
1106 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1107#else // defined(V8_ENABLE_CHECKS)
1108 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1109#endif // defined(V8_ENABLE_CHECKS)
1110}
1111
1112// static
1113template <CppHeapPointerTag tag>
1114void Object::Wrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1115 v8::Object::Wrappable* wrappable) {
1116 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1117 Wrap(isolate, obj, tag, wrappable);
1118}
1119
1120// static
1121template <CppHeapPointerTag tag>
1123 v8::Object::Wrappable* wrappable) {
1124 auto obj =
1125 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1126 Wrap(isolate, obj, tag, wrappable);
1127}
1128
1129// static
1130template <CppHeapPointerTag tag>
1132 const BasicTracedReference<Object>& wrapper,
1133 v8::Object::Wrappable* wrappable) {
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, const v8::Local<v8::Object>& wrapper,
1141 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1142 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1143 Wrap(isolate, obj, tag, wrappable);
1144}
1145
1146// static
1148 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1149 auto obj =
1150 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1151 Wrap(isolate, obj, tag, wrappable);
1152}
1153
1154// static
1156 const BasicTracedReference<Object>& wrapper,
1157 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1158 auto obj =
1159 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1160 Wrap(isolate, obj, tag, wrappable);
1161}
1162
1164#ifdef V8_ENABLE_CHECKS
1165 CheckCast(data);
1166#endif
1167 return reinterpret_cast<Private*>(data);
1168}
1169
1171#ifdef V8_ENABLE_CHECKS
1172 CheckCast(value);
1173#endif
1174 return static_cast<Object*>(value);
1175}
1176
1177} // namespace v8
1178
1179#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:291
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:618
const char * GetHumanReadableName() const override
Definition: v8-object.h:624
virtual const WrapperTypeInfo * GetWrapperTypeInfo() const
Definition: v8-object.h:620
virtual void Trace(cppgc::Visitor *visitor) const
Definition: v8-object.h:626
Definition: v8-object.h:262
Maybe< PropertyAttribute > GetRealNamedPropertyAttributesInPrototypeChain(Local< Context > context, Local< Name > key)
Maybe< PropertyAttribute > GetPropertyAttributes(Local< Context > context, Local< Value > key)
Maybe< bool > CreateDataProperty(Local< Context > context, uint32_t index, Local< Value > value)
MaybeLocal< Value > GetOwnPropertyDescriptor(Local< Context > context, Local< Name > key)
static Object * Cast(Value *obj)
Definition: v8-object.h:1170
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:552
Maybe< bool > SetNativeDataProperty(Local< Context > context, Local< Name > name, AccessorNameGetterCallback getter, AccessorNameSetterCallback setter=nullptr, Local< Value > data=Local< Value >(), PropertyAttribute attributes=None, SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect, SideEffectType setter_side_effect_type=SideEffectType::kHasSideEffect)
static int InternalFieldCount(const PersistentBase< Object > &object)
Definition: v8-object.h:497
MaybeLocal< Value > GetRealNamedPropertyInPrototypeChain(Local< Context > context, Local< Name > key)
static int InternalFieldCount(const BasicTracedReference< Object > &object)
Definition: v8-object.h:503
Maybe< bool > Has(Local< Context > context, Local< Value > key)
void SetAlignedPointerInInternalField(int index, void *value, EmbedderDataTypeTag tag)
void * GetAlignedPointerFromInternalField(int index, EmbedderDataTypeTag tag)
Definition: v8-object.h:1005
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:569
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:1114
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:958
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:1029
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:1163
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:878
static const int kJSObjectHeaderSize
Definition: v8-internal.h:895
static Address ValueAsAddress(const T *value)
Definition: v8-internal.h:1734
ExternalPointerTag
Definition: v8-internal.h:548
uintptr_t Address
Definition: v8-internal.h:38
Definition: libplatform.h:15
IntegrityLevel
Definition: v8-object.h:257
PropertyAttribute
Definition: v8-object.h:154
@ DontEnum
Definition: v8-object.h:160
@ None
Definition: v8-object.h:156
@ DontDelete
Definition: v8-object.h:162
@ ReadOnly
Definition: v8-object.h:158
internal::ExternalPointerTag ToExternalPointerTag(v8::EmbedderDataTypeTag api_tag)
KeyCollectionMode
Definition: v8-object.h:240
void(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) AccessorNameGetterCallback
Definition: v8-object.h:180
SideEffectType
Definition: v8-object.h:227
IndexFilter
Definition: v8-object.h:246
KeyConversionMode
Definition: v8-object.h:252
CppHeapPointerTag
Definition: v8-sandbox.h:28
constexpr EmbedderDataTypeTag kEmbedderDataTypeTagDefault
Definition: v8-object.h:36
uint16_t EmbedderDataTypeTag
Definition: v8-object.h:34
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) AccessorNameSetterCallback
Definition: v8-object.h:203
PropertyFilter
Definition: v8-object.h:208
@ ONLY_CONFIGURABLE
Definition: v8-object.h:212
@ SKIP_SYMBOLS
Definition: v8-object.h:214
@ ONLY_WRITABLE
Definition: v8-object.h:210
@ ALL_PROPERTIES
Definition: v8-object.h:209
@ SKIP_STRINGS
Definition: v8-object.h:213
@ ONLY_ENUMERABLE
Definition: v8-object.h:211
Definition: v8-sandbox.h:70
Definition: v8-object.h:608
const int16_t type_id
Definition: v8-object.h:609
#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