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
459 // TODO(http://crbug.com/333672197): deprecate and remove.
460 V8_DEPRECATE_SOON("Use GetPrototype().")
461 inline Local<Value> GetPrototypeV2() { return GetPrototype(); }
462
468 Local<Value> prototype);
469 // TODO(http://crbug.com/333672197): deprecate and remove.
470 V8_DEPRECATE_SOON("Use SetPrototype().")
471 V8_WARN_UNUSED_RESULT Maybe<bool> SetPrototypeV2(Local<Context> context,
472 Local<Value> prototype) {
473 return SetPrototype(context, prototype);
474 }
475
481
488 Local<Context> context);
489
494
499
502
505 const PersistentBase<Object>& object) {
506 return object.template value<Object>()->InternalFieldCount();
507 }
508
511 const BasicTracedReference<Object>& object) {
512 return object.template value<Object>()->InternalFieldCount();
513 }
514
525 V8_INLINE Local<Data> GetInternalField(int index);
526
528 void SetInternalField(int index, Local<Data> data);
529
535 V8_INLINE void* GetAlignedPointerFromInternalField(int index,
537 V8_INLINE void* GetAlignedPointerFromInternalField(v8::Isolate* isolate,
538 int index,
540
543 const PersistentBase<Object>& object, int index,
545 return object.template value<Object>()->GetAlignedPointerFromInternalField(
546 index, tag);
547 }
548
551 const BasicTracedReference<Object>& object, int index,
553 return object.template value<Object>()->GetAlignedPointerFromInternalField(
554 index, tag);
555 }
556
562 void SetAlignedPointerInInternalField(int index, void* value,
564
565 // Type information for a Wrappable object that got wrapped with
566 // `v8::Object::Wrap()`.
568 const int16_t type_id;
569 };
570
571 // v8::Object::Wrappable serves as the base class for all C++ objects that can
572 // be wrapped by a JavaScript object using `v8::Object::Wrap()`.
573 //
574 // Note that v8::Object::Wrappable` inherits from `NameProvider` and provides
575 // `GetWrapperTypeInfo` to allow subclasses to have smaller object sizes.
576 class Wrappable : public cppgc::GarbageCollected<Wrappable>,
577 public cppgc::NameProvider {
578 public:
579 virtual const WrapperTypeInfo* GetWrapperTypeInfo() const {
580 return nullptr;
581 }
582
583 const char* GetHumanReadableName() const override { return "internal"; }
584
585 virtual void Trace(cppgc::Visitor* visitor) const {}
586 };
587
598 template <CppHeapPointerTag tag, typename T = void>
599 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
600 const v8::Local<v8::Object>& wrapper);
601 template <CppHeapPointerTag tag, typename T = void>
602 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
603 const PersistentBase<Object>& wrapper);
604 template <CppHeapPointerTag tag, typename T = void>
605 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
606 const BasicTracedReference<Object>& wrapper);
607
608 template <typename T = void>
609 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
610 const v8::Local<v8::Object>& wrapper,
611 CppHeapPointerTagRange tag_range);
612 template <typename T = void>
613 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
614 const PersistentBase<Object>& wrapper,
615 CppHeapPointerTagRange tag_range);
616 template <typename T = void>
617 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
618 const BasicTracedReference<Object>& wrapper,
619 CppHeapPointerTagRange tag_range);
620
630 template <CppHeapPointerTag tag>
631 static V8_INLINE void Wrap(v8::Isolate* isolate,
632 const v8::Local<v8::Object>& wrapper,
633 Wrappable* wrappable);
634 template <CppHeapPointerTag tag>
635 static V8_INLINE void Wrap(v8::Isolate* isolate,
636 const PersistentBase<Object>& wrapper,
637 Wrappable* wrappable);
638 template <CppHeapPointerTag tag>
639 static V8_INLINE void Wrap(v8::Isolate* isolate,
640 const BasicTracedReference<Object>& wrapper,
641 Wrappable* wrappable);
642 static V8_INLINE void Wrap(v8::Isolate* isolate,
643 const v8::Local<v8::Object>& wrapper,
644 Wrappable* wrappable, CppHeapPointerTag tag);
645 static V8_INLINE void Wrap(v8::Isolate* isolate,
646 const PersistentBase<Object>& wrapper,
647 Wrappable* wrappable, CppHeapPointerTag tag);
648 static V8_INLINE void Wrap(v8::Isolate* isolate,
649 const BasicTracedReference<Object>& wrapper,
650 Wrappable* wrappable, CppHeapPointerTag tag);
651
652 // Version of Wrap() function for v8::Context::Global() objects.
653 // Unlike the functions above it wraps both JSGlobalProxy and its hidden
654 // prototype (JSGlobalObject or remote object).
655 static void WrapGlobal(v8::Isolate* isolate,
656 const v8::Local<v8::Object>& wrapper,
657 Wrappable* wrappable, CppHeapPointerTag tag);
658
659 // Checks that wrappables set on JSGlobalProxy and its hidden prototype are
660 // the same.
661 static bool CheckGlobalWrappable(v8::Isolate* isolate,
662 const v8::Local<v8::Object>& wrapper,
663 CppHeapPointerTagRange tag_range);
664
672 Local<Name> key);
674 uint32_t index);
689 Local<Name> key);
691 Local<Context> context, uint32_t index);
693 Local<Context> context, Local<Name> key);
694
700 Local<Context> context, Local<Name> key);
701
709 Local<Name> key);
710
717 Local<Context> context, Local<Name> key);
718
725 Local<Context> context, Local<Name> key);
726
729
732
741
750
757 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
758 MaybeLocal<Context> GetCreationContext();
759
765 Local<Context> GetCreationContextChecked(v8::Isolate* isolate);
766 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
767 Local<Context> GetCreationContextChecked();
768
770 V8_INLINE static MaybeLocal<Context> GetCreationContext(
771 v8::Isolate* isolate, const PersistentBase<Object>& object) {
772 return object.template value<Object>()->GetCreationContext(isolate);
773 }
774 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
775 V8_INLINE static MaybeLocal<Context> GetCreationContext(
776 const PersistentBase<Object>& object);
777
797 void* GetAlignedPointerFromEmbedderDataInCreationContext(
798 v8::Isolate* isolate, int index, EmbedderDataTypeTag tag);
799 void* GetAlignedPointerFromEmbedderDataInCreationContext(
800 int index, EmbedderDataTypeTag tag);
801
807 bool IsCallable() const;
808
812 bool IsConstructor() const;
813
825 bool IsApiWrapper() const;
826
832 bool IsUndetectable() const;
833
839 Local<Value> recv,
840 int argc,
841 Local<Value> argv[]);
842
849 Local<Context> context, int argc, Local<Value> argv[]);
850
860 MaybeLocal<Array> PreviewEntries(bool* is_key_value);
861
862 static Local<Object> New(Isolate* isolate);
863
872 static Local<Object> New(Isolate* isolate, Local<Value> prototype_or_null,
873 Local<Name>* names, Local<Value>* values,
874 size_t length);
875
876 V8_INLINE static Object* Cast(Value* obj);
877
886 bool IsCodeLike(Isolate* isolate) const;
887
888 private:
889 static void* Unwrap(v8::Isolate* isolate, internal::Address wrapper_obj,
890 CppHeapPointerTagRange tag_range);
891 static void Wrap(v8::Isolate* isolate, internal::Address wrapper_obj,
892 CppHeapPointerTag tag, void* wrappable);
893
894 Object();
895 static void CheckCast(Value* obj);
896 Local<Data> SlowGetInternalField(int index);
897 void* SlowGetAlignedPointerFromInternalField(int index,
899 void* SlowGetAlignedPointerFromInternalField(v8::Isolate* isolate, int index,
901};
902
903// --- Implementation ---
904
905Local<Data> Object::GetInternalField(int index) {
906#ifndef V8_ENABLE_CHECKS
907 using A = internal::Address;
908 using I = internal::Internals;
909 A obj = internal::ValueHelper::ValueAsAddress(this);
910 // Fast path: If the object is a plain JSObject, which is the common case, we
911 // know where to find the internal fields and can return the value directly.
912 int instance_type = I::GetInstanceType(obj);
913 if (I::CanHaveInternalField(instance_type)) {
914 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
915 (I::kEmbedderDataSlotSize * index);
916 A value = I::ReadRawField<A>(obj, offset);
917#ifdef V8_COMPRESS_POINTERS
918 // We read the full pointer value and then decompress it in order to avoid
919 // dealing with potential endianness issues.
920 value = I::DecompressTaggedField(obj, static_cast<uint32_t>(value));
921#endif
922
923 auto* isolate = I::GetCurrentIsolate();
924 return Local<Data>::New(isolate, value);
925 }
926#endif
927 return SlowGetInternalField(index);
928}
929
930void* Object::GetAlignedPointerFromInternalField(v8::Isolate* isolate,
931 int index,
933#if !defined(V8_ENABLE_CHECKS)
934 using A = internal::Address;
935 using I = internal::Internals;
936 A obj = internal::ValueHelper::ValueAsAddress(this);
937 // Fast path: If the object is a plain JSObject, which is the common case, we
938 // know where to find the internal fields and can return the value directly.
939 auto instance_type = I::GetInstanceType(obj);
940 if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
941 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
942 (I::kEmbedderDataSlotSize * index) +
943 I::kEmbedderDataSlotExternalPointerOffset;
944 A value = I::ReadExternalPointerField(isolate, obj, offset,
946 return reinterpret_cast<void*>(value);
947 }
948#endif
949 return SlowGetAlignedPointerFromInternalField(isolate, index, tag);
950}
951
952void* Object::GetAlignedPointerFromInternalField(int index,
954#if !defined(V8_ENABLE_CHECKS)
955 using A = internal::Address;
956 using I = internal::Internals;
957 A obj = internal::ValueHelper::ValueAsAddress(this);
958 // Fast path: If the object is a plain JSObject, which is the common case, we
959 // know where to find the internal fields and can return the value directly.
960 auto instance_type = I::GetInstanceType(obj);
961 if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
962 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
963 (I::kEmbedderDataSlotSize * index) +
964 I::kEmbedderDataSlotExternalPointerOffset;
965 Isolate* isolate = I::GetCurrentIsolateForSandbox();
966 A value = I::ReadExternalPointerField(isolate, obj, offset,
968 return reinterpret_cast<void*>(value);
969 }
970#endif
971 return SlowGetAlignedPointerFromInternalField(index, tag);
972}
973
974// static
975template <CppHeapPointerTag tag, typename T>
976T* Object::Unwrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper) {
977 CppHeapPointerTagRange tag_range(tag, tag);
978 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
979#if !defined(V8_ENABLE_CHECKS)
980 return internal::ReadCppHeapPointerField<T>(
981 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
982#else // defined(V8_ENABLE_CHECKS)
983 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
984#endif // defined(V8_ENABLE_CHECKS)
985}
986
987// static
988template <CppHeapPointerTag tag, typename T>
989T* Object::Unwrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper) {
990 CppHeapPointerTagRange tag_range(tag, tag);
991 auto obj =
992 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
993#if !defined(V8_ENABLE_CHECKS)
994 return internal::ReadCppHeapPointerField<T>(
995 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
996#else // defined(V8_ENABLE_CHECKS)
997 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
998#endif // defined(V8_ENABLE_CHECKS)
999}
1000
1001// static
1002template <CppHeapPointerTag tag, typename T>
1003T* Object::Unwrap(v8::Isolate* isolate,
1004 const BasicTracedReference<Object>& wrapper) {
1005 CppHeapPointerTagRange tag_range(tag, tag);
1006 auto obj =
1007 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1008#if !defined(V8_ENABLE_CHECKS)
1009 return internal::ReadCppHeapPointerField<T>(
1010 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1011#else // defined(V8_ENABLE_CHECKS)
1012 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1013#endif // defined(V8_ENABLE_CHECKS)
1014}
1015
1016// static
1017template <typename T>
1018T* Object::Unwrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1019 CppHeapPointerTagRange tag_range) {
1020 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1021#if !defined(V8_ENABLE_CHECKS)
1022 return internal::ReadCppHeapPointerField<T>(
1023 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1024#else // defined(V8_ENABLE_CHECKS)
1025 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1026#endif // defined(V8_ENABLE_CHECKS)
1027}
1028
1029// static
1030template <typename T>
1031T* Object::Unwrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper,
1032 CppHeapPointerTagRange tag_range) {
1033 auto obj =
1034 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1035#if !defined(V8_ENABLE_CHECKS)
1036 return internal::ReadCppHeapPointerField<T>(
1037 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1038#else // defined(V8_ENABLE_CHECKS)
1039
1040 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1041#endif // defined(V8_ENABLE_CHECKS)
1042}
1043
1044// static
1045template <typename T>
1046T* Object::Unwrap(v8::Isolate* isolate,
1047 const BasicTracedReference<Object>& wrapper,
1048 CppHeapPointerTagRange tag_range) {
1049 auto obj =
1050 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1051#if !defined(V8_ENABLE_CHECKS)
1052 return internal::ReadCppHeapPointerField<T>(
1053 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1054#else // defined(V8_ENABLE_CHECKS)
1055 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1056#endif // defined(V8_ENABLE_CHECKS)
1057}
1058
1059// static
1060template <CppHeapPointerTag tag>
1061void Object::Wrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1062 v8::Object::Wrappable* wrappable) {
1063 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1064 Wrap(isolate, obj, tag, wrappable);
1065}
1066
1067// static
1068template <CppHeapPointerTag tag>
1069void Object::Wrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper,
1070 v8::Object::Wrappable* wrappable) {
1071 auto obj =
1072 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1073 Wrap(isolate, obj, tag, wrappable);
1074}
1075
1076// static
1077template <CppHeapPointerTag tag>
1078void Object::Wrap(v8::Isolate* isolate,
1079 const BasicTracedReference<Object>& wrapper,
1080 v8::Object::Wrappable* wrappable) {
1081 auto obj =
1082 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1083 Wrap(isolate, obj, tag, wrappable);
1084}
1085
1086// static
1087void Object::Wrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1088 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1089 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1090 Wrap(isolate, obj, tag, wrappable);
1091}
1092
1093// static
1094void Object::Wrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper,
1095 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1096 auto obj =
1097 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1098 Wrap(isolate, obj, tag, wrappable);
1099}
1100
1101// static
1102void Object::Wrap(v8::Isolate* isolate,
1103 const BasicTracedReference<Object>& wrapper,
1104 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1105 auto obj =
1106 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1107 Wrap(isolate, obj, tag, wrappable);
1108}
1109
1110Private* Private::Cast(Data* data) {
1111#ifdef V8_ENABLE_CHECKS
1112 CheckCast(data);
1113#endif
1114 return reinterpret_cast<Private*>(data);
1115}
1116
1117Object* Object::Cast(v8::Value* value) {
1118#ifdef V8_ENABLE_CHECKS
1119 CheckCast(value);
1120#endif
1121 return static_cast<Object*>(value);
1122}
1123
1124} // namespace v8
1125
1126#endif // INCLUDE_V8_OBJECT_H_
Definition: garbage-collected.h:53
Definition: name-provider.h:26
Definition: visitor.h:75
Definition: v8-container.h:25
Definition: v8-traced-handle.h:124
Definition: v8-context.h:48
Definition: v8-data.h:18
Definition: v8-isolate.h:291
Definition: v8-local-handle.h:366
Definition: v8-local-handle.h:734
Definition: v8-maybe.h:39
Definition: v8-primitive.h:79
Definition: v8-object.h:577
const char * GetHumanReadableName() const override
Definition: v8-object.h:583
virtual const WrapperTypeInfo * GetWrapperTypeInfo() const
Definition: v8-object.h:579
virtual void Trace(cppgc::Visitor *visitor) const
Definition: v8-object.h:585
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)
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:542
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:504
MaybeLocal< Value > GetRealNamedPropertyInPrototypeChain(Local< Context > context, Local< Name > key)
static int InternalFieldCount(const BasicTracedReference< Object > &object)
Definition: v8-object.h:510
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:550
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)
static bool CheckGlobalWrappable(v8::Isolate *isolate, const v8::Local< v8::Object > &wrapper, CppHeapPointerTagRange tag_range)
Maybe< bool > HasPrivate(Local< Context > context, Local< Private > key)
Local< Object > FindInstanceInPrototypeChain(Local< FunctionTemplate > tmpl)
MaybeLocal< Value > Get(Local< Context > context, Local< Value > key)
int GetIdentityHash()
MaybeLocal< Context > GetCreationContext(v8::Isolate *isolate)
void SetInternalField(int index, Local< Data > data)
MaybeLocal< Array > GetOwnPropertyNames(Local< Context > context, PropertyFilter filter, KeyConversionMode key_conversion=KeyConversionMode::kKeepNumbers)
Maybe< bool > Set(Local< Context > context, uint32_t index, Local< Value > value)
Local< Object > Clone(v8::Isolate *isolate)
Maybe< bool > HasOwnProperty(Local< Context > context, Local< Name > key)
Maybe< bool > Has(Local< Context > context, uint32_t index)
Maybe< bool > DeletePrivate(Local< Context > context, Local< Private > key)
Local< String > GetConstructorName()
MaybeLocal< Value > Get(Local< Context > context, Local< Value > key, MaybeLocal< Object > receiver)
Maybe< bool > HasRealNamedCallbackProperty(Local< Context > context, Local< Name > key)
Maybe< bool > Set(Local< Context > context, Local< Value > key, Local< Value > value, MaybeLocal< Object > receiver)
Maybe< bool > HasOwnProperty(Local< Context > context, uint32_t index)
bool HasIndexedLookupInterceptor() const
Definition: v8-persistent-handle.h:93
Definition: v8-object.h:46
Local< Value > Name() const
static Local< Private > ForApi(Isolate *isolate, Local< String > name)
static Local< Private > New(Isolate *isolate, Local< String > name=Local< String >())
Definition: v8-function-callback.h:224
Definition: v8-object.h:106
void set_enumerable(bool enumerable)
bool has_writable() const
bool has_value() const
Local< Value > get() const
Local< Value > set() const
PropertyDescriptor(Local< Value > get, Local< Value > set)
bool has_enumerable() const
PropertyDescriptor(Local< Value > value)
PrivateData * get_private() const
Definition: v8-object.h:142
void operator=(const PropertyDescriptor &)=delete
Local< Value > value() const
bool enumerable() const
PropertyDescriptor(Local< Value > value, bool writable)
void set_configurable(bool configurable)
PropertyDescriptor(const PropertyDescriptor &)=delete
bool has_configurable() const
bool configurable() const
Definition: v8-value.h:32
Definition: v8-internal.h:934
ExternalPointerTag
Definition: v8-internal.h:590
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-object.h:567
const int16_t type_id
Definition: v8-object.h:568
Definition: v8-internal.h:485
#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