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_;
467 int InternalFieldCount() const;
472 return object.template value<Object>()->InternalFieldCount();
478 return object.template value<Object>()->InternalFieldCount();
501 V8_INLINE void* GetAlignedPointerFromInternalField(
int index);
508 return object.template value<Object>()->GetAlignedPointerFromInternalField(
515 return object.template value<Object>()->GetAlignedPointerFromInternalField(
624 return object.template value<Object>()->GetCreationContext();
691 return handle.template value<Object>()->GetIsolate();
733 static void CheckCast(
Value* obj);
735 void* SlowGetAlignedPointerFromInternalField(
int index);
736 void* SlowGetAlignedPointerFromInternalField(
v8::Isolate* isolate,
int index);
742#ifndef V8_ENABLE_CHECKS
748 int instance_type = I::GetInstanceType(obj);
749 if (I::CanHaveInternalField(instance_type)) {
750 int offset = I::kJSObjectHeaderSize + (I::kEmbedderDataSlotSize * index);
751 A value = I::ReadRawField<A>(obj, offset);
752#ifdef V8_COMPRESS_POINTERS
755 value = I::DecompressTaggedField(obj,
static_cast<uint32_t
>(value));
763 return SlowGetInternalField(index);
768#if !defined(V8_ENABLE_CHECKS)
774 auto instance_type = I::GetInstanceType(obj);
775 if (
V8_LIKELY(I::CanHaveInternalField(instance_type))) {
776 int offset = I::kJSObjectHeaderSize + (I::kEmbedderDataSlotSize * index) +
777 I::kEmbedderDataSlotExternalPointerOffset;
779 I::ReadExternalPointerField<internal::kEmbedderDataSlotPayloadTag>(
780 isolate, obj, offset);
781 return reinterpret_cast<void*
>(value);
784 return SlowGetAlignedPointerFromInternalField(isolate, index);
788#if !defined(V8_ENABLE_CHECKS)
794 auto instance_type = I::GetInstanceType(obj);
795 if (
V8_LIKELY(I::CanHaveInternalField(instance_type))) {
796 int offset = I::kJSObjectHeaderSize + (I::kEmbedderDataSlotSize * index) +
797 I::kEmbedderDataSlotExternalPointerOffset;
798 Isolate* isolate = I::GetIsolateForSandbox(obj);
800 I::ReadExternalPointerField<internal::kEmbedderDataSlotPayloadTag>(
801 isolate, obj, offset);
802 return reinterpret_cast<void*
>(value);
805 return SlowGetAlignedPointerFromInternalField(index);
809#ifdef V8_ENABLE_CHECKS
812 return reinterpret_cast<Private*
>(data);
816#ifdef V8_ENABLE_CHECKS
819 return static_cast<Object*
>(value);
static V8_INLINE Local< T > New(Isolate *isolate, Local< T > that)
bool HasNamedLookupInterceptor() const
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)
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)
Local< Context > GetCreationContextChecked()
void * GetAlignedPointerFromEmbedderDataInCreationContext(int index)
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)
V8_INLINE Local< Data > GetInternalField(int index)
bool IsApiWrapper() const
MaybeLocal< Context > GetCreationContext()
V8_WARN_UNUSED_RESULT Maybe< PropertyAttribute > GetRealNamedPropertyAttributes(Local< Context > context, Local< Name > key)
void SetInternalField(int index, Local< Data > data)
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
static V8_INLINE MaybeLocal< Context > GetCreationContext(const PersistentBase< Object > &object)
bool IsConstructor() const
static V8_INLINE Object * Cast(Value *obj)
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)
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[])
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)
static V8_INLINE Isolate * GetIsolate(const TracedReference< Object > &handle)
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)
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)
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
static V8_INLINE Address ValueAsAddress(const T *value)
V8_EXPORT internal::Isolate * IsolateFromNeverReadOnlySpaceObject(Address obj)
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_DEPRECATE_SOON(message)
#define V8_LIKELY(condition)
#define V8_WARN_UNUSED_RESULT