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
41class V8_EXPORT Private : public Data {
42 public:
47
51 static Local<Private> New(Isolate* isolate,
53
64
65 V8_INLINE static Private* Cast(Data* data);
66
67 private:
68 Private();
69
70 static void CheckCast(Data* that);
71};
72
102 public:
103 // GenericDescriptor
105
106 // DataDescriptor
108
109 // DataDescriptor with writable property
110 PropertyDescriptor(Local<Value> value, bool writable);
111
112 // AccessorDescriptor
114
116
118 bool has_value() const;
119
121 bool has_get() const;
123 bool has_set() const;
124
125 void set_enumerable(bool enumerable);
126 bool enumerable() const;
127 bool has_enumerable() const;
128
129 void set_configurable(bool configurable);
130 bool configurable() const;
131 bool has_configurable() const;
132
133 bool writable() const;
134 bool has_writable() const;
135
136 struct PrivateData;
137 PrivateData* get_private() const { return private_; }
138
140 void operator=(const PropertyDescriptor&) = delete;
141
142 private:
143 PrivateData* private_;
144};
145
151 None = 0,
153 ReadOnly = 1 << 0,
155 DontEnum = 1 << 1,
157 DontDelete = 1 << 2
159
166 void (*)(Local<Name> property, const PropertyCallbackInfo<Value>& info);
167
169 void (*)(Local<Name> property, Local<Value> value,
170 const PropertyCallbackInfo<void>& info);
171
181 "This enum is no longer used and will be removed in V8 12.9.")
184 };
185
195 SKIP_SYMBOLS = 16
197
208enum class SideEffectType {
212};
213
222
228
234
239
243class V8_EXPORT Object : public Value {
244 public:
250 Local<Value> key, Local<Value> value);
252 Local<Value> key, Local<Value> value,
253 MaybeLocal<Object> receiver);
254
256 Local<Value> value);
257
269 Local<Name> key,
270 Local<Value> value);
272 uint32_t index,
273 Local<Value> value);
274
285 Local<Context> context, Local<Name> key, Local<Value> value,
286 PropertyAttribute attributes = None);
287
305 Local<Context> context, Local<Name> key, PropertyDescriptor& descriptor);
306
308 Local<Value> key);
310 Local<Value> key,
311 MaybeLocal<Object> receiver);
312
314 uint32_t index);
315
322 Local<Context> context, Local<Value> key);
323
329 Local<Context> context, Local<Name> key);
330
347 Local<Value> key);
348
350 Local<Value> key);
351
353
355 uint32_t index);
356
363 PropertyAttribute attributes = None);
364
370 Local<Context> context, Local<Name> name,
372 AccessorNameSetterCallback setter = nullptr,
373 Local<Value> data = Local<Value>(), PropertyAttribute attributes = None,
374 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
375 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
376
386 Local<Context> context, Local<Name> name,
388 PropertyAttribute attributes = None,
389 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
390 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
391
400 Local<Value> value);
403
411 Local<Context> context);
413 Local<Context> context, KeyCollectionMode mode,
414 PropertyFilter property_filter, IndexFilter index_filter,
415 KeyConversionMode key_conversion = KeyConversionMode::kKeepNumbers);
416
423 Local<Context> context);
424
432 Local<Context> context, PropertyFilter filter,
433 KeyConversionMode key_conversion = KeyConversionMode::kKeepNumbers);
434
441 "V8 will stop providing access to hidden prototype (i.e. "
442 "JSGlobalObject). Use GetPrototypeV2() instead. "
443 "See http://crbug.com/333672197.")
444 Local<Value> GetPrototype();
445
452 Local<Value> GetPrototypeV2();
453
460 "V8 will stop providing access to hidden prototype (i.e. "
461 "JSGlobalObject). Use SetPrototypeV2() instead. "
462 "See http://crbug.com/333672197.")
463 V8_WARN_UNUSED_RESULT Maybe<bool> SetPrototype(Local<Context> context,
464 Local<Value> prototype);
465
472 V8_WARN_UNUSED_RESULT Maybe<bool> SetPrototypeV2(Local<Context> context,
473 Local<Value> prototype);
474
479 Local<Object> FindInstanceInPrototypeChain(Local<FunctionTemplate> tmpl);
480
487 Local<Context> context);
488
492 Local<String> GetConstructorName();
493
497 Maybe<bool> SetIntegrityLevel(Local<Context> context, IntegrityLevel level);
498
500 int InternalFieldCount() const;
501
503 V8_INLINE static int InternalFieldCount(
504 const PersistentBase<Object>& object) {
505 return object.template value<Object>()->InternalFieldCount();
506 }
507
510 const BasicTracedReference<Object>& object) {
511 return object.template value<Object>()->InternalFieldCount();
512 }
513
524 V8_INLINE Local<Data> GetInternalField(int index);
525
527 void SetInternalField(int index, Local<Data> data);
528
534 V8_INLINE void* GetAlignedPointerFromInternalField(int index);
535 V8_INLINE void* GetAlignedPointerFromInternalField(v8::Isolate* isolate,
536 int index);
537
540 const PersistentBase<Object>& object, int index) {
541 return object.template value<Object>()->GetAlignedPointerFromInternalField(
542 index);
543 }
544
547 const BasicTracedReference<Object>& object, int index) {
548 return object.template value<Object>()->GetAlignedPointerFromInternalField(
549 index);
550 }
551
558 "Use SetAlignedPointerInInternalField with EmbedderDataTypeTag parameter "
559 "instead.")
560 void SetAlignedPointerInInternalField(int index, void* value);
561
562 void SetAlignedPointerInInternalField(int index, void* value,
564
566 "Use SetAlignedPointerInInternalField with EmbedderDataTypeTag "
567 "parameter instead.")
568 void SetAlignedPointerInInternalFields(int argc, int indices[],
569 void* values[]);
570
571 // Type information for a Wrappable object that got wrapped with
572 // `v8::Object::Wrap()`.
574 const int16_t type_id;
575 };
576
577 // v8::Object::Wrappable serves as the base class for all C++ objects that can
578 // be wrapped by a JavaScript object using `v8::Object::Wrap()`.
579 //
580 // Note that v8::Object::Wrappable` inherits from `NameProvider` and provides
581 // `GetWrapperTypeInfo` to allow subclasses to have smaller object sizes.
582 class Wrappable : public cppgc::GarbageCollected<Wrappable>,
583 public cppgc::NameProvider {
584 public:
585 virtual const WrapperTypeInfo* GetWrapperTypeInfo() const {
586 return nullptr;
587 }
588
589 const char* GetHumanReadableName() const override { return "internal"; }
590
591 virtual void Trace(cppgc::Visitor* visitor) const {}
592 };
593
604 template <CppHeapPointerTag tag, typename T = void>
605 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
606 const v8::Local<v8::Object>& wrapper);
607 template <CppHeapPointerTag tag, typename T = void>
608 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
609 const PersistentBase<Object>& wrapper);
610 template <CppHeapPointerTag tag, typename T = void>
611 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
612 const BasicTracedReference<Object>& wrapper);
613
614 template <typename T = void>
615 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
616 const v8::Local<v8::Object>& wrapper,
617 CppHeapPointerTagRange tag_range);
618 template <typename T = void>
619 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
620 const PersistentBase<Object>& wrapper,
621 CppHeapPointerTagRange tag_range);
622 template <typename T = void>
623 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
624 const BasicTracedReference<Object>& wrapper,
625 CppHeapPointerTagRange tag_range);
626
636 template <CppHeapPointerTag tag>
637 static V8_INLINE void Wrap(v8::Isolate* isolate,
638 const v8::Local<v8::Object>& wrapper,
639 Wrappable* wrappable);
640 template <CppHeapPointerTag tag>
641 static V8_INLINE void Wrap(v8::Isolate* isolate,
642 const PersistentBase<Object>& wrapper,
643 Wrappable* wrappable);
644 template <CppHeapPointerTag tag>
645 static V8_INLINE void Wrap(v8::Isolate* isolate,
646 const BasicTracedReference<Object>& wrapper,
647 Wrappable* wrappable);
648 static V8_INLINE void Wrap(v8::Isolate* isolate,
649 const v8::Local<v8::Object>& wrapper,
650 Wrappable* wrappable, CppHeapPointerTag tag);
651 static V8_INLINE void Wrap(v8::Isolate* isolate,
652 const PersistentBase<Object>& wrapper,
653 Wrappable* wrappable, CppHeapPointerTag tag);
654 static V8_INLINE void Wrap(v8::Isolate* isolate,
655 const BasicTracedReference<Object>& wrapper,
656 Wrappable* wrappable, CppHeapPointerTag tag);
657
658 // Version of Wrap() function for v8::Context::Global() objects.
659 // Unlike the functions above it wraps both JSGlobalProxy and its hidden
660 // prototype (JSGlobalObject or remote object).
661 static void WrapGlobal(v8::Isolate* isolate,
662 const v8::Local<v8::Object>& wrapper,
663 Wrappable* wrappable, CppHeapPointerTag tag);
664
665 // Checks that wrappables set on JSGlobalProxy and its hidden prototype are
666 // the same.
667 static bool CheckGlobalWrappable(v8::Isolate* isolate,
668 const v8::Local<v8::Object>& wrapper,
669 CppHeapPointerTagRange tag_range);
670
678 Local<Name> key);
680 uint32_t index);
695 Local<Name> key);
697 Local<Context> context, uint32_t index);
699 Local<Context> context, Local<Name> key);
700
706 Local<Context> context, Local<Name> key);
707
715 Local<Name> key);
716
723 Local<Context> context, Local<Name> key);
724
731 Local<Context> context, Local<Name> key);
732
735
738
747
756
763 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
764 MaybeLocal<Context> GetCreationContext();
765
771 Local<Context> GetCreationContextChecked(v8::Isolate* isolate);
772 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
773 Local<Context> GetCreationContextChecked();
774
776 V8_INLINE static MaybeLocal<Context> GetCreationContext(
777 v8::Isolate* isolate, const PersistentBase<Object>& object) {
778 return object.template value<Object>()->GetCreationContext(isolate);
779 }
780 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
781 V8_INLINE static MaybeLocal<Context> GetCreationContext(
782 const PersistentBase<Object>& object);
783
798 void* GetAlignedPointerFromEmbedderDataInCreationContext(v8::Isolate* isolate,
799 int index);
800 void* GetAlignedPointerFromEmbedderDataInCreationContext(int index);
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
855 "Use Isolate::GetCurrent() instead, which is guaranteed to return the "
856 "same isolate since https://crrev.com/c/6458560.")
857 Isolate* GetIsolate();
858
860 "Use Isolate::GetCurrent() instead, which is guaranteed to return the "
861 "same isolate since https://crrev.com/c/6458560.")
862 V8_INLINE static Isolate* GetIsolate(const TracedReference<Object>& handle) {
863 return handle.template value<Object>()->GetIsolate();
864 }
865
876
877 static Local<Object> New(Isolate* isolate);
878
887 static Local<Object> New(Isolate* isolate, Local<Value> prototype_or_null,
888 Local<Name>* names, Local<Value>* values,
889 size_t length);
890
891 V8_INLINE static Object* Cast(Value* obj);
892
901 bool IsCodeLike(Isolate* isolate) const;
902
903 private:
904 static void* Unwrap(v8::Isolate* isolate, internal::Address wrapper_obj,
905 CppHeapPointerTagRange tag_range);
906 static void Wrap(v8::Isolate* isolate, internal::Address wrapper_obj,
907 CppHeapPointerTag tag, void* wrappable);
908
909 Object();
910 static void CheckCast(Value* obj);
911 Local<Data> SlowGetInternalField(int index);
912 void* SlowGetAlignedPointerFromInternalField(int index);
913 void* SlowGetAlignedPointerFromInternalField(v8::Isolate* isolate, int index);
914};
915
916// --- Implementation ---
917
919#ifndef V8_ENABLE_CHECKS
920 using A = internal::Address;
921 using I = internal::Internals;
923 // Fast path: If the object is a plain JSObject, which is the common case, we
924 // know where to find the internal fields and can return the value directly.
925 int instance_type = I::GetInstanceType(obj);
926 if (I::CanHaveInternalField(instance_type)) {
927 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
928 (I::kEmbedderDataSlotSize * index);
929 A value = I::ReadRawField<A>(obj, offset);
930#ifdef V8_COMPRESS_POINTERS
931 // We read the full pointer value and then decompress it in order to avoid
932 // dealing with potential endiannes issues.
933 value = I::DecompressTaggedField(obj, static_cast<uint32_t>(value));
934#endif
935
936 auto* isolate = I::GetCurrentIsolate();
937 return Local<Data>::New(isolate, value);
938 }
939#endif
940 return SlowGetInternalField(index);
941}
942
944 int index) {
945#if !defined(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 auto instance_type = I::GetInstanceType(obj);
952 if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
953 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
954 (I::kEmbedderDataSlotSize * index) +
955 I::kEmbedderDataSlotExternalPointerOffset;
956 A value =
957 I::ReadExternalPointerField<{internal::kFirstEmbedderDataTag,
959 isolate, obj, offset);
960 return reinterpret_cast<void*>(value);
961 }
962#endif
963 return SlowGetAlignedPointerFromInternalField(isolate, index);
964}
965
967#if !defined(V8_ENABLE_CHECKS)
968 using A = internal::Address;
969 using I = internal::Internals;
971 // Fast path: If the object is a plain JSObject, which is the common case, we
972 // know where to find the internal fields and can return the value directly.
973 auto instance_type = I::GetInstanceType(obj);
974 if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
975 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
976 (I::kEmbedderDataSlotSize * index) +
977 I::kEmbedderDataSlotExternalPointerOffset;
978 Isolate* isolate = I::GetCurrentIsolateForSandbox();
979 A value =
980 I::ReadExternalPointerField<{internal::kFirstEmbedderDataTag,
982 isolate, obj, offset);
983 return reinterpret_cast<void*>(value);
984 }
985#endif
986 return SlowGetAlignedPointerFromInternalField(index);
987}
988
989// static
990template <CppHeapPointerTag tag, typename T>
992 CppHeapPointerTagRange tag_range(tag, tag);
993 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
994#if !defined(V8_ENABLE_CHECKS)
995 return internal::ReadCppHeapPointerField<T>(
996 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
997#else // defined(V8_ENABLE_CHECKS)
998 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
999#endif // defined(V8_ENABLE_CHECKS)
1000}
1001
1002// static
1003template <CppHeapPointerTag tag, typename T>
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 <CppHeapPointerTag tag, typename T>
1019 const BasicTracedReference<Object>& wrapper) {
1020 CppHeapPointerTagRange tag_range(tag, tag);
1021 auto obj =
1022 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1023#if !defined(V8_ENABLE_CHECKS)
1024 return internal::ReadCppHeapPointerField<T>(
1025 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1026#else // defined(V8_ENABLE_CHECKS)
1027 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1028#endif // defined(V8_ENABLE_CHECKS)
1029}
1030
1031// static
1032template <typename T>
1034 CppHeapPointerTagRange tag_range) {
1035 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1036#if !defined(V8_ENABLE_CHECKS)
1037 return internal::ReadCppHeapPointerField<T>(
1038 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1039#else // defined(V8_ENABLE_CHECKS)
1040 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1041#endif // defined(V8_ENABLE_CHECKS)
1042}
1043
1044// static
1045template <typename T>
1047 CppHeapPointerTagRange tag_range) {
1048 auto obj =
1049 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1050#if !defined(V8_ENABLE_CHECKS)
1051 return internal::ReadCppHeapPointerField<T>(
1052 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1053#else // defined(V8_ENABLE_CHECKS)
1054
1055 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1056#endif // defined(V8_ENABLE_CHECKS)
1057}
1058
1059// static
1060template <typename T>
1062 const BasicTracedReference<Object>& wrapper,
1063 CppHeapPointerTagRange tag_range) {
1064 auto obj =
1065 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1066#if !defined(V8_ENABLE_CHECKS)
1067 return internal::ReadCppHeapPointerField<T>(
1068 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1069#else // defined(V8_ENABLE_CHECKS)
1070 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1071#endif // defined(V8_ENABLE_CHECKS)
1072}
1073
1074// static
1075template <CppHeapPointerTag tag>
1076void Object::Wrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1077 v8::Object::Wrappable* wrappable) {
1078 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1079 Wrap(isolate, obj, tag, wrappable);
1080}
1081
1082// static
1083template <CppHeapPointerTag tag>
1085 v8::Object::Wrappable* wrappable) {
1086 auto obj =
1087 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1088 Wrap(isolate, obj, tag, wrappable);
1089}
1090
1091// static
1092template <CppHeapPointerTag tag>
1094 const BasicTracedReference<Object>& wrapper,
1095 v8::Object::Wrappable* wrappable) {
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, const v8::Local<v8::Object>& wrapper,
1103 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1104 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1105 Wrap(isolate, obj, tag, wrappable);
1106}
1107
1108// static
1110 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1111 auto obj =
1112 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1113 Wrap(isolate, obj, tag, wrappable);
1114}
1115
1116// static
1118 const BasicTracedReference<Object>& wrapper,
1119 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1120 auto obj =
1121 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1122 Wrap(isolate, obj, tag, wrappable);
1123}
1124
1126#ifdef V8_ENABLE_CHECKS
1127 CheckCast(data);
1128#endif
1129 return reinterpret_cast<Private*>(data);
1130}
1131
1133#ifdef V8_ENABLE_CHECKS
1134 CheckCast(value);
1135#endif
1136 return static_cast<Object*>(value);
1137}
1138
1139} // namespace v8
1140
1141#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-template.h:583
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:583
const char * GetHumanReadableName() const override
Definition: v8-object.h:589
virtual const WrapperTypeInfo * GetWrapperTypeInfo() const
Definition: v8-object.h:585
virtual void Trace(cppgc::Visitor *visitor) const
Definition: v8-object.h:591
Definition: v8-object.h:243
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:1132
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)
Local< Object > Clone()
Maybe< bool > DefineOwnProperty(Local< Context > context, Local< Name > key, Local< Value > value, PropertyAttribute attributes=None)
void * GetAlignedPointerFromInternalField(int index)
Definition: v8-object.h:966
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)
MaybeLocal< Value > GetRealNamedPropertyInPrototypeChain(Local< Context > context, Local< Name > key)
static int InternalFieldCount(const BasicTracedReference< Object > &object)
Definition: v8-object.h:509
Maybe< bool > Has(Local< Context > context, Local< Value > key)
MaybeLocal< Array > GetOwnPropertyNames(Local< Context > context)
bool IsCodeLike(Isolate *isolate) const
Maybe< bool > Set(Local< Context > context, Local< Value > key, Local< Value > value)
static void * GetAlignedPointerFromInternalField(const PersistentBase< Object > &object, int index)
Definition: v8-object.h:539
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)
Maybe< bool > HasRealIndexedProperty(Local< Context > context, uint32_t index)
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)
static void Wrap(v8::Isolate *isolate, const v8::Local< v8::Object > &wrapper, Wrappable *wrappable)
Definition: v8-object.h:1076
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)
MaybeLocal< Array > GetPropertyNames(Local< Context > context, KeyCollectionMode mode, PropertyFilter property_filter, IndexFilter index_filter, KeyConversionMode key_conversion=KeyConversionMode::kKeepNumbers)
Local< Data > GetInternalField(int index)
Definition: v8-object.h:918
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)
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:991
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)
Maybe< bool > DeletePrivate(Local< Context > context, Local< Private > key)
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)
static void * GetAlignedPointerFromInternalField(const BasicTracedReference< Object > &object, int index)
Definition: v8-object.h:546
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:41
static Private * Cast(Data *data)
Definition: v8-object.h:1125
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:101
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:137
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-primitive.h:124
Definition: v8-traced-handle.h:165
Definition: v8-initialization.h:61
Definition: v8-value.h:32
Definition: v8-internal.h:883
static const int kJSObjectHeaderSize
Definition: v8-internal.h:900
static Address ValueAsAddress(const T *value)
Definition: v8-internal.h:1757
@ kFirstEmbedderDataTag
Definition: v8-internal.h:580
@ kLastEmbedderDataTag
Definition: v8-internal.h:581
uintptr_t Address
Definition: v8-internal.h:52
Definition: libplatform.h:15
IntegrityLevel
Definition: v8-object.h:238
PropertyAttribute
Definition: v8-object.h:149
@ DontEnum
Definition: v8-object.h:155
@ None
Definition: v8-object.h:151
@ DontDelete
Definition: v8-object.h:157
@ ReadOnly
Definition: v8-object.h:153
KeyCollectionMode
Definition: v8-object.h:221
void(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) AccessorNameGetterCallback
Definition: v8-object.h:166
SideEffectType
Definition: v8-object.h:208
AccessControl
Definition: v8-object.h:182
@ DEFAULT
Definition: v8-object.h:183
IndexFilter
Definition: v8-object.h:227
KeyConversionMode
Definition: v8-object.h:233
CppHeapPointerTag
Definition: v8-sandbox.h:28
uint16_t EmbedderDataTypeTag
Definition: v8-object.h:34
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) AccessorNameSetterCallback
Definition: v8-object.h:170
PropertyFilter
Definition: v8-object.h:189
@ ONLY_CONFIGURABLE
Definition: v8-object.h:193
@ SKIP_SYMBOLS
Definition: v8-object.h:195
@ ONLY_WRITABLE
Definition: v8-object.h:191
@ ALL_PROPERTIES
Definition: v8-object.h:190
@ SKIP_STRINGS
Definition: v8-object.h:194
@ ONLY_ENUMERABLE
Definition: v8-object.h:192
Definition: v8-sandbox.h:70
Definition: v8-object.h:573
const int16_t type_id
Definition: v8-object.h:574
#define V8_EXPORT
Definition: v8config.h:860
#define V8_INLINE
Definition: v8config.h:513
#define V8_DEPRECATE_SOON(message)
Definition: v8config.h:627
#define V8_DEPRECATED(message)
Definition: v8config.h:619
#define V8_LIKELY(condition)
Definition: v8config.h:674
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:684
#define V8_ENUM_DEPRECATE_SOON(message)
Definition: v8config.h:664