5#ifndef INCLUDE_V8_OBJECT_H_
6#define INCLUDE_V8_OBJECT_H_
22class FunctionTemplate;
24class PropertyCallbackInfo;
60 static void CheckCast(
Data* that);
133 PrivateData* private_;
171 "This enum is no longer used and will be removed in V8 12.9.")
364 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
365 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
379 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
380 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
431 "V8 will stop providing access to hidden prototype (i.e. "
432 "JSGlobalObject). Use GetPrototypeV2() instead. "
433 "See http://crbug.com/333672197.")
450 "
V8 will stop providing access to hidden prototype (i.e. "
451 "JSGlobalObject). Use SetPrototypeV2() instead. "
490 int InternalFieldCount() const;
495 return object.template value<Object>()->InternalFieldCount();
501 return object.template value<Object>()->InternalFieldCount();
524 V8_INLINE void* GetAlignedPointerFromInternalField(
int index);
531 return object.template value<Object>()->GetAlignedPointerFromInternalField(
538 return object.template value<Object>()->GetAlignedPointerFromInternalField(
561 template <CppHeapPo
interTag tag,
typename T =
void>
564 template <CppHeapPo
interTag tag,
typename T =
void>
567 template <CppHeapPo
interTag tag,
typename T =
void>
571 template <
typename T =
void>
575 template <
typename T =
void>
579 template <
typename T =
void>
593 template <CppHeapPo
interTag tag>
597 template <CppHeapPo
interTag tag>
601 template <CppHeapPo
interTag tag>
720 return object.template value<Object>()->GetCreationContext();
796 return handle.template value<Object>()->GetIsolate();
843 static void CheckCast(
Value* obj);
845 void* SlowGetAlignedPointerFromInternalField(
int index);
846 void* SlowGetAlignedPointerFromInternalField(
v8::Isolate* isolate,
int index);
852#ifndef V8_ENABLE_CHECKS
858 int instance_type = I::GetInstanceType(obj);
859 if (I::CanHaveInternalField(instance_type)) {
860 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
861 (I::kEmbedderDataSlotSize * index);
862 A value = I::ReadRawField<A>(obj, offset);
863#ifdef V8_COMPRESS_POINTERS
866 value = I::DecompressTaggedField(obj,
static_cast<uint32_t
>(value));
874 return SlowGetInternalField(index);
879#if !defined(V8_ENABLE_CHECKS)
885 auto instance_type = I::GetInstanceType(obj);
886 if (
V8_LIKELY(I::CanHaveInternalField(instance_type))) {
887 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
888 (I::kEmbedderDataSlotSize * index) +
889 I::kEmbedderDataSlotExternalPointerOffset;
891 I::ReadExternalPointerField<internal::kEmbedderDataSlotPayloadTag>(
892 isolate, obj, offset);
893 return reinterpret_cast<void*
>(value);
896 return SlowGetAlignedPointerFromInternalField(isolate, index);
900#if !defined(V8_ENABLE_CHECKS)
906 auto instance_type = I::GetInstanceType(obj);
907 if (
V8_LIKELY(I::CanHaveInternalField(instance_type))) {
908 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
909 (I::kEmbedderDataSlotSize * index) +
910 I::kEmbedderDataSlotExternalPointerOffset;
911 Isolate* isolate = I::GetIsolateForSandbox(obj);
913 I::ReadExternalPointerField<internal::kEmbedderDataSlotPayloadTag>(
914 isolate, obj, offset);
915 return reinterpret_cast<void*
>(value);
918 return SlowGetAlignedPointerFromInternalField(index);
922template <CppHeapPo
interTag tag,
typename T>
926#if !defined(V8_ENABLE_CHECKS)
927 return internal::ReadCppHeapPointerField<T>(
930 return reinterpret_cast<T*
>(
Unwrap(isolate, obj, tag_range));
935template <CppHeapPo
interTag tag,
typename T>
940#if !defined(V8_ENABLE_CHECKS)
941 return internal::ReadCppHeapPointerField<T>(
944 return reinterpret_cast<T*
>(
Unwrap(isolate, obj, tag_range));
949template <CppHeapPo
interTag tag,
typename T>
955#if !defined(V8_ENABLE_CHECKS)
956 return internal::ReadCppHeapPointerField<T>(
959 return reinterpret_cast<T*
>(
Unwrap(isolate, obj, tag_range));
968#if !defined(V8_ENABLE_CHECKS)
969 return internal::ReadCppHeapPointerField<T>(
972 return reinterpret_cast<T*
>(
Unwrap(isolate, obj, tag_range));
982#if !defined(V8_ENABLE_CHECKS)
983 return internal::ReadCppHeapPointerField<T>(
987 return reinterpret_cast<T*
>(
Unwrap(isolate, obj, tag_range));
998#if !defined(V8_ENABLE_CHECKS)
999 return internal::ReadCppHeapPointerField<T>(
1002 return reinterpret_cast<T*
>(
Unwrap(isolate, obj, tag_range));
1007template <CppHeapPo
interTag tag>
1011 Wrap(isolate, obj, tag, wrappable);
1015template <CppHeapPo
interTag tag>
1020 Wrap(isolate, obj, tag, wrappable);
1024template <CppHeapPo
interTag tag>
1030 Wrap(isolate, obj, tag, wrappable);
1037 Wrap(isolate, obj, tag, wrappable);
1045 Wrap(isolate, obj, tag, wrappable);
1054 Wrap(isolate, obj, tag, wrappable);
1058#ifdef V8_ENABLE_CHECKS
1061 return reinterpret_cast<Private*
>(data);
1065#ifdef V8_ENABLE_CHECKS
1068 return static_cast<Object*
>(value);
Definition: v8-traced-handle.h:125
Definition: v8-context.h:48
Definition: v8-template.h:570
Definition: v8-isolate.h:211
Definition: v8-local-handle.h:256
static Local< T > New(Isolate *isolate, Local< T > that)
Definition: v8-local-handle.h:336
Definition: v8-local-handle.h:614
Definition: v8-maybe.h:32
Definition: v8-object.h:233
Maybe< PropertyAttribute > GetRealNamedPropertyAttributesInPrototypeChain(Local< Context > context, Local< Name > key)
Maybe< PropertyAttribute > GetPropertyAttributes(Local< Context > context, Local< Value > key)
void SetAlignedPointerInInternalField(int index, void *value)
Maybe< bool > CreateDataProperty(Local< Context > context, uint32_t index, Local< Value > value)
Local< Context > GetCreationContextChecked(v8::Isolate *isolate)
MaybeLocal< Value > GetOwnPropertyDescriptor(Local< Context > context, Local< Name > key)
static void Wrap(v8::Isolate *isolate, const v8::Local< v8::Object > &wrapper, void *wrappable)
Definition: v8-object.h:1008
static Object * Cast(Value *obj)
Definition: v8-object.h:1064
bool HasNamedLookupInterceptor() const
Maybe< bool > SetPrivate(Local< Context > context, Local< Private > key, Local< Value > value)
Maybe< bool > HasRealNamedProperty(Local< Context > context, Local< Name > key)
MaybeLocal< Array > GetPropertyNames(Local< Context > context)
Maybe< bool > Delete(Local< Context > context, uint32_t index)
MaybeLocal< Value > GetRealNamedProperty(Local< Context > context, Local< Name > key)
Maybe< bool > DefineProperty(Local< Context > context, Local< Name > key, PropertyDescriptor &descriptor)
Maybe< bool > Delete(Local< Context > context, Local< Value > key)
bool IsConstructor() const
bool IsUndetectable() const
MaybeLocal< Value > CallAsFunction(Local< Context > context, Local< Value > recv, int argc, Local< Value > argv[])
Maybe< bool > DefineOwnProperty(Local< Context > context, Local< Name > key, Local< Value > value, PropertyAttribute attributes=None)
void * GetAlignedPointerFromInternalField(int index)
Definition: v8-object.h:899
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)
void * GetAlignedPointerFromEmbedderDataInCreationContext(v8::Isolate *isolate, int index)
void * GetAlignedPointerFromEmbedderDataInCreationContext(int index)
MaybeLocal< Value > GetRealNamedPropertyInPrototypeChain(Local< Context > context, Local< Name > key)
static int InternalFieldCount(const BasicTracedReference< Object > &object)
Definition: v8-object.h:499
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)
MaybeLocal< Value > CallAsConstructor(Local< Context > context, int argc, Local< Value > argv[])
static void * GetAlignedPointerFromInternalField(const PersistentBase< Object > &object, int index)
Definition: v8-object.h:529
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)
bool IsApiWrapper() const
MaybeLocal< Value > Get(Local< Context > context, uint32_t index)
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:851
Maybe< PropertyAttribute > GetRealNamedPropertyAttributes(Local< Context > context, Local< Name > key)
static Isolate * GetIsolate(const TracedReference< Object > &handle)
Definition: v8-object.h:795
Local< Context > GetCreationContextChecked()
Maybe< bool > HasPrivate(Local< Context > context, Local< Private > key)
MaybeLocal< Context > GetCreationContext()
MaybeLocal< Value > Get(Local< Context > context, Local< Value > key)
static Local< Object > New(Isolate *isolate)
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:923
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)
static MaybeLocal< Context > GetCreationContext(const PersistentBase< Object > &object)
Definition: v8-object.h:718
Maybe< bool > DeletePrivate(Local< Context > context, Local< Private > key)
MaybeLocal< Value > Get(Local< Context > context, Local< Value > key, MaybeLocal< Object > receiver)
void SetAlignedPointerInInternalFields(int argc, int indices[], void *values[])
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:536
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:89
Definition: v8-object.h:31
static Private * Cast(Data *data)
Definition: v8-object.h:1057
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:206
Definition: v8-object.h:91
void set_enumerable(bool enumerable)
bool has_writable() 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:127
void operator=(const PropertyDescriptor &)=delete
Local< Value > value() 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:166
Definition: v8-initialization.h:61
Definition: v8-value.h:32
Definition: v8-internal.h:840
static const int kJSObjectHeaderSize
Definition: v8-internal.h:857
static Address ValueAsAddress(const T *value)
Definition: v8-internal.h:1595
internal::Isolate * IsolateFromNeverReadOnlySpaceObject(Address obj)
uintptr_t Address
Definition: v8-internal.h:33
Definition: libplatform.h:15
IntegrityLevel
Definition: v8-object.h:228
PropertyAttribute
Definition: v8-object.h:139
@ DontEnum
Definition: v8-object.h:145
@ None
Definition: v8-object.h:141
@ DontDelete
Definition: v8-object.h:147
@ ReadOnly
Definition: v8-object.h:143
KeyCollectionMode
Definition: v8-object.h:211
void(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) AccessorNameGetterCallback
Definition: v8-object.h:156
SideEffectType
Definition: v8-object.h:198
@ kHasSideEffectToReceiver
AccessControl
Definition: v8-object.h:172
@ DEFAULT
Definition: v8-object.h:173
IndexFilter
Definition: v8-object.h:217
KeyConversionMode
Definition: v8-object.h:223
CppHeapPointerTag
Definition: v8-sandbox.h:29
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) AccessorNameSetterCallback
Definition: v8-object.h:160
PropertyFilter
Definition: v8-object.h:179
@ ONLY_CONFIGURABLE
Definition: v8-object.h:183
@ SKIP_SYMBOLS
Definition: v8-object.h:185
@ ONLY_WRITABLE
Definition: v8-object.h:181
@ ALL_PROPERTIES
Definition: v8-object.h:180
@ SKIP_STRINGS
Definition: v8-object.h:184
@ ONLY_ENUMERABLE
Definition: v8-object.h:182
Definition: v8-sandbox.h:70
#define V8_EXPORT
Definition: v8config.h:779
#define V8_INLINE
Definition: v8config.h:493
#define V8_DEPRECATE_SOON(message)
Definition: v8config.h:597
#define V8_LIKELY(condition)
Definition: v8config.h:644
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:654
#define V8_ENUM_DEPRECATE_SOON(message)
Definition: v8config.h:634