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_;
156 "Use AccessorNameGetterCallback signature instead") =
162 "Use AccessorNameSetterCallback signature instead") =
496 int InternalFieldCount() const;
501 return object.template value<Object>()->InternalFieldCount();
507 return object.template value<Object>()->InternalFieldCount();
530 V8_INLINE void* GetAlignedPointerFromInternalField(
int index);
537 return object.template value<Object>()->GetAlignedPointerFromInternalField(
544 return object.template value<Object>()->GetAlignedPointerFromInternalField(
567 template <CppHeapPo
interTag tag,
typename T =
void>
570 template <CppHeapPo
interTag tag,
typename T =
void>
573 template <CppHeapPo
interTag tag,
typename T =
void>
586 template <CppHeapPo
interTag tag>
590 template <CppHeapPo
interTag tag>
594 template <CppHeapPo
interTag tag>
696 return object.template value<Object>()->GetCreationContext();
767 return handle.template value<Object>()->GetIsolate();
814 static void CheckCast(
Value* obj);
816 void* SlowGetAlignedPointerFromInternalField(
int index);
817 void* SlowGetAlignedPointerFromInternalField(
v8::Isolate* isolate,
int index);
823#ifndef V8_ENABLE_CHECKS
829 int instance_type = I::GetInstanceType(obj);
830 if (I::CanHaveInternalField(instance_type)) {
831 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
832 (I::kEmbedderDataSlotSize * index);
833 A value = I::ReadRawField<A>(obj, offset);
834#ifdef V8_COMPRESS_POINTERS
837 value = I::DecompressTaggedField(obj,
static_cast<uint32_t
>(value));
845 return SlowGetInternalField(index);
850#if !defined(V8_ENABLE_CHECKS)
856 auto instance_type = I::GetInstanceType(obj);
857 if (
V8_LIKELY(I::CanHaveInternalField(instance_type))) {
858 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
859 (I::kEmbedderDataSlotSize * index) +
860 I::kEmbedderDataSlotExternalPointerOffset;
862 I::ReadExternalPointerField<internal::kEmbedderDataSlotPayloadTag>(
863 isolate, obj, offset);
864 return reinterpret_cast<void*
>(value);
867 return SlowGetAlignedPointerFromInternalField(isolate, index);
871#if !defined(V8_ENABLE_CHECKS)
877 auto instance_type = I::GetInstanceType(obj);
878 if (
V8_LIKELY(I::CanHaveInternalField(instance_type))) {
879 int offset = I::kJSAPIObjectWithEmbedderSlotsHeaderSize +
880 (I::kEmbedderDataSlotSize * index) +
881 I::kEmbedderDataSlotExternalPointerOffset;
882 Isolate* isolate = I::GetIsolateForSandbox(obj);
884 I::ReadExternalPointerField<internal::kEmbedderDataSlotPayloadTag>(
885 isolate, obj, offset);
886 return reinterpret_cast<void*
>(value);
889 return SlowGetAlignedPointerFromInternalField(index);
893template <CppHeapPo
interTag tag,
typename T>
896#if !defined(V8_ENABLE_CHECKS)
897 return internal::ReadCppHeapPointerField<tag, T>(
900 return reinterpret_cast<T*
>(
Unwrap(isolate, obj, tag));
905template <CppHeapPo
interTag tag,
typename T>
909#if !defined(V8_ENABLE_CHECKS)
910 return internal::ReadCppHeapPointerField<tag, T>(
914 return reinterpret_cast<T*
>(
Unwrap(isolate, obj, tag));
919template <CppHeapPo
interTag tag,
typename T>
924#if !defined(V8_ENABLE_CHECKS)
925 return internal::ReadCppHeapPointerField<tag, T>(
928 return reinterpret_cast<T*
>(
Unwrap(isolate, obj, tag));
933template <CppHeapPo
interTag tag>
937 Wrap(isolate, obj, tag, wrappable);
941template <CppHeapPo
interTag tag>
946 Wrap(isolate, obj, tag, wrappable);
950template <CppHeapPo
interTag tag>
956 Wrap(isolate, obj, tag, wrappable);
960#ifdef V8_ENABLE_CHECKS
963 return reinterpret_cast<Private*
>(data);
967#ifdef V8_ENABLE_CHECKS
970 return static_cast<Object*
>(value);
Definition: v8-container.h:25
Definition: v8-traced-handle.h:125
Definition: v8-context.h:48
Definition: v8-template.h:569
Definition: v8-function.h:26
Definition: v8-isolate.h:210
Definition: v8-local-handle.h:258
static Local< T > New(Isolate *isolate, Local< T > that)
Definition: v8-local-handle.h:338
Definition: v8-local-handle.h:619
Definition: v8-maybe.h:32
Definition: v8-primitive.h:79
Definition: v8-object.h:238
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:934
static Object * Cast(Value *obj)
Definition: v8-object.h:966
bool HasNamedLookupInterceptor() const
Maybe< bool > HasRealNamedProperty(Local< Context > context, Local< Name > key)
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:870
void * GetAlignedPointerFromEmbedderDataInCreationContext(int index)
MaybeLocal< Value > GetRealNamedPropertyInPrototypeChain(Local< Context > context, Local< Name > key)
static int InternalFieldCount(const BasicTracedReference< Object > &object)
Definition: v8-object.h:505
Maybe< bool > Has(Local< Context > context, Local< Value > key)
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:535
Maybe< bool > CreateDataProperty(Local< Context > context, Local< Name > key, Local< Value > value)
Maybe< bool > HasRealIndexedProperty(Local< Context > context, uint32_t index)
bool IsApiWrapper() const
MaybeLocal< Value > Get(Local< Context > context, uint32_t index)
Local< Data > GetInternalField(int index)
Definition: v8-object.h:822
Maybe< PropertyAttribute > GetRealNamedPropertyAttributes(Local< Context > context, Local< Name > key)
static Isolate * GetIsolate(const TracedReference< Object > &handle)
Definition: v8-object.h:766
Local< Context > GetCreationContextChecked()
MaybeLocal< Context > GetCreationContext()
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:894
Maybe< bool > Set(Local< Context > context, uint32_t index, Local< Value > value)
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:694
void SetAlignedPointerInInternalFields(int argc, int indices[], void *values[])
Maybe< bool > HasRealNamedCallbackProperty(Local< Context > context, Local< Name > key)
static void * GetAlignedPointerFromInternalField(const BasicTracedReference< Object > &object, int index)
Definition: v8-object.h:542
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:91
Definition: v8-object.h:31
static Private * Cast(Data *data)
Definition: v8-object.h:959
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:192
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:177
Definition: v8-value.h:32
Definition: v8-internal.h:729
static const int kJSObjectHeaderSize
Definition: v8-internal.h:746
static Address ValueAsAddress(const T *value)
Definition: v8-internal.h:1457
internal::Isolate * IsolateFromNeverReadOnlySpaceObject(Address obj)
uintptr_t Address
Definition: v8-internal.h:31
Definition: libplatform.h:15
IntegrityLevel
Definition: v8-object.h:233
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:216
void(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) AccessorNameGetterCallback
Definition: v8-object.h:159
SideEffectType
Definition: v8-object.h:203
@ kHasSideEffectToReceiver
CppHeapPointerTag
Definition: v8-sandbox.h:20
AccessControl
Definition: v8-object.h:177
@ DEFAULT
Definition: v8-object.h:178
IndexFilter
Definition: v8-object.h:222
KeyConversionMode
Definition: v8-object.h:228
void(*)(Local< String > property, Local< Value > value, const PropertyCallbackInfo< void > &info) AccessorSetterCallback
Definition: v8-object.h:164
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) AccessorNameSetterCallback
Definition: v8-object.h:167
void(*)(Local< String > property, const PropertyCallbackInfo< Value > &info) AccessorGetterCallback
Definition: v8-object.h:157
PropertyFilter
Definition: v8-object.h:184
@ ONLY_CONFIGURABLE
Definition: v8-object.h:188
@ SKIP_SYMBOLS
Definition: v8-object.h:190
@ ONLY_WRITABLE
Definition: v8-object.h:186
@ ALL_PROPERTIES
Definition: v8-object.h:185
@ SKIP_STRINGS
Definition: v8-object.h:189
@ ONLY_ENUMERABLE
Definition: v8-object.h:187
#define V8_EXPORT
Definition: v8config.h:762
#define V8_INLINE
Definition: v8config.h:477
#define V8_DEPRECATE_SOON(message)
Definition: v8config.h:580
#define V8_LIKELY(condition)
Definition: v8config.h:627
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:637