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
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);
898 void* SlowGetAlignedPointerFromInternalField(v8::Isolate* isolate, int index);
899};
900
901// --- Implementation ---
902
903Local<Data> Object::GetInternalField(int index) {
904#ifndef V8_ENABLE_CHECKS
905 using A = internal::Address;
906 using I = internal::Internals;
907 A obj = internal::ValueHelper::ValueAsAddress(this);
908 // Fast path: If the object is a plain JSObject, which is the common case, we
909 // know where to find the internal fields and can return the value directly.
910 int instance_type = I::GetInstanceType(obj);
911 if (I::CanHaveInternalField(instance_type)) {
912 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
913 (I::kEmbedderDataSlotSize * index);
914 A value = I::ReadRawField<A>(obj, offset);
915#ifdef V8_COMPRESS_POINTERS
916 // We read the full pointer value and then decompress it in order to avoid
917 // dealing with potential endiannes issues.
918 value = I::DecompressTaggedField(obj, static_cast<uint32_t>(value));
919#endif
920
921 auto* isolate = I::GetCurrentIsolate();
922 return Local<Data>::New(isolate, value);
923 }
924#endif
925 return SlowGetInternalField(index);
926}
927
928void* Object::GetAlignedPointerFromInternalField(v8::Isolate* isolate,
929 int index) {
930#if !defined(V8_ENABLE_CHECKS)
931 using A = internal::Address;
932 using I = internal::Internals;
933 A obj = internal::ValueHelper::ValueAsAddress(this);
934 // Fast path: If the object is a plain JSObject, which is the common case, we
935 // know where to find the internal fields and can return the value directly.
936 auto instance_type = I::GetInstanceType(obj);
937 if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
938 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
939 (I::kEmbedderDataSlotSize * index) +
940 I::kEmbedderDataSlotExternalPointerOffset;
941 A value =
942 I::ReadExternalPointerField<{internal::kFirstEmbedderDataTag,
943 internal::kLastEmbedderDataTag}>(
944 isolate, obj, offset);
945 return reinterpret_cast<void*>(value);
946 }
947#endif
948 return SlowGetAlignedPointerFromInternalField(isolate, index);
949}
950
951void* Object::GetAlignedPointerFromInternalField(int index) {
952#if !defined(V8_ENABLE_CHECKS)
953 using A = internal::Address;
954 using I = internal::Internals;
955 A obj = internal::ValueHelper::ValueAsAddress(this);
956 // Fast path: If the object is a plain JSObject, which is the common case, we
957 // know where to find the internal fields and can return the value directly.
958 auto instance_type = I::GetInstanceType(obj);
959 if (V8_LIKELY(I::CanHaveInternalField(instance_type))) {
960 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
961 (I::kEmbedderDataSlotSize * index) +
962 I::kEmbedderDataSlotExternalPointerOffset;
963 Isolate* isolate = I::GetCurrentIsolateForSandbox();
964 A value =
965 I::ReadExternalPointerField<{internal::kFirstEmbedderDataTag,
966 internal::kLastEmbedderDataTag}>(
967 isolate, obj, offset);
968 return reinterpret_cast<void*>(value);
969 }
970#endif
971 return SlowGetAlignedPointerFromInternalField(index);
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-template.h:583
Definition: v8-isolate.h:290
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: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)
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)
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)
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)
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)
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)
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)
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)
bool HasIndexedLookupInterceptor() const
Definition: v8-persistent-handle.h:93
Definition: v8-object.h:41
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-initialization.h:61
Definition: v8-value.h:32
Definition: v8-internal.h:883
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