5#ifndef V8_OBJECTS_TAGGED_H_
6#define V8_OBJECTS_TAGGED_H_
21class HeapObjectLayout;
23class TrustedObjectLayout;
90template <
typename... T>
92 :
public std::disjunction<is_maybe_weak<T>...> {};
118template <
typename Derived,
typename Base,
typename Enabled =
void>
120template <
typename Derived,
typename Base>
124template <
typename Derived,
typename Base,
typename Enabled =
void>
126template <
typename Derived,
typename Base,
typename Enabled =
void>
134template <
typename Derived,
typename Base,
typename Enabled>
136 :
public std::disjunction<detail::is_simple_subtype<Derived, Base>,
137 detail::is_complex_subtype<Derived, Base>> {};
160template <
typename Derived,
typename Base,
typename Enabled>
162template <
typename Derived,
typename Base>
186 :
public std::true_type {};
197 :
public std::true_type {};
200 :
public std::true_type {};
203 :
public std::true_type {};
211template <
typename Derived,
typename... BaseTs>
213 :
public std::disjunction<is_simple_subtype<Derived, BaseTs>...> {};
214template <
typename... DerivedTs,
typename Base>
216 :
public std::conjunction<is_simple_subtype<DerivedTs, Base>...> {};
217template <
typename... DerivedTs,
typename... BaseTs>
219 :
public std::conjunction<
220 is_simple_subtype<DerivedTs, Union<BaseTs...>>...> {};
221template <
typename... Ts>
227#define DEF_FIXED_ARRAY_SUBTYPE(Subtype) \
229 struct is_simple_subtype<Subtype, FixedArrayBase> : public std::true_type { \
242#undef DEF_FIXED_ARRAY_SUBTYPE
251template <
typename Derived,
typename Base,
typename Enabled>
253template <
typename Derived,
typename Base>
257template <
typename Derived>
260 std::enable_if_t<std::conjunction_v<std::negation<is_union<Derived>>,
261 is_subtype<Derived, HeapObject>>>>
262 :
public std::true_type {};
263template <
typename Derived>
265 std::enable_if_t<std::disjunction_v<
266 std::is_base_of<HeapObject, Derived>,
267 std::is_base_of<HeapObjectLayout, Derived>>>>
268 :
public std::true_type {};
270template <
typename Derived>
272 std::enable_if_t<std::disjunction_v<
273 std::is_base_of<TrustedObject, Derived>,
274 std::is_base_of<TrustedObjectLayout, Derived>>>>
275 :
public std::true_type {};
278template <
typename Derived>
280 std::enable_if_t<std::disjunction_v<
281 std::is_base_of<Struct, Derived>,
282 std::is_base_of<StructLayout, Derived>>>>
283 :
public std::true_type {};
285template <
typename Derived,
typename... BaseTs>
287 :
public std::disjunction<is_subtype<Derived, BaseTs>...> {};
288template <
typename... DerivedTs,
typename Base>
290 :
public std::conjunction<is_subtype<DerivedTs, Base>...> {};
291template <
typename... DerivedTs,
typename... BaseTs>
293 :
public std::conjunction<is_subtype<DerivedTs, Union<BaseTs...>>...> {};
294template <
typename Derived,
typename Base>
297 std::enable_if_t<!is_union_v<Derived> && !is_maybe_weak_v<Derived>>>
299template <
typename Derived,
typename Base>
321template <
typename From,
typename To>
324template <
typename From,
typename To>
361template <
typename... T>
363 template <
typename U>
365 std::disjunction<std::is_same<U, Smi>, std::is_same<U, Object>,
366 std::is_same<U, TaggedIndex>,
367 std::is_same<U, FieldType>>;
369 using type = std::conditional_t<
371 std::conditional_t<std::disjunction_v<is_non_heap_object<T>...>,
410 return *
this =
Tagged(other);
460#ifdef V8_ENABLE_DIRECT_HANDLE
463 template <
typename TFieldType,
int kFieldOffset,
typename CompressionScheme>
484 template <
typename U>
488 return *
this =
Tagged(other);
492 template <
typename U>
512 template <
typename U>
515 requires(std::is_base_of_v<HeapObject, U>)
519 template <
typename U>
534#ifdef V8_ENABLE_DIRECT_HANDLE
537 template <
typename TFieldType,
int kFieldOffset,
typename CompressionScheme>
539 template <
typename To,
typename From>
580 return *
this =
Tagged(other);
583 return *
this =
Tagged(other);
604 template <
typename U>
608 return *
this =
Tagged(other);
612 template <
typename U>
618 template <
typename U>
620 HeapObjectReferenceType type)
638#ifdef V8_ENABLE_DIRECT_HANDLE
641 template <
typename TFieldType,
int kFieldOffset,
typename CompressionScheme>
643 template <
typename To,
typename From>
653template <
typename... Ts>
662 template <
typename U>
671 template <
typename U>
679 template <
typename U>
689 friend class Handle<This>;
690#ifdef V8_ENABLE_DIRECT_HANDLE
693 template <
typename TFieldType,
int kFieldOffset,
typename CompressionScheme>
695 template <
typename TFieldType,
typename CompressionScheme>
697 template <
typename To,
typename From>
707class Tagged :
public detail::BaseForTagged<T>::type {
712 template <
typename U = T>
719 static_assert(std::is_base_of_v<HeapObjectLayout, U>);
723 template <
typename U>
732 template <
typename U>
753 template <
typename U>
760 template <
typename U>
770#ifdef V8_ENABLE_DIRECT_HANDLE
773 template <
typename TFieldType,
int kFieldOffset,
typename CompressionScheme>
775 template <
typename TFieldType,
typename CompressionScheme>
777 template <
typename To,
typename From>
808 template <
typename U = T>
818 template <
typename U = T>
825 return T(this->
ptr(),
typename T::SkipTypeCheckTag{});
848 template <
typename U = T>
855 static_assert(std::is_base_of_v<HeapObjectLayout, U>);
859 template <
typename U>
868 template <
typename U>
880#ifdef V8_ENABLE_DIRECT_HANDLE
885 template <
typename To,
typename From>
948struct common_type<T,
i::Object> {
950 "common_type with Object is only partially specialized.");
static V8_INLINE constexpr int SmiValue(Address value)
V8_INLINE constexpr Address ptr() const
V8_INLINE Tagged(Address ptr)
V8_INLINE constexpr bool is_null() const
constexpr V8_INLINE bool IsHeapObject() const
static constexpr Tagged< HeapObject > cast(U other)
V8_INLINE constexpr Tagged(Tagged< U > other)
constexpr V8_INLINE bool IsSmi() const
V8_INLINE constexpr Tagged(Address ptr)
V8_INLINE constexpr Tagged & operator=(Tagged< U > other)
V8_INLINE Tagged(const HeapObjectLayout *ptr)
V8_INLINE constexpr Tagged()=default
V8_INLINE constexpr Tagged & operator=(Tagged< U > other)
constexpr V8_INLINE bool IsSmi() const
V8_INLINE Tagged(const HeapObjectLayout *ptr)
V8_INLINE constexpr bool is_null() const
V8_INLINE constexpr Tagged(Tagged< U > other)
V8_INLINE constexpr Tagged(Tagged< U > other, HeapObjectReferenceType type)
V8_INLINE constexpr Tagged()=default
V8_INLINE Tagged(const HeapObjectLayout *ptr)
V8_INLINE constexpr Tagged(StrongTaggedBase other)
V8_INLINE constexpr Tagged()
V8_INLINE constexpr Tagged & operator=(StrongTaggedBase other)
V8_INLINE constexpr Tagged & operator=(WeakTaggedBase other)
V8_INLINE constexpr Tagged(Address o)
V8_INLINE constexpr Tagged(WeakTaggedBase other)
typename detail::BaseForTagged< MaybeWeak< T > >::type Base
V8_INLINE constexpr Tagged(Address ptr)
V8_INLINE constexpr Tagged(Tagged< U > other)
V8_INLINE Tagged(const T *ptr)
V8_INLINE constexpr Tagged & operator=(Tagged< U > other)
V8_INLINE constexpr Tagged()=default
V8_INLINE constexpr Tagged()
V8_INLINE constexpr Tagged(StrongTaggedBase other)
V8_INLINE Tagged(const HeapObjectLayout *ptr)
V8_INLINE constexpr Tagged(Address o)
V8_INLINE constexpr Tagged & operator=(StrongTaggedBase other)
V8_INLINE constexpr bool IsHeapObject() const
V8_INLINE constexpr Tagged(Address ptr)
V8_INLINE constexpr Tagged()=default
V8_INLINE constexpr bool IsSmi() const
V8_INLINE constexpr int32_t value() const
V8_INLINE constexpr intptr_t value() const
V8_INLINE constexpr bool IsHeapObject() const
V8_INLINE constexpr Tagged()=default
V8_INLINE constexpr Tagged(Address ptr)
V8_INLINE constexpr bool IsSmi() const
V8_INLINE constexpr Tagged(Tagged< U > other)
typename detail::BaseForTagged< This >::type Base
V8_INLINE constexpr Tagged()=default
V8_INLINE constexpr Tagged(Address ptr)
V8_INLINE constexpr Tagged & operator=(Tagged< U > other)
friend Tagged< T > MakeStrong(Tagged< T > value)
V8_INLINE constexpr detail::TaggedOperatorArrowRef< T > operator_arrow_impl() const
V8_INLINE constexpr Tagged(Address ptr)
V8_INLINE constexpr T operator_star_impl() const
V8_INLINE constexpr Tagged(U raw)
V8_INLINE T * operator_arrow_impl() const
V8_INLINE T * ToRawPtr() const
static constexpr Tagged< T > cast(U other)
V8_INLINE constexpr Tagged(Tagged< U > other)
V8_INLINE T & operator_star_impl() const
V8_INLINE constexpr decltype(auto) operator*() const
friend Tagged< To > UncheckedCast(Tagged< From > value)
V8_INLINE constexpr Tagged & operator=(Tagged< U > other)
V8_INLINE constexpr decltype(auto) operator->() const
V8_INLINE constexpr T ToRawPtr() const
V8_INLINE constexpr Tagged()=default
V8_INLINE Tagged(const T *ptr)
typename detail::BaseForTagged< T >::type Base
V8_INLINE constexpr T * operator->()
V8_INLINE constexpr TaggedOperatorArrowRef(T object)
static constexpr bool is_complex_subtype_v
static constexpr bool is_simple_subtype_v
std::disjunction< is_subtype< To, From >, is_subtype< From, To > > is_castable
Tagged< T > MakeStrong(Tagged< T > value)
static constexpr bool is_maybe_weak_v
TaggedImpl< HeapObjectReferenceType::WEAK, Address > WeakTaggedBase
Tagged(T object) -> Tagged< T >
static constexpr bool kTaggedCanConvertToRawObjects
kInterpreterTrampolineOffset Tagged< HeapObject >
static constexpr bool is_taggable_v
static constexpr bool is_subtype_v
static constexpr bool is_castable_v
const int kWeakHeapObjectTag
TaggedImpl< HeapObjectReferenceType::STRONG, Address > StrongTaggedBase
Tagged< MaybeWeak< T > > MakeWeak(Tagged< T > value)
static constexpr Address kNullAddress
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
std::conditional_t< std::disjunction_v< is_maybe_weak< T >... >, WeakTaggedBase, std::conditional_t< std::disjunction_v< is_non_heap_object< T >... >, Tagged< Object >, Tagged< HeapObject > > > type
std::disjunction< std::is_same< U, Smi >, std::is_same< U, Object >, std::is_same< U, TaggedIndex >, std::is_same< U, FieldType > > is_non_heap_object
#define DEF_FIXED_ARRAY_SUBTYPE(Subtype)