5#ifndef INCLUDE_V8_OBJECT_H_
6#define INCLUDE_V8_OBJECT_H_
20class FunctionTemplate;
22class PropertyCallbackInfo;
58 static void CheckCast(
Data* that);
131 PrivateData* private_;
345 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
346 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
362 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
363 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
377 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
378 SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
468 return object.val_->InternalFieldCount();
474 return object->InternalFieldCount();
488 V8_INLINE void* GetAlignedPointerFromInternalField(
int index);
493 return object.val_->GetAlignedPointerFromInternalField(index);
499 return object->GetAlignedPointerFromInternalField(index);
597 V8_DEPRECATED(
"Use MaybeLocal<Context> GetCreationContext()")
613 return object.val_->GetCreationContext();
705 static void CheckCast(
Value* obj);
707 void* SlowGetAlignedPointerFromInternalField(
int index);
713#ifndef V8_ENABLE_CHECKS
716 A obj = *
reinterpret_cast<A*
>(
this);
719 int instance_type = I::GetInstanceType(obj);
721 int offset = I::kJSObjectHeaderSize + (I::kEmbedderDataSlotSize * index);
722 A value = I::ReadRawField<A>(obj, offset);
723#ifdef V8_COMPRESS_POINTERS
726 value = I::DecompressTaggedAnyField(obj,
static_cast<uint32_t
>(value));
728 internal::Isolate* isolate =
734 return SlowGetInternalField(index);
738#if !defined(V8_ENABLE_CHECKS)
741 A obj = *
reinterpret_cast<A*
>(
this);
744 auto instance_type = I::GetInstanceType(obj);
746 int offset = I::kJSObjectHeaderSize + (I::kEmbedderDataSlotSize * index);
747#ifdef V8_SANDBOXED_EXTERNAL_POINTERS
748 offset += I::kEmbedderDataSlotRawPayloadOffset;
750 internal::Isolate* isolate = I::GetIsolateForSandbox(obj);
751 A value = I::ReadExternalPointerField(
753 return reinterpret_cast<void*
>(value);
756 return SlowGetAlignedPointerFromInternalField(index);
760#ifdef V8_ENABLE_CHECKS
763 return reinterpret_cast<Private*
>(data);
767#ifdef V8_ENABLE_CHECKS
770 return static_cast<Object*
>(value);
static internal::Address * CreateHandle(internal::Isolate *isolate, internal::Address value)
bool HasNamedLookupInterceptor() const
static V8_INLINE int InternalFieldCount(const PersistentBase< Object > &object)
V8_WARN_UNUSED_RESULT MaybeLocal< Array > GetPropertyNames(Local< Context > context, KeyCollectionMode mode, PropertyFilter property_filter, IndexFilter index_filter, KeyConversionMode key_conversion=KeyConversionMode::kKeepNumbers)
V8_WARN_UNUSED_RESULT Maybe< bool > HasOwnProperty(Local< Context > context, uint32_t index)
bool HasIndexedLookupInterceptor() const
V8_WARN_UNUSED_RESULT Maybe< PropertyAttribute > GetPropertyAttributes(Local< Context > context, Local< Value > key)
V8_WARN_UNUSED_RESULT Maybe< bool > Has(Local< Context > context, Local< Value > key)
V8_WARN_UNUSED_RESULT MaybeLocal< Array > GetOwnPropertyNames(Local< Context > context)
static V8_INLINE int InternalFieldCount(const BasicTracedReference< Object > &object)
V8_WARN_UNUSED_RESULT MaybeLocal< Value > CallAsConstructor(Local< Context > context, int argc, Local< Value > argv[])
V8_WARN_UNUSED_RESULT Maybe< bool > HasRealNamedProperty(Local< Context > context, Local< Name > key)
V8_WARN_UNUSED_RESULT Maybe< bool > Delete(Local< Context > context, Local< Value > key)
V8_WARN_UNUSED_RESULT 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)
Maybe< bool > SetIntegrityLevel(Local< Context > context, IntegrityLevel level)
V8_WARN_UNUSED_RESULT 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 V8_INLINE void * GetAlignedPointerFromInternalField(const BasicTracedReference< Object > &object, int index)
V8_WARN_UNUSED_RESULT Maybe< bool > DefineOwnProperty(Local< Context > context, Local< Name > key, Local< Value > value, PropertyAttribute attributes=None)
V8_INLINE void * GetAlignedPointerFromInternalField(int index)
bool IsApiWrapper() const
void SetAccessorProperty(Local< Name > name, Local< Function > getter, Local< Function > setter=Local< Function >(), PropertyAttribute attribute=None, AccessControl settings=DEFAULT)
Local< String > GetConstructorName()
V8_WARN_UNUSED_RESULT MaybeLocal< Array > GetOwnPropertyNames(Local< Context > context, PropertyFilter filter, KeyConversionMode key_conversion=KeyConversionMode::kKeepNumbers)
Maybe< bool > DeletePrivate(Local< Context > context, Local< Private > key)
V8_WARN_UNUSED_RESULT Maybe< PropertyAttribute > GetRealNamedPropertyAttributes(Local< Context > context, Local< Name > key)
Maybe< bool > HasPrivate(Local< Context > context, Local< Private > key)
V8_WARN_UNUSED_RESULT Maybe< bool > CreateDataProperty(Local< Context > context, uint32_t index, Local< Value > value)
MaybeLocal< Array > PreviewEntries(bool *is_key_value)
bool IsCodeLike(Isolate *isolate) const
V8_WARN_UNUSED_RESULT Maybe< bool > SetPrototype(Local< Context > context, Local< Value > prototype)
V8_WARN_UNUSED_RESULT Maybe< bool > SetAccessor(Local< Context > context, Local< Name > name, AccessorNameGetterCallback getter, AccessorNameSetterCallback setter=nullptr, MaybeLocal< Value > data=MaybeLocal< Value >(), AccessControl settings=DEFAULT, PropertyAttribute attribute=None, SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect, SideEffectType setter_side_effect_type=SideEffectType::kHasSideEffect)
V8_WARN_UNUSED_RESULT MaybeLocal< String > ObjectProtoToString(Local< Context > context)
bool IsConstructor() const
static V8_INLINE Object * Cast(Value *obj)
void SetInternalField(int index, Local< Value > value)
Local< Value > GetPrototype()
V8_WARN_UNUSED_RESULT Maybe< bool > HasRealIndexedProperty(Local< Context > context, uint32_t index)
void SetAlignedPointerInInternalField(int index, void *value)
V8_WARN_UNUSED_RESULT MaybeLocal< Value > Get(Local< Context > context, Local< Value > key)
V8_WARN_UNUSED_RESULT MaybeLocal< Array > GetPropertyNames(Local< Context > context)
void SetAlignedPointerInInternalFields(int argc, int indices[], void *values[])
V8_WARN_UNUSED_RESULT MaybeLocal< Value > CallAsFunction(Local< Context > context, Local< Value > recv, int argc, Local< Value > argv[])
Maybe< bool > SetPrivate(Local< Context > context, Local< Private > key, Local< Value > value)
V8_WARN_UNUSED_RESULT MaybeLocal< Value > GetOwnPropertyDescriptor(Local< Context > context, Local< Name > key)
static V8_INLINE void * GetAlignedPointerFromInternalField(const PersistentBase< Object > &object, int index)
V8_WARN_UNUSED_RESULT Maybe< bool > Set(Local< Context > context, uint32_t index, Local< Value > value)
V8_WARN_UNUSED_RESULT Maybe< bool > HasOwnProperty(Local< Context > context, Local< Name > key)
V8_WARN_UNUSED_RESULT Maybe< bool > Delete(Local< Context > context, uint32_t index)
V8_WARN_UNUSED_RESULT Maybe< bool > CreateDataProperty(Local< Context > context, Local< Name > key, Local< Value > value)
V8_WARN_UNUSED_RESULT MaybeLocal< Value > Get(Local< Context > context, uint32_t index)
V8_WARN_UNUSED_RESULT Maybe< bool > HasRealNamedCallbackProperty(Local< Context > context, Local< Name > key)
Local< Object > FindInstanceInPrototypeChain(Local< FunctionTemplate > tmpl)
static Local< Object > New(Isolate *isolate)
static Local< Object > New(Isolate *isolate, Local< Value > prototype_or_null, Local< Name > *names, Local< Value > *values, size_t length)
V8_WARN_UNUSED_RESULT Maybe< bool > DefineProperty(Local< Context > context, Local< Name > key, PropertyDescriptor &descriptor)
bool IsUndetectable() const
V8_WARN_UNUSED_RESULT Maybe< PropertyAttribute > GetRealNamedPropertyAttributesInPrototypeChain(Local< Context > context, Local< Name > key)
V8_WARN_UNUSED_RESULT Maybe< bool > Has(Local< Context > context, uint32_t index)
V8_WARN_UNUSED_RESULT MaybeLocal< Value > GetRealNamedProperty(Local< Context > context, Local< Name > key)
MaybeLocal< Value > GetPrivate(Local< Context > context, Local< Private > key)
V8_WARN_UNUSED_RESULT Maybe< bool > Set(Local< Context > context, Local< Value > key, Local< Value > value)
V8_WARN_UNUSED_RESULT MaybeLocal< Value > GetRealNamedPropertyInPrototypeChain(Local< Context > context, Local< Name > key)
V8_INLINE Local< Value > GetInternalField(int index)
int InternalFieldCount() const
Local< Value > Name() const
static Local< Private > ForApi(Isolate *isolate, Local< String > name)
static V8_INLINE Private * Cast(Data *data)
static Local< Private > New(Isolate *isolate, Local< String > name=Local< String >())
PrivateData * get_private() const
bool has_configurable() const
PropertyDescriptor(const PropertyDescriptor &)=delete
bool has_enumerable() const
Local< Value > set() const
void set_configurable(bool configurable)
void operator=(const PropertyDescriptor &)=delete
PropertyDescriptor(Local< Value > get, Local< Value > set)
bool has_writable() const
PropertyDescriptor(Local< Value > value)
Local< Value > value() const
void set_enumerable(bool enumerable)
Local< Value > get() const
PropertyDescriptor(Local< Value > value, bool writable)
bool configurable() const
V8_EXPORT bool CanHaveInternalField(int instance_type)
V8_EXPORT internal::Isolate * IsolateFromNeverReadOnlySpaceObject(Address obj)
@ kEmbedderDataSlotPayloadTag
void(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) AccessorNameGetterCallback
void(*)(Local< String > property, Local< Value > value, const PropertyCallbackInfo< void > &info) AccessorSetterCallback
@ kHasSideEffectToReceiver
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) AccessorNameSetterCallback
void(*)(Local< String > property, const PropertyCallbackInfo< Value > &info) AccessorGetterCallback
#define V8_DEPRECATED(message)
#define V8_WARN_UNUSED_RESULT