5#ifndef V8_OBJECTS_OBJECTS_H_
6#define V8_OBJECTS_OBJECTS_H_
40struct InliningPosition;
42class PropertyDescriptorObject;
148 template <
typename T,
template <
typename>
typename HandleType>
151 Isolate* isolate, HandleType<T> input);
164 bool allow_coercion =
true);
186 template <
typename IsolateT>
219 template <
typename T,
template <
typename>
typename HandleType>
223 const char* method_name =
nullptr);
226 const char* method_name =
nullptr);
233 template <
template <
typename>
typename HandleType>
239 template <
typename T,
template <
typename>
typename HandleType>
246 template <
typename T,
template <
typename>
typename HandleType>
251 template <
typename T,
template <
typename>
typename HandleType>
257 template <
typename T,
template <
typename>
typename HandleType>
263 template <
typename T,
template <
typename>
typename HandleType>
269 template <
typename T,
template <
typename>
typename HandleType>
275 template <
typename T,
template <
typename>
typename HandleType>
287 template <
typename T,
template <
typename>
typename HandleType>
297 template <
typename T,
template <
typename>
typename HandleType>
509 return std::hash<v8::internal::Address>{}(
static_cast<Tagged_t>(o.
ptr()));
518 return a.SafeEquals(b);
534 return a.ptr() < b.
ptr();
547 template <
typename T,
template <
typename>
typename HandleType>
549 static inline typename HandleType<Object>::MaybeType
Share(
550 Isolate* isolate, HandleType<T> value,
553 template <
template <
typename>
typename HandleType>
555 static typename HandleType<Object>::MaybeType
ShareSlow(
556 Isolate* isolate, HandleType<HeapObject> value,
589 template <
template <
typename>
typename HandleType>
593 template <
template <
typename>
typename HandleType>
597 template <
template <
typename>
typename HandleType>
600 typename HandleType<String>::MaybeType
601 ConvertToString(
Isolate* isolate, HandleType<Object> input);
602 template <
template <
typename>
typename HandleType>
606 template <
template <
typename>
typename HandleType>
610 template <
template <
typename>
typename HandleType>
613 typename HandleType<Number>::MaybeType
614 ConvertToInteger(
Isolate* isolate, HandleType<Object> input);
615 template <
template <
typename>
typename HandleType>
618 Isolate* isolate, HandleType<Object> input);
619 template <
template <
typename>
typename HandleType>
622 Isolate* isolate, HandleType<Object> input);
625 template <
template <
typename>
typename HandleType>
628 typename HandleType<Number>::MaybeType
629 ConvertToIndex(
Isolate* isolate, HandleType<Object> input,
639 template <HeapObjectReferenceType kRefType>
641 template <
typename T>
642 explicit Brief(T* v) : value{v->ptr()} {}
660template <HeapObjectReferenceType kRefType,
typename StorageType>
664template <HeapObjectReferenceType kRefType,
typename StorageType>
668template <HeapObjectReferenceType kRefType,
typename StorageType>
672template <
typename StorageType>
690#define IS_TYPE_FUNCTION_DECL(Type) \
691 V8_INLINE bool Is##Type(Tagged<Object> obj); \
692 V8_INLINE bool Is##Type(Tagged<Object> obj, PtrComprCageBase cage_base);
698#undef IS_TYPE_FUNCTION_DECL
708#define IS_TYPE_FUNCTION_DECL(Type, Value, _) \
709 V8_INLINE bool Is##Type(Tagged<Object> obj, Isolate* isolate); \
710 V8_INLINE bool Is##Type(Tagged<Object> obj, LocalIsolate* isolate); \
711 V8_INLINE bool Is##Type(Tagged<Object> obj, ReadOnlyRoots roots); \
712 V8_INLINE bool Is##Type(Tagged<Object> obj);
716#undef IS_TYPE_FUNCTION_DECL
722#if !V8_ENABLE_WEBASSEMBLY
736#define DECL_STRUCT_PREDICATE(NAME, Name, name) \
737 V8_INLINE bool Is##Name(Tagged<Object> obj); \
738 V8_INLINE bool Is##Name(Tagged<Object> obj, PtrComprCageBase cage_base);
740#undef DECL_STRUCT_PREDICATE
762 StringStream* accumulator);
834 return map ^ Internals::kMapWordXorMask;
838 return mapword ^ Internals::kMapWordXorMask;
841 return (
static_cast<intptr_t
>(mapword) & Internals::kMapWordXorMask) ==
842 Internals::kMapWordSignature &&
843 (0xffffffff00000000 &
static_cast<intptr_t
>(mapword)) != 0;
852 template <
typename TFieldType,
int kFieldOffset,
typename CompressionScheme>
860template <
int start_offset,
int end_offset,
int size>
863template <
int start_offset>
866template <
int start_offset>
869template <
class ParentBodyDescriptor,
class ChildBodyDescriptor>
907 static inline bool get(
int value,
int bit_position) {
908 return (value & (1 << bit_position)) != 0;
911 static inline int set(
int value,
int bit_position,
bool v) {
913 value |= (1 << bit_position);
915 value &= ~(1 << bit_position);
951 std::atomic_thread_fence(std::memory_order_release);
static bool get(int value, int bit_position)
static int set(int value, int bit_position, bool v)
static constexpr bool IsPacked(Address)
Tagged< Map > ToMap() const
constexpr Address ptr() const
bool IsForwardingAddress() const
constexpr bool operator==(MapWord other) const
constexpr MapWord(Address value)
static V8_EXPORT_PRIVATE bool IsMapOrForwarded(Tagged< Map > map)
static MapWord FromForwardingAddress(Tagged< HeapObject > map_word_host, Tagged< HeapObject > object)
constexpr bool operator!=(MapWord other) const
static MapWord FromMap(const Tagged< Map > map)
Tagged< HeapObject > ToForwardingAddress(Tagged< HeapObject > map_word_host)
static V8_EXPORT_PRIVATE DirectHandle< String > NoSideEffectsToString(Isolate *isolate, DirectHandle< Object > input)
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > ToLength(Isolate *isolate, DirectHandle< Object > input)
static V8_WARN_UNUSED_RESULT MaybeHandle< JSAny > GetPropertyWithAccessor(LookupIterator *it)
static bool CanBeHeldWeakly(Tagged< Object > obj)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT MaybeHandle< Number > ConvertToLength(Isolate *isolate, DirectHandle< Object > input)
static V8_WARN_UNUSED_RESULT Maybe< bool > GreaterThan(Isolate *isolate, DirectHandle< Object > x, DirectHandle< Object > y)
static Tagged< Map > GetPrototypeChainRootMap(Tagged< Object > obj, Isolate *isolate)
static V8_WARN_UNUSED_RESULT Maybe< bool > RedefineIncompatibleProperty(Isolate *isolate, DirectHandle< Object > name, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
static V8_WARN_UNUSED_RESULT bool ToArrayIndex(Tagged< Object > obj, uint32_t *index)
static V8_WARN_UNUSED_RESULT HandleType< Number >::MaybeType ToInt32(Isolate *isolate, HandleType< T > input)
static bool ToArrayLength(Tagged< Object > obj, uint32_t *index)
static V8_WARN_UNUSED_RESULT HandleType< String >::MaybeType ToString(Isolate *isolate, HandleType< T > input)
static V8_EXPORT_PRIVATE Handle< UnionOf< JSAny, Hole > > NewStorageFor(Isolate *isolate, Handle< UnionOf< JSAny, Hole > > object, Representation representation)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > AddDataProperty(LookupIterator *it, DirectHandle< Object > value, PropertyAttributes attributes, Maybe< ShouldThrow > should_throw, StoreOrigin store_origin, EnforceDefineSemantics semantics=EnforceDefineSemantics::kSet)
EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) V8_WARN_UNUSED_RESULT static typename HandleType< Number > static V8_WARN_UNUSED_RESULT HandleType< Number >::MaybeType ConvertToInt32(Isolate *isolate, HandleType< Object > input)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > SetProperty(LookupIterator *it, DirectHandle< Object > value, StoreOrigin store_origin, Maybe< ShouldThrow > should_throw=Nothing< ShouldThrow >())
static V8_WARN_UNUSED_RESULT HandleType< Name >::MaybeType ConvertToName(Isolate *isolate, HandleType< Object > input)
friend class CompressedObjectSlot
static V8_WARN_UNUSED_RESULT Maybe< bool > SetPropertyWithDefinedSetter(DirectHandle< JSAny > receiver, DirectHandle< JSReceiver > setter, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > GetPropertyOrElement(Isolate *isolate, DirectHandle< JSAny > object, DirectHandle< Name > name)
static V8_WARN_UNUSED_RESULT HandleType< Number >::MaybeType ToUint32(Isolate *isolate, HandleType< T > input)
static V8_WARN_UNUSED_RESULT HandleType< Number >::MaybeType ToNumber(Isolate *isolate, HandleType< T > input)
static bool SameNumberValue(double number1, double number2)
static V8_WARN_UNUSED_RESULT MaybeHandle< JSAny > GetPropertyWithDefinedGetter(DirectHandle< JSAny > receiver, DirectHandle< JSReceiver > getter)
static bool SameValueZero(Tagged< Object > obj, Tagged< Object > other)
static DirectHandle< FieldType > OptimalType(Tagged< Object > obj, Isolate *isolate, Representation representation)
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > OrdinaryHasInstance(Isolate *isolate, DirectHandle< JSAny > callable, DirectHandle< JSAny > object)
static V8_WARN_UNUSED_RESULT HandleType< Number >::MaybeType ConvertToUint32(Isolate *isolate, HandleType< Object > input)
static Handle< String > TypeOf(Isolate *isolate, DirectHandle< Object > object)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< FixedArray > CreateListFromArrayLike(Isolate *isolate, DirectHandle< Object > object, ElementTypes element_types)
static V8_EXPORT_PRIVATE bool BooleanValue(Tagged< Object > obj, IsolateT *isolate)
static ElementsKind OptimalElementsKind(Tagged< Object > obj, PtrComprCageBase cage_base)
static V8_WARN_UNUSED_RESULT HandleType< Number >::MaybeType ToInteger(Isolate *isolate, HandleType< T > input)
static V8_WARN_UNUSED_RESULT HandleType< JSReceiver >::MaybeType ToObject(Isolate *isolate, HandleType< T > object, const char *method_name=nullptr)
V8_INLINE static V8_WARN_UNUSED_RESULT Maybe< bool > IsArray(DirectHandle< Object > object)
static Representation OptimalRepresentation(Tagged< Object > obj, PtrComprCageBase cage_base)
static V8_EXPORT_PRIVATE Tagged< Smi > GetOrCreateHash(Tagged< Object > obj, Isolate *isolate)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > Add(Isolate *isolate, Handle< Object > lhs, Handle< Object > rhs)
static bool FilterKey(Tagged< Object > obj, PropertyFilter filter)
static V8_WARN_UNUSED_RESULT HandleType< Object >::MaybeType ToIndex(Isolate *isolate, HandleType< T > input, MessageTemplate error_index)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< bool > Equals(Isolate *isolate, DirectHandle< Object > x, DirectHandle< Object > y)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetSuperProperty(LookupIterator *it, DirectHandle< Object > value, StoreOrigin store_origin, Maybe< ShouldThrow > should_throw=Nothing< ShouldThrow >())
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > InstanceOf(Isolate *isolate, DirectHandle< JSAny > object, DirectHandle< JSAny > callable)
static V8_WARN_UNUSED_RESULT HandleType< Object >::MaybeType ToPropertyKey(Isolate *isolate, HandleType< T > value)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > SetElement(Isolate *isolate, DirectHandle< JSAny > object, uint32_t index, DirectHandle< Object > value, ShouldThrow should_throw)
static V8_WARN_UNUSED_RESULT Maybe< bool > LessThan(Isolate *isolate, DirectHandle< Object > x, DirectHandle< Object > y)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > SetPropertyOrElement(Isolate *isolate, DirectHandle< JSAny > object, DirectHandle< Name > name, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw=Nothing< ShouldThrow >(), StoreOrigin store_origin=StoreOrigin::kMaybeKeyed)
static double NumberValue(Tagged< Number > obj)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetPropertyWithAccessor(LookupIterator *it, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
static V8_WARN_UNUSED_RESULT Maybe< bool > TransitionAndWriteDataProperty(LookupIterator *it, DirectHandle< Object > value, PropertyAttributes attributes, Maybe< ShouldThrow > should_throw, StoreOrigin store_origin)
static bool CheckContextualStoreToJSGlobalObject(LookupIterator *it, Maybe< ShouldThrow > should_throw)
static V8_EXPORT_PRIVATE MaybeDirectHandle< String > NoSideEffectsToMaybeString(Isolate *isolate, DirectHandle< Object > input)
static Handle< JSAny > WrapForRead(IsolateT *isolate, Handle< JSAny > object, Representation representation)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > GetLengthFromArrayLike(Isolate *isolate, DirectHandle< JSReceiver > object)
static Tagged< Object > GetHash(Tagged< Object > obj)
static V8_WARN_UNUSED_RESULT Maybe< double > IntegerValue(Isolate *isolate, HandleType< T > input)
EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) V8_WARN_UNUSED_RESULT static typename HandleType< String > static V8_WARN_UNUSED_RESULT HandleType< Number >::MaybeType ConvertToNumber(Isolate *isolate, HandleType< Object > input)
static V8_EXPORT_PRIVATE bool SameValue(Tagged< Object > obj, Tagged< Object > other)
static V8_EXPORT_PRIVATE bool ToInt32(Tagged< Object > obj, int32_t *value)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< JSReceiver > ConvertReceiver(Isolate *isolate, DirectHandle< Object > object)
static V8_WARN_UNUSED_RESULT Maybe< bool > GreaterThanOrEqual(Isolate *isolate, DirectHandle< Object > x, DirectHandle< Object > y)
static V8_WARN_UNUSED_RESULT HandleType< Object >::MaybeType ToPrimitive(Isolate *isolate, HandleType< T > input, ToPrimitiveHint hint=ToPrimitiveHint::kDefault)
static V8_WARN_UNUSED_RESULT Maybe< bool > LessThanOrEqual(Isolate *isolate, DirectHandle< Object > x, DirectHandle< Object > y)
static V8_WARN_UNUSED_RESULT Maybe< bool > CannotCreateProperty(Isolate *isolate, DirectHandle< JSAny > receiver, DirectHandle< Object > name, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
static V8_WARN_UNUSED_RESULT HandleType< Name >::MaybeType ToName(Isolate *isolate, HandleType< Object > input)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > SpeciesConstructor(Isolate *isolate, DirectHandle< JSReceiver > recv, DirectHandle< JSFunction > default_ctor)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > GetMethod(Isolate *isolate, DirectHandle< JSReceiver > receiver, DirectHandle< Name > name)
static V8_EXPORT_PRIVATE bool StrictEquals(Tagged< Object > obj, Tagged< Object > that)
static const int kHeaderSize
static Tagged< Object > ToBoolean(Tagged< Object > obj, Isolate *isolate)
static V8_EXPORT_PRIVATE bool IterationHasObservableEffects(Tagged< Object > obj)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT MaybeHandle< Object > GetProperty(LookupIterator *it, bool is_global_reference=false)
static bool ToUint32(Tagged< Object > obj, uint32_t *value)
static bool HasValidElements(Tagged< Object > obj)
static V8_WARN_UNUSED_RESULT Maybe< bool > WriteToReadOnlyProperty(LookupIterator *it, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw)
static HandleType< Object >::MaybeType ShareSlow(Isolate *isolate, HandleType< HeapObject > value, ShouldThrow throw_if_cannot_be_shared)
static V8_WARN_UNUSED_RESULT HandleType< Numeric >::MaybeType ConvertToNumeric(Isolate *isolate, HandleType< Object > input)
static bool ToIntegerIndex(Tagged< Object > obj, size_t *index)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetDataProperty(LookupIterator *it, DirectHandle< Object > value)
static bool FitsRepresentation(Tagged< Object > obj, Representation representation, bool allow_coercion=true)
static V8_WARN_UNUSED_RESULT HandleType< Object >::MaybeType ConvertToPropertyKey(Isolate *isolate, HandleType< Object > value)
static V8_WARN_UNUSED_RESULT Maybe< bool > SetPropertyInternal(LookupIterator *it, DirectHandle< Object > value, Maybe< ShouldThrow > should_throw, StoreOrigin store_origin, bool *found)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > ArraySpeciesConstructor(Isolate *isolate, DirectHandle< JSAny > original_array)
static Tagged< Object > GetSimpleHash(Tagged< Object > object)
static bool IsCodeLike(Tagged< Object > obj, Isolate *isolate)
V8_EXPORT_PRIVATE static V8_WARN_UNUSED_RESULT Maybe< ComparisonResult > Compare(Isolate *isolate, DirectHandle< Object > x, DirectHandle< Object > y)
static HandleType< Object >::MaybeType Share(Isolate *isolate, HandleType< T > value, ShouldThrow throw_if_cannot_be_shared)
static V8_WARN_UNUSED_RESULT MaybeHandle< JSReceiver > ToObjectImpl(Isolate *isolate, DirectHandle< Object > object, const char *method_name=nullptr)
static V8_WARN_UNUSED_RESULT HandleType< Object >::MaybeType ToNumeric(Isolate *isolate, HandleType< T > input)
static V8_WARN_UNUSED_RESULT MaybeHandle< Object > GetElement(Isolate *isolate, DirectHandle< JSAny > object, uint32_t index)
static char * RestoreState(Isolate *isolate, char *from)
Relocatable(Isolate *isolate)
static void Iterate(Isolate *isolate, RootVisitor *v)
virtual void PostGarbageCollection()
static int ArchiveSpacePerThread()
static void PostGarbageCollectionProcessing(Isolate *isolate)
virtual void IterateInstance(RootVisitor *v)
static char * ArchiveState(Isolate *isolate, char *to)
~SharedObjectSafePublishGuard()
V8_INLINE constexpr StorageType ptr() const
constexpr bool IsWeak() const
constexpr bool IsSmi() const
constexpr bool IsObject() const
constexpr bool IsHeapObject() const
constexpr V8_INLINE bool IsHeapObject() const
constexpr V8_INLINE bool IsSmi() const
#define HAS_WEAK_HEAP_OBJECT_TAG(value)
#define EXPORT_TEMPLATE_DECLARE(export)
#define DECL_STRUCT_PREDICATE(NAME, Name, name)
#define IS_TYPE_FUNCTION_DECL(Type)
ZoneVector< RpoNumber > & result
@ DONT_ALLOW_DOUBLE_ELEMENTS
@ ALLOW_CONVERTED_DOUBLE_ELEMENTS
@ ALLOW_COPIED_DOUBLE_ELEMENTS
static V8_INLINE bool HasWeakHeapObjectTag(const Tagged< Object > value)
bool IsNaN(Tagged< Object > obj)
@ UPDATE_EPHEMERON_KEY_WRITE_BARRIER
@ UNSAFE_SKIP_WRITE_BARRIER
bool ComparisonResultToBool(Operation op, ComparisonResult result)
bool IsNumber(Tagged< Object > obj)
bool IsAnyHole(Tagged< Object > obj, PtrComprCageBase cage_base)
V8_INLINE constexpr bool IsWeak(TaggedImpl< HeapObjectReferenceType::WEAK, StorageType > obj)
V8_INLINE constexpr bool IsSmi(TaggedImpl< kRefType, StorageType > obj)
bool IsPublicSymbol(Tagged< Object > obj)
kInterpreterTrampolineOffset Tagged< HeapObject >
@ SIMPLE_PROPERTY_TRANSITION
std::ostream & operator<<(std::ostream &os, AtomicMemoryOrder order)
const int kVariableSizeSentinel
void Print(Tagged< Object > obj)
const int kStubMinorKeyBits
ShouldThrow GetShouldThrow(Isolate *isolate, Maybe< ShouldThrow > should_throw)
bool IsShared(Tagged< Object > obj)
void ShortPrint(Tagged< Object > obj, FILE *out)
bool IsJSObjectThatCanBeTrackedAsPrototype(Tagged< Object > obj)
typename detail::FlattenUnionHelper< Union<>, Ts... >::type UnionOf
V8_INLINE constexpr bool IsObject(TaggedImpl< kRefType, StorageType > obj)
V8_INLINE constexpr bool IsHeapObject(TaggedImpl< kRefType, StorageType > obj)
V8_INLINE bool IsWasmObject(T obj, Isolate *=nullptr)
const int kStubMajorKeyBits
NameDictionary PropertyDictionary
static bool IsMinusZero(double value)
bool IsJSApiWrapperObject(Tagged< Map > map)
bool IsTaggedIndex(Tagged< Object > obj)
bool IsPrivateSymbol(Tagged< Object > obj)
bool IsNoSharedNameSentinel(Tagged< Object > obj)
static bool IsZero(const Operand &rt)
PropertyNormalizationMode
@ KEEP_INOBJECT_PROPERTIES
@ CLEAR_INOBJECT_PROPERTIES
#define HEAP_OBJECT_TYPE_LIST(V)
#define OBJECT_TYPE_LIST(V)
#define EXPORT_DECL_STATIC_VERIFIER(Name)
#define V8_EXPORT_PRIVATE
Brief(TaggedImpl< kRefType, Address > v)
bool operator()(const Tagged< Object > a, const Tagged< Object > b) const
bool operator()(const Tagged< Object > a, const Tagged< Object > b) const
size_t operator()(const Tagged< Object > o) const
bool operator()(const Tagged< Object > a, const Tagged< Object > b) const
#define V8_WARN_UNUSED_RESULT