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>
722 return object.template value<Object>()->GetCreationContext(isolate);
742 void* GetAlignedPointerFromEmbedderDataInCreationContext(
v8::
Isolate* isolate,
744 void* GetAlignedPointerFromEmbedderDataInCreationContext(
int index);
751 bool IsCallable() const;
756 bool IsConstructor() const;
769 bool IsApiWrapper() const;
776 bool IsUndetectable() const;
801 return handle.template value<Object>()->GetIsolate();
848 static void CheckCast(
Value* obj);
850 void* SlowGetAlignedPointerFromInternalField(
int index);
851 void* SlowGetAlignedPointerFromInternalField(
v8::Isolate* isolate,
int index);
857#ifndef V8_ENABLE_CHECKS
863 int instance_type = I::GetInstanceType(obj);
864 if (I::CanHaveInternalField(instance_type)) {
865 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
866 (I::kEmbedderDataSlotSize * index);
867 A value = I::ReadRawField<A>(obj, offset);
868#ifdef V8_COMPRESS_POINTERS
871 value = I::DecompressTaggedField(obj,
static_cast<uint32_t
>(value));
879 return SlowGetInternalField(index);
884#if !defined(V8_ENABLE_CHECKS)
890 auto instance_type = I::GetInstanceType(obj);
891 if (
V8_LIKELY(I::CanHaveInternalField(instance_type))) {
892 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
893 (I::kEmbedderDataSlotSize * index) +
894 I::kEmbedderDataSlotExternalPointerOffset;
896 I::ReadExternalPointerField<internal::kEmbedderDataSlotPayloadTag>(
897 isolate, obj, offset);
898 return reinterpret_cast<void*
>(value);
901 return SlowGetAlignedPointerFromInternalField(isolate, index);
905#if !defined(V8_ENABLE_CHECKS)
911 auto instance_type = I::GetInstanceType(obj);
912 if (
V8_LIKELY(I::CanHaveInternalField(instance_type))) {
913 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
914 (I::kEmbedderDataSlotSize * index) +
915 I::kEmbedderDataSlotExternalPointerOffset;
916 Isolate* isolate = I::GetIsolateForSandbox(obj);
918 I::ReadExternalPointerField<internal::kEmbedderDataSlotPayloadTag>(
919 isolate, obj, offset);
920 return reinterpret_cast<void*
>(value);
923 return SlowGetAlignedPointerFromInternalField(index);
927template <CppHeapPo
interTag tag,
typename T>
931#if !defined(V8_ENABLE_CHECKS)
932 return internal::ReadCppHeapPointerField<T>(
935 return reinterpret_cast<T*
>(
Unwrap(isolate, obj, tag_range));
940template <CppHeapPo
interTag tag,
typename T>
945#if !defined(V8_ENABLE_CHECKS)
946 return internal::ReadCppHeapPointerField<T>(
949 return reinterpret_cast<T*
>(
Unwrap(isolate, obj, tag_range));
954template <CppHeapPo
interTag tag,
typename T>
960#if !defined(V8_ENABLE_CHECKS)
961 return internal::ReadCppHeapPointerField<T>(
964 return reinterpret_cast<T*
>(
Unwrap(isolate, obj, tag_range));
973#if !defined(V8_ENABLE_CHECKS)
974 return internal::ReadCppHeapPointerField<T>(
977 return reinterpret_cast<T*
>(
Unwrap(isolate, obj, tag_range));
987#if !defined(V8_ENABLE_CHECKS)
988 return internal::ReadCppHeapPointerField<T>(
992 return reinterpret_cast<T*
>(
Unwrap(isolate, obj, tag_range));
1003#if !defined(V8_ENABLE_CHECKS)
1004 return internal::ReadCppHeapPointerField<T>(
1007 return reinterpret_cast<T*
>(
Unwrap(isolate, obj, tag_range));
1012template <CppHeapPo
interTag tag>
1016 Wrap(isolate, obj, tag, wrappable);
1020template <CppHeapPo
interTag tag>
1025 Wrap(isolate, obj, tag, wrappable);
1029template <CppHeapPo
interTag tag>
1035 Wrap(isolate, obj, tag, wrappable);
1042 Wrap(isolate, obj, tag, wrappable);
1050 Wrap(isolate, obj, tag, wrappable);
1059 Wrap(isolate, obj, tag, wrappable);
1063#ifdef V8_ENABLE_CHECKS
1066 return reinterpret_cast<Private*
>(data);
1070#ifdef V8_ENABLE_CHECKS
1073 return static_cast<Object*
>(value);
Definition: v8-traced-handle.h:124
Definition: v8-context.h:48
Definition: v8-template.h:569
Definition: v8-isolate.h:261
Definition: v8-local-handle.h:266
static Local< T > New(Isolate *isolate, Local< T > that)
Definition: v8-local-handle.h:346
Definition: v8-local-handle.h:632
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)
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:1013
static Object * Cast(Value *obj)
Definition: v8-object.h:1069
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)
Maybe< bool > DefineOwnProperty(Local< Context > context, Local< Name > key, Local< Value > value, PropertyAttribute attributes=None)
void * GetAlignedPointerFromInternalField(int index)
Definition: v8-object.h:904
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: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)
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)
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:856
Maybe< PropertyAttribute > GetRealNamedPropertyAttributes(Local< Context > context, Local< Name > key)
Maybe< bool > HasPrivate(Local< Context > context, Local< Private > key)
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:928
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)
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:1062
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:165
Definition: v8-initialization.h:61
Definition: v8-value.h:32
Definition: v8-internal.h:794
static const int kJSObjectHeaderSize
Definition: v8-internal.h:811
static Address ValueAsAddress(const T *value)
Definition: v8-internal.h:1625
internal::Isolate * IsolateFromNeverReadOnlySpaceObject(Address obj)
uintptr_t Address
Definition: v8-internal.h:52
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:28
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:69
#define V8_EXPORT
Definition: v8config.h:793
#define V8_INLINE
Definition: v8config.h:499
#define V8_DEPRECATE_SOON(message)
Definition: v8config.h:603
#define V8_LIKELY(condition)
Definition: v8config.h:650
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:660
#define V8_ENUM_DEPRECATE_SOON(message)
Definition: v8config.h:640