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,
204// TODO(https://crbug.com/348660658): deprecate and remove.
206 V8_DEPRECATED("Use AccessorNameSetterCallbackV2 instead.") =
207 void (*)(Local<Name> property, Local<Value> value,
208 const PropertyCallbackInfo<void>& info);
209
219 SKIP_SYMBOLS = 16
221
232enum class SideEffectType {
236};
237
246
252
258
263
267class V8_EXPORT Object : public Value {
268 public:
274 Local<Value> key, Local<Value> value);
276 Local<Value> key, Local<Value> value,
277 MaybeLocal<Object> receiver);
278
280 Local<Value> value);
281
293 Local<Name> key,
294 Local<Value> value);
296 uint32_t index,
297 Local<Value> value);
298
309 Local<Context> context, Local<Name> key, Local<Value> value,
310 PropertyAttribute attributes = None);
311
329 Local<Context> context, Local<Name> key, PropertyDescriptor& descriptor);
330
332 Local<Value> key);
334 Local<Value> key,
335 MaybeLocal<Object> receiver);
336
338 uint32_t index);
339
355 Local<Context> context, Local<Name> key);
356
367 Local<Context> context, Local<Value> key);
377 Local<Context> context, Local<Value> key,
378 PropertyAttribute* out_attributes);
379
385 Local<Context> context, Local<Name> key);
386
403 Local<Value> key);
404
406 Local<Value> key);
407
409
411 uint32_t index);
412
419 PropertyAttribute attributes = None);
420
426 Local<Context> context, Local<Name> name,
428 AccessorNameSetterCallbackV2 setter = nullptr,
429 Local<Data> data = Local<Data>(), PropertyAttribute attributes = None,
430 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
431 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
432
442 Local<Context> context, Local<Name> name,
444 PropertyAttribute attributes = None,
445 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
446 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
447
456 Local<Value> value);
459
467 Local<Context> context);
469 Local<Context> context, KeyCollectionMode mode,
470 PropertyFilter property_filter, IndexFilter index_filter,
471 KeyConversionMode key_conversion = KeyConversionMode::kKeepNumbers);
472
479 Local<Context> context);
480
488 Local<Context> context, PropertyFilter filter,
489 KeyConversionMode key_conversion = KeyConversionMode::kKeepNumbers);
490
496
502 Local<Value> prototype);
503
509
516 Local<Context> context);
517
522
527
530
533 const PersistentBase<Object>& object) {
534 return object.template value<Object>()->InternalFieldCount();
535 }
536
539 const BasicTracedReference<Object>& object) {
540 return object.template value<Object>()->InternalFieldCount();
541 }
542
553 V8_INLINE Local<Data> GetInternalField(int index);
554
556 void SetInternalField(int index, Local<Data> data);
557
563 V8_INLINE void* GetAlignedPointerFromInternalField(int index,
565 V8_INLINE void* GetAlignedPointerFromInternalField(v8::Isolate* isolate,
566 int index,
568
571 const PersistentBase<Object>& object, int index,
573 return object.template value<Object>()->GetAlignedPointerFromInternalField(
574 index, tag);
575 }
576
579 const BasicTracedReference<Object>& object, int index,
581 return object.template value<Object>()->GetAlignedPointerFromInternalField(
582 index, tag);
583 }
584
590 void SetAlignedPointerInInternalField(int index, void* value,
592
593 // Type information for a Wrappable object that got wrapped with
594 // `v8::Object::Wrap()`.
596 const int16_t type_id;
597 };
598
599 // v8::Object::Wrappable serves as the base class for all C++ objects that can
600 // be wrapped by a JavaScript object using `v8::Object::Wrap()`.
601 //
602 // Note that v8::Object::Wrappable` inherits from `NameProvider` and provides
603 // `GetWrapperTypeInfo` to allow subclasses to have smaller object sizes.
604 class Wrappable : public cppgc::GarbageCollected<Wrappable>,
605 public cppgc::NameProvider {
606 public:
607 virtual const WrapperTypeInfo* GetWrapperTypeInfo() const {
608 return nullptr;
609 }
610
611 const char* GetHumanReadableName() const override { return "internal"; }
612
613 virtual void Trace(cppgc::Visitor* visitor) const {}
614 };
615
626 template <CppHeapPointerTag tag, typename T = void>
627 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
628 const v8::Local<v8::Object>& wrapper);
629 template <CppHeapPointerTag tag, typename T = void>
630 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
631 const PersistentBase<Object>& wrapper);
632 template <CppHeapPointerTag tag, typename T = void>
633 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
634 const BasicTracedReference<Object>& wrapper);
635
636 template <typename T = void>
637 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
638 const v8::Local<v8::Object>& wrapper,
639 CppHeapPointerTagRange tag_range);
640 template <typename T = void>
641 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
642 const PersistentBase<Object>& wrapper,
643 CppHeapPointerTagRange tag_range);
644 template <typename T = void>
645 static V8_INLINE T* Unwrap(v8::Isolate* isolate,
646 const BasicTracedReference<Object>& wrapper,
647 CppHeapPointerTagRange tag_range);
648
658 template <CppHeapPointerTag tag>
659 static V8_INLINE void Wrap(v8::Isolate* isolate,
660 const v8::Local<v8::Object>& wrapper,
661 Wrappable* wrappable);
662 template <CppHeapPointerTag tag>
663 static V8_INLINE void Wrap(v8::Isolate* isolate,
664 const PersistentBase<Object>& wrapper,
665 Wrappable* wrappable);
666 template <CppHeapPointerTag tag>
667 static V8_INLINE void Wrap(v8::Isolate* isolate,
668 const BasicTracedReference<Object>& wrapper,
669 Wrappable* wrappable);
670 static V8_INLINE void Wrap(v8::Isolate* isolate,
671 const v8::Local<v8::Object>& wrapper,
672 Wrappable* wrappable, CppHeapPointerTag tag);
673 static V8_INLINE void Wrap(v8::Isolate* isolate,
674 const PersistentBase<Object>& wrapper,
675 Wrappable* wrappable, CppHeapPointerTag tag);
676 static V8_INLINE void Wrap(v8::Isolate* isolate,
677 const BasicTracedReference<Object>& wrapper,
678 Wrappable* wrappable, CppHeapPointerTag tag);
679
680 // Version of Wrap() function for v8::Context::Global() objects.
681 // Unlike the functions above it wraps both JSGlobalProxy and its hidden
682 // prototype (JSGlobalObject or remote object).
683 static void WrapGlobal(v8::Isolate* isolate,
684 const v8::Local<v8::Object>& wrapper,
685 Wrappable* wrappable, CppHeapPointerTag tag);
686
687 // Checks that wrappables set on JSGlobalProxy and its hidden prototype are
688 // the same.
689 static bool CheckGlobalWrappable(v8::Isolate* isolate,
690 const v8::Local<v8::Object>& wrapper,
691 CppHeapPointerTagRange tag_range);
692
700 Local<Name> key);
702 uint32_t index);
717 Local<Name> key);
719 Local<Context> context, uint32_t index);
721 Local<Context> context, Local<Name> key);
722
728 Local<Context> context, Local<Name> key);
729
737 Local<Name> key);
738
745 Local<Context> context, Local<Name> key);
746
753 Local<Context> context, Local<Name> key);
754
757
760
769
778
785 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
786 MaybeLocal<Context> GetCreationContext();
787
793 Local<Context> GetCreationContextChecked(v8::Isolate* isolate);
794 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
795 Local<Context> GetCreationContextChecked();
796
798 V8_INLINE static MaybeLocal<Context> GetCreationContext(
799 v8::Isolate* isolate, const PersistentBase<Object>& object) {
800 return object.template value<Object>()->GetCreationContext(isolate);
801 }
802 V8_DEPRECATE_SOON("Use the version with the isolate argument.")
803 V8_INLINE static MaybeLocal<Context> GetCreationContext(
804 const PersistentBase<Object>& object);
805
825 void* GetAlignedPointerFromEmbedderDataInCreationContext(
826 v8::Isolate* isolate, int index, EmbedderDataTypeTag tag);
827 void* GetAlignedPointerFromEmbedderDataInCreationContext(
828 int index, EmbedderDataTypeTag tag);
829
830 void* GetAlignedPointerFromEmbedderDataInCreationContext(
831 v8::Isolate* isolate, int index, CppHeapPointerTag tag);
837 bool IsCallable() const;
838
842 bool IsConstructor() const;
843
855 bool IsApiWrapper() const;
856
862 bool IsUndetectable() const;
863
869 Local<Value> recv,
870 int argc,
871 Local<Value> argv[]);
872
879 Local<Context> context, int argc, Local<Value> argv[]);
880
890 MaybeLocal<Array> PreviewEntries(bool* is_key_value);
891
892 static Local<Object> New(Isolate* isolate);
893
902 static Local<Object> New(Isolate* isolate, Local<Value> prototype_or_null,
903 Local<Name>* names, Local<Value>* values,
904 size_t length);
905
906 V8_INLINE static Object* Cast(Value* obj);
907
916 bool IsCodeLike(Isolate* isolate) const;
917
918 private:
919 static void* Unwrap(v8::Isolate* isolate, internal::Address wrapper_obj,
920 CppHeapPointerTagRange tag_range);
921 static void Wrap(v8::Isolate* isolate, internal::Address wrapper_obj,
922 CppHeapPointerTag tag, void* wrappable);
923
924 Object();
925 static void CheckCast(Value* obj);
926 Local<Data> SlowGetInternalField(int index);
927 void* SlowGetAlignedPointerFromInternalField(int index,
929 void* SlowGetAlignedPointerFromInternalField(v8::Isolate* isolate, int index,
931};
932
933// --- Implementation ---
934
935Local<Data> Object::GetInternalField(int index) {
936#ifndef V8_ENABLE_CHECKS
937 using A = internal::Address;
938 using I = internal::Internals;
939 A obj = internal::ValueHelper::ValueAsAddress(this);
940 // Fast path: If the object is a plain JSObject, which is the common case, we
941 // know where to find the internal fields and can return the value directly.
942 int instance_type = I::GetInstanceType(obj);
943 if (I::CanHaveInternalField(instance_type)) {
944 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
945 (I::kEmbedderDataSlotSize * index);
946#ifdef V8_COMPRESS_POINTERS
947 // The tagged payload lives in the low kTaggedSize half of the slot (at
948 // kTaggedPayloadOffset == 0). Read it as a 32-bit field so the correct half
949 // is picked on both little and big endian targets. A full width read plus
950 // truncation would return the CppHeap pointer half on big endian.
951 uint32_t compressed = I::ReadRawField<uint32_t>(obj, offset);
952 A value = I::DecompressTaggedField(obj, compressed);
953#else
954 A value = I::ReadRawField<A>(obj, offset);
955#endif
956
957 auto* isolate = I::GetCurrentIsolate();
958 return Local<Data>::New(isolate, value);
959 }
960#endif
961 return SlowGetInternalField(index);
962}
963
964void* Object::GetAlignedPointerFromInternalField(v8::Isolate* isolate,
965 int index,
967 return SlowGetAlignedPointerFromInternalField(isolate, index, tag);
968}
969
970void* Object::GetAlignedPointerFromInternalField(int index,
972 return SlowGetAlignedPointerFromInternalField(index, tag);
973}
974
975// static
976template <CppHeapPointerTag tag, typename T>
977T* Object::Unwrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper) {
978 CppHeapPointerTagRange tag_range(tag, tag);
979 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
980#if !defined(V8_ENABLE_CHECKS)
981 return internal::ReadCppHeapPointerField<T>(
982 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
983#else // defined(V8_ENABLE_CHECKS)
984 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
985#endif // defined(V8_ENABLE_CHECKS)
986}
987
988// static
989template <CppHeapPointerTag tag, typename T>
990T* Object::Unwrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper) {
991 CppHeapPointerTagRange tag_range(tag, tag);
992 auto obj =
993 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
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>
1004T* Object::Unwrap(v8::Isolate* isolate,
1005 const BasicTracedReference<Object>& wrapper) {
1006 CppHeapPointerTagRange tag_range(tag, tag);
1007 auto obj =
1008 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1009#if !defined(V8_ENABLE_CHECKS)
1010 return internal::ReadCppHeapPointerField<T>(
1011 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1012#else // defined(V8_ENABLE_CHECKS)
1013 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1014#endif // defined(V8_ENABLE_CHECKS)
1015}
1016
1017// static
1018template <typename T>
1019T* Object::Unwrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1020 CppHeapPointerTagRange tag_range) {
1021 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1022#if !defined(V8_ENABLE_CHECKS)
1023 return internal::ReadCppHeapPointerField<T>(
1024 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1025#else // defined(V8_ENABLE_CHECKS)
1026 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1027#endif // defined(V8_ENABLE_CHECKS)
1028}
1029
1030// static
1031template <typename T>
1032T* Object::Unwrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper,
1033 CppHeapPointerTagRange tag_range) {
1034 auto obj =
1035 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
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
1041 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1042#endif // defined(V8_ENABLE_CHECKS)
1043}
1044
1045// static
1046template <typename T>
1047T* Object::Unwrap(v8::Isolate* isolate,
1048 const BasicTracedReference<Object>& wrapper,
1049 CppHeapPointerTagRange tag_range) {
1050 auto obj =
1051 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1052#if !defined(V8_ENABLE_CHECKS)
1053 return internal::ReadCppHeapPointerField<T>(
1054 isolate, obj, internal::Internals::kJSObjectHeaderSize, tag_range);
1055#else // defined(V8_ENABLE_CHECKS)
1056 return reinterpret_cast<T*>(Unwrap(isolate, obj, tag_range));
1057#endif // defined(V8_ENABLE_CHECKS)
1058}
1059
1060// static
1061template <CppHeapPointerTag tag>
1062void Object::Wrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1063 v8::Object::Wrappable* wrappable) {
1064 static_assert(kObjectWrappableTagRange.Contains(tag),
1065 "CppHeapPointerTag must be within kObjectWrappableTagRange");
1066 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1067 Wrap(isolate, obj, tag, wrappable);
1068}
1069
1070// static
1071template <CppHeapPointerTag tag>
1072void Object::Wrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper,
1073 v8::Object::Wrappable* wrappable) {
1074 static_assert(kObjectWrappableTagRange.Contains(tag),
1075 "CppHeapPointerTag must be within kObjectWrappableTagRange");
1076 auto obj =
1077 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1078 Wrap(isolate, obj, tag, wrappable);
1079}
1080
1081// static
1082template <CppHeapPointerTag tag>
1083void Object::Wrap(v8::Isolate* isolate,
1084 const BasicTracedReference<Object>& wrapper,
1085 v8::Object::Wrappable* wrappable) {
1086 static_assert(kObjectWrappableTagRange.Contains(tag),
1087 "CppHeapPointerTag must be within kObjectWrappableTagRange");
1088 auto obj =
1089 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1090 Wrap(isolate, obj, tag, wrappable);
1091}
1092
1093// static
1094void Object::Wrap(v8::Isolate* isolate, const v8::Local<v8::Object>& wrapper,
1095 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1096 auto obj = internal::ValueHelper::ValueAsAddress(*wrapper);
1097 Wrap(isolate, obj, tag, wrappable);
1098}
1099
1100// static
1101void Object::Wrap(v8::Isolate* isolate, const PersistentBase<Object>& wrapper,
1102 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1103 auto obj =
1104 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1105 Wrap(isolate, obj, tag, wrappable);
1106}
1107
1108// static
1109void Object::Wrap(v8::Isolate* isolate,
1110 const BasicTracedReference<Object>& wrapper,
1111 v8::Object::Wrappable* wrappable, CppHeapPointerTag tag) {
1112 auto obj =
1113 internal::ValueHelper::ValueAsAddress(wrapper.template value<Object>());
1114 Wrap(isolate, obj, tag, wrappable);
1115}
1116
1117Private* Private::Cast(Data* data) {
1118#ifdef V8_ENABLE_CHECKS
1119 CheckCast(data);
1120#endif
1121 return reinterpret_cast<Private*>(data);
1122}
1123
1124Object* Object::Cast(v8::Value* value) {
1125#ifdef V8_ENABLE_CHECKS
1126 CheckCast(value);
1127#endif
1128 return static_cast<Object*>(value);
1129}
1130
1131} // namespace v8
1132
1133#endif // INCLUDE_V8_OBJECT_H_
Definition: garbage-collected.h:53
Definition: name-provider.h:26
Definition: visitor.h:78
Definition: v8-container.h:25
Definition: v8-traced-handle.h:125
Definition: v8-context.h:55
Definition: v8-data.h:18
Definition: v8-isolate.h:305
Definition: v8-local-handle.h:359
Definition: v8-local-handle.h:730
Definition: v8-maybe.h:39
Definition: v8-primitive.h:81
Definition: v8-object.h:605
const char * GetHumanReadableName() const override
Definition: v8-object.h:611
virtual const WrapperTypeInfo * GetWrapperTypeInfo() const
Definition: v8-object.h:607
virtual void Trace(cppgc::Visitor *visitor) const
Definition: v8-object.h:613
Definition: v8-object.h:267
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)
MaybeLocal< Value > TryGetWithNoSideEffects(Local< Context > context, Local< Name > 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:570
static int InternalFieldCount(const PersistentBase< Object > &object)
Definition: v8-object.h:532
MaybeLocal< Value > GetRealNamedPropertyInPrototypeChain(Local< Context > context, Local< Name > key)
static int InternalFieldCount(const BasicTracedReference< Object > &object)
Definition: v8-object.h:538
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:578
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)
Maybe< bool > GetPropertyAttributes(Local< Context > context, Local< Value > key, PropertyAttribute *out_attributes)
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)
Maybe< bool > SetNativeDataProperty(Local< Context > context, Local< Name > name, AccessorNameGetterCallback getter, AccessorNameSetterCallbackV2 setter=nullptr, Local< Data > data=Local< Data >(), PropertyAttribute attributes=None, SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect, SideEffectType setter_side_effect_type=SideEffectType::kHasSideEffect)
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:234
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:979
ExternalPointerTag
Definition: v8-internal.h:692
uintptr_t Address
Definition: v8-internal.h:38
Definition: libplatform.h:15
IntegrityLevel
Definition: v8-object.h:262
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:245
void(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) AccessorNameGetterCallback
Definition: v8-object.h:180
SideEffectType
Definition: v8-object.h:232
IndexFilter
Definition: v8-object.h:251
KeyConversionMode
Definition: v8-object.h:257
CppHeapPointerTag
Definition: v8-sandbox.h:28
constexpr EmbedderDataTypeTag kEmbedderDataTypeTagDefault
Definition: v8-object.h:36
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< Boolean > &info) AccessorNameSetterCallbackV2
Definition: v8-object.h:203
uint16_t EmbedderDataTypeTag
Definition: v8-object.h:34
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) AccessorNameSetterCallback
Definition: v8-object.h:208
constexpr CppHeapPointerTagRange kObjectWrappableTagRange(CppHeapPointerTag::kFirstObjectWrappableTag, CppHeapPointerTag::kLastObjectWrappableTag)
PropertyFilter
Definition: v8-object.h:213
@ ONLY_CONFIGURABLE
Definition: v8-object.h:217
@ SKIP_SYMBOLS
Definition: v8-object.h:219
@ ONLY_WRITABLE
Definition: v8-object.h:215
@ ALL_PROPERTIES
Definition: v8-object.h:214
@ SKIP_STRINGS
Definition: v8-object.h:218
@ ONLY_ENUMERABLE
Definition: v8-object.h:216
Definition: v8-object.h:595
const int16_t type_id
Definition: v8-object.h:596
Definition: v8-internal.h:536
constexpr bool Contains(Tag tag) const
Definition: v8-internal.h:571
#define V8_EXPORT
Definition: v8config.h:874
#define V8_INLINE
Definition: v8config.h:518
#define V8_DEPRECATE_SOON(message)
Definition: v8config.h:631
#define V8_DEPRECATED(message)
Definition: v8config.h:623
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:688