5#ifndef INCLUDE_V8_OBJECT_H_
6#define INCLUDE_V8_OBJECT_H_
24class FunctionTemplate;
26class PropertyCallbackInfo;
62 static void CheckCast(
Data* that);
135 PrivateData* private_;
173 "This enum is no longer used and will be removed in V8 12.9.")
366 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
367 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
381 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
382 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
433 "V8 will stop providing access to hidden prototype (i.e. "
434 "JSGlobalObject). Use GetPrototypeV2() instead. "
435 "See http://crbug.com/333672197.")
452 "
V8 will stop providing access to hidden prototype (i.e. "
453 "JSGlobalObject). Use SetPrototypeV2() instead. "
492 int InternalFieldCount() const;
497 return object.template value<Object>()->InternalFieldCount();
503 return object.template value<Object>()->InternalFieldCount();
526 V8_INLINE void* GetAlignedPointerFromInternalField(
int index);
533 return object.template value<Object>()->GetAlignedPointerFromInternalField(
540 return object.template value<Object>()->GetAlignedPointerFromInternalField(
586 template <CppHeapPo
interTag tag,
typename T =
void>
589 template <CppHeapPo
interTag tag,
typename T =
void>
592 template <CppHeapPo
interTag tag,
typename T =
void>
596 template <
typename T =
void>
600 template <
typename T =
void>
604 template <
typename T =
void>
618 template <CppHeapPo
interTag tag>
649 Wrappable* wrappable);
653 Wrappable* wrappable);
657 Wrappable* wrappable);
731 bool HasNamedLookupInterceptor() const;
734 bool HasIndexedLookupInterceptor() const;
743 int GetIdentityHash();
775 return object.template value<Object>()->GetCreationContext(isolate);
795 void* GetAlignedPointerFromEmbedderDataInCreationContext(
v8::
Isolate* isolate,
797 void* GetAlignedPointerFromEmbedderDataInCreationContext(
int index);
804 bool IsCallable() const;
809 bool IsConstructor() const;
822 bool IsApiWrapper() const;
829 bool IsUndetectable() const;
852 "Use
Isolate::GetCurrent() instead, which is guaranteed to return the "
853 "same isolate since https:
857 "Use
Isolate::GetCurrent() instead, which is guaranteed to return the "
858 "same isolate since https:
860 return handle.template value<Object>()->GetIsolate();
907 static void CheckCast(
Value* obj);
909 void* SlowGetAlignedPointerFromInternalField(
int index);
910 void* SlowGetAlignedPointerFromInternalField(
v8::Isolate* isolate,
int index);
916#ifndef V8_ENABLE_CHECKS
922 int instance_type = I::GetInstanceType(obj);
923 if (I::CanHaveInternalField(instance_type)) {
924 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
925 (I::kEmbedderDataSlotSize * index);
926 A value = I::ReadRawField<A>(obj, offset);
927#ifdef V8_COMPRESS_POINTERS
930 value = I::DecompressTaggedField(obj,
static_cast<uint32_t
>(value));
933 auto* isolate = I::GetCurrentIsolate();
937 return SlowGetInternalField(index);
942#if !defined(V8_ENABLE_CHECKS)
948 auto instance_type = I::GetInstanceType(obj);
949 if (
V8_LIKELY(I::CanHaveInternalField(instance_type))) {
950 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
951 (I::kEmbedderDataSlotSize * index) +
952 I::kEmbedderDataSlotExternalPointerOffset;
954 I::ReadExternalPointerField<internal::kEmbedderDataSlotPayloadTag>(
955 isolate, obj, offset);
956 return reinterpret_cast<void*
>(value);
959 return SlowGetAlignedPointerFromInternalField(isolate, index);
963#if !defined(V8_ENABLE_CHECKS)
969 auto instance_type = I::GetInstanceType(obj);
970 if (
V8_LIKELY(I::CanHaveInternalField(instance_type))) {
971 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
972 (I::kEmbedderDataSlotSize * index) +
973 I::kEmbedderDataSlotExternalPointerOffset;
974 Isolate* isolate = I::GetCurrentIsolateForSandbox();
976 I::ReadExternalPointerField<internal::kEmbedderDataSlotPayloadTag>(
977 isolate, obj, offset);
978 return reinterpret_cast<void*
>(value);
981 return SlowGetAlignedPointerFromInternalField(index);
985template <CppHeapPo
interTag tag,
typename T>
989#if !defined(V8_ENABLE_CHECKS)
990 return internal::ReadCppHeapPointerField<T>(
993 return reinterpret_cast<T*
>(
Unwrap(isolate, obj, tag_range));
998template <CppHeapPo
interTag tag,
typename T>
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,
typename T>
1018#if !defined(V8_ENABLE_CHECKS)
1019 return internal::ReadCppHeapPointerField<T>(
1022 return reinterpret_cast<T*
>(
Unwrap(isolate, obj, tag_range));
1027template <
typename T>
1031#if !defined(V8_ENABLE_CHECKS)
1032 return internal::ReadCppHeapPointerField<T>(
1035 return reinterpret_cast<T*
>(
Unwrap(isolate, obj, tag_range));
1040template <
typename T>
1045#if !defined(V8_ENABLE_CHECKS)
1046 return internal::ReadCppHeapPointerField<T>(
1050 return reinterpret_cast<T*
>(
Unwrap(isolate, obj, tag_range));
1055template <
typename T>
1061#if !defined(V8_ENABLE_CHECKS)
1062 return internal::ReadCppHeapPointerField<T>(
1065 return reinterpret_cast<T*
>(
Unwrap(isolate, obj, tag_range));
1070template <CppHeapPo
interTag tag>
1074 Wrap(isolate, obj, tag, wrappable);
1078template <CppHeapPo
interTag tag>
1083 Wrap(isolate, obj, tag, wrappable);
1087template <CppHeapPo
interTag tag>
1093 Wrap(isolate, obj, tag, wrappable);
1100 Wrap(isolate, obj, tag, wrappable);
1108 Wrap(isolate, obj, tag, wrappable);
1117 Wrap(isolate, obj, tag, wrappable);
1121template <CppHeapPo
interTag tag>
1125 Wrap(isolate, obj, tag, wrappable);
1129template <CppHeapPo
interTag tag>
1134 Wrap(isolate, obj, tag, wrappable);
1138template <CppHeapPo
interTag tag>
1144 Wrap(isolate, obj, tag, wrappable);
1151 Wrap(isolate, obj, tag, wrappable);
1159 Wrap(isolate, obj, tag, wrappable);
1168 Wrap(isolate, obj, tag, wrappable);
1172#ifdef V8_ENABLE_CHECKS
1175 return reinterpret_cast<Private*
>(data);
1179#ifdef V8_ENABLE_CHECKS
1182 return static_cast<Object*
>(value);
Definition: garbage-collected.h:53
Definition: name-provider.h:26
Definition: v8-traced-handle.h:124
Definition: v8-context.h:48
Definition: v8-template.h:583
Definition: v8-isolate.h:290
Definition: v8-local-handle.h:297
static Local< T > New(Isolate *isolate, Local< T > that)
Definition: v8-local-handle.h:379
Definition: v8-local-handle.h:665
Definition: v8-maybe.h:33
Definition: v8-primitive.h:79
Definition: v8-object.h:565
const char * GetHumanReadableName() const override
Definition: v8-object.h:571
virtual const WrapperTypeInfo * GetWrapperTypeInfo() const
Definition: v8-object.h:567
virtual void Trace(cppgc::Visitor *visitor) const
Definition: v8-object.h:573
Definition: v8-object.h:235
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:1071
static Object * Cast(Value *obj)
Definition: v8-object.h:1178
Maybe< bool > SetPrivate(Local< Context > context, Local< Private > key, Local< Value > value)
MaybeLocal< Array > GetPropertyNames(Local< Context > context)
Maybe< bool > Delete(Local< Context > context, uint32_t index)
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:962
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)
static int InternalFieldCount(const BasicTracedReference< Object > &object)
Definition: v8-object.h:501
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:531
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 > 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:915
Maybe< bool > HasPrivate(Local< Context > context, Local< Private > key)
MaybeLocal< Value > Get(Local< Context > context, Local< Value > key)
static Local< Object > New(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:986
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)
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 > 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:538
static Local< Object > New(Isolate *isolate, Local< Value > prototype_or_null, Local< Name > *names, Local< Value > *values, size_t length)
Definition: v8-persistent-handle.h:93
Definition: v8-object.h:33
static Private * Cast(Data *data)
Definition: v8-object.h:1171
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:93
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:129
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:854
static const int kJSObjectHeaderSize
Definition: v8-internal.h:871
static Address ValueAsAddress(const T *value)
Definition: v8-internal.h:1722
uintptr_t Address
Definition: v8-internal.h:52
Definition: libplatform.h:15
IntegrityLevel
Definition: v8-object.h:230
PropertyAttribute
Definition: v8-object.h:141
@ DontEnum
Definition: v8-object.h:147
@ None
Definition: v8-object.h:143
@ DontDelete
Definition: v8-object.h:149
@ ReadOnly
Definition: v8-object.h:145
KeyCollectionMode
Definition: v8-object.h:213
void(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) AccessorNameGetterCallback
Definition: v8-object.h:158
SideEffectType
Definition: v8-object.h:200
@ kHasSideEffectToReceiver
AccessControl
Definition: v8-object.h:174
@ DEFAULT
Definition: v8-object.h:175
IndexFilter
Definition: v8-object.h:219
KeyConversionMode
Definition: v8-object.h:225
CppHeapPointerTag
Definition: v8-sandbox.h:28
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) AccessorNameSetterCallback
Definition: v8-object.h:162
PropertyFilter
Definition: v8-object.h:181
@ ONLY_CONFIGURABLE
Definition: v8-object.h:185
@ SKIP_SYMBOLS
Definition: v8-object.h:187
@ ONLY_WRITABLE
Definition: v8-object.h:183
@ ALL_PROPERTIES
Definition: v8-object.h:182
@ SKIP_STRINGS
Definition: v8-object.h:186
@ ONLY_ENUMERABLE
Definition: v8-object.h:184
Definition: v8-sandbox.h:70
Definition: v8-object.h:555
const int16_t type_id
Definition: v8-object.h:556
#define V8_EXPORT
Definition: v8config.h:800
#define V8_INLINE
Definition: v8config.h:500
#define V8_DEPRECATE_SOON(message)
Definition: v8config.h:614
#define V8_LIKELY(condition)
Definition: v8config.h:661
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:671
#define V8_ENUM_DEPRECATE_SOON(message)
Definition: v8config.h:651