cppgc: Introduce subtle::UncompressedMember
Some very hot getters in Blink can spend many cycles on decompression. We're planning to optimize such paths by selectively using uncompressed pointers. Change-Id: I78af751c423c56010a794448450032c66f8fa244 Bug: chromium:1410145 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4191778 Commit-Queue: Anton Bikineev <bikineev@chromium.org> Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/main@{#85508}
This commit is contained in:
parent
fa303fcd0b
commit
02afcd6b05
@ -148,10 +148,11 @@ class BasicCrossThreadPersistent final : public CrossThreadPersistentBase,
|
||||
|
||||
template <typename U, typename MemberBarrierPolicy,
|
||||
typename MemberWeaknessTag, typename MemberCheckingPolicy,
|
||||
typename MemberStorageType,
|
||||
typename = std::enable_if_t<std::is_base_of<T, U>::value>>
|
||||
BasicCrossThreadPersistent(
|
||||
internal::BasicMember<U, MemberBarrierPolicy, MemberWeaknessTag,
|
||||
MemberCheckingPolicy>
|
||||
MemberCheckingPolicy, MemberStorageType>
|
||||
member,
|
||||
const SourceLocation& loc = SourceLocation::Current())
|
||||
: BasicCrossThreadPersistent(member.Get(), loc) {}
|
||||
@ -230,10 +231,11 @@ class BasicCrossThreadPersistent final : public CrossThreadPersistentBase,
|
||||
// Assignment from member.
|
||||
template <typename U, typename MemberBarrierPolicy,
|
||||
typename MemberWeaknessTag, typename MemberCheckingPolicy,
|
||||
typename MemberStorageType,
|
||||
typename = std::enable_if_t<std::is_base_of<T, U>::value>>
|
||||
BasicCrossThreadPersistent& operator=(
|
||||
internal::BasicMember<U, MemberBarrierPolicy, MemberWeaknessTag,
|
||||
MemberCheckingPolicy>
|
||||
MemberCheckingPolicy, MemberStorageType>
|
||||
member) {
|
||||
return operator=(member.Get());
|
||||
}
|
||||
|
@ -62,10 +62,10 @@ class HeapConsistency final {
|
||||
* \returns whether a write barrier is needed and which barrier to invoke.
|
||||
*/
|
||||
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
||||
typename CheckingPolicy>
|
||||
typename CheckingPolicy, typename StorageType>
|
||||
static V8_INLINE WriteBarrierType GetWriteBarrierType(
|
||||
const internal::BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
||||
CheckingPolicy>& value,
|
||||
CheckingPolicy, StorageType>& value,
|
||||
WriteBarrierParams& params) {
|
||||
return internal::WriteBarrier::GetWriteBarrierType(
|
||||
value.GetRawSlot(), value.GetRawStorage(), params);
|
||||
|
@ -225,9 +225,9 @@ class V8_TRIVIAL_ABI RawPointer final {
|
||||
};
|
||||
|
||||
#if defined(CPPGC_POINTER_COMPRESSION)
|
||||
using MemberStorage = CompressedPointer;
|
||||
using DefaultMemberStorage = CompressedPointer;
|
||||
#else // !defined(CPPGC_POINTER_COMPRESSION)
|
||||
using MemberStorage = RawPointer;
|
||||
using DefaultMemberStorage = RawPointer;
|
||||
#endif // !defined(CPPGC_POINTER_COMPRESSION)
|
||||
|
||||
} // namespace internal
|
||||
|
@ -45,6 +45,7 @@ struct DijkstraWriteBarrierPolicy {
|
||||
#endif // !CPPGC_SLIM_WRITE_BARRIER
|
||||
}
|
||||
|
||||
template <typename MemberStorage>
|
||||
V8_INLINE static void AssigningBarrier(const void* slot,
|
||||
MemberStorage storage) {
|
||||
#ifdef CPPGC_SLIM_WRITE_BARRIER
|
||||
@ -79,6 +80,7 @@ struct DijkstraWriteBarrierPolicy {
|
||||
struct NoWriteBarrierPolicy {
|
||||
V8_INLINE static void InitializingBarrier(const void*, const void*) {}
|
||||
V8_INLINE static void AssigningBarrier(const void*, const void*) {}
|
||||
template <typename MemberStorage>
|
||||
V8_INLINE static void AssigningBarrier(const void*, MemberStorage) {}
|
||||
};
|
||||
|
||||
@ -207,7 +209,8 @@ template <typename T, typename WeaknessPolicy,
|
||||
typename CheckingPolicy = DefaultPersistentCheckingPolicy>
|
||||
class BasicPersistent;
|
||||
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
||||
typename CheckingPolicy = DefaultMemberCheckingPolicy>
|
||||
typename CheckingPolicy = DefaultMemberCheckingPolicy,
|
||||
typename StorageType = DefaultMemberStorage>
|
||||
class BasicMember;
|
||||
|
||||
} // namespace internal
|
||||
|
@ -70,6 +70,7 @@ class V8_EXPORT WriteBarrier final {
|
||||
static V8_INLINE Type GetWriteBarrierType(const void* slot, const void* value,
|
||||
Params& params);
|
||||
// Returns the required write barrier for a given `slot` and `value`.
|
||||
template <typename MemberStorage>
|
||||
static V8_INLINE Type GetWriteBarrierType(const void* slot, MemberStorage,
|
||||
Params& params);
|
||||
// Returns the required write barrier for a given `slot`.
|
||||
@ -171,7 +172,8 @@ class V8_EXPORT WriteBarrierTypeForCagedHeapPolicy final {
|
||||
return ValueModeDispatch<value_mode>::Get(slot, value, params, callback);
|
||||
}
|
||||
|
||||
template <WriteBarrier::ValueMode value_mode, typename HeapHandleCallback>
|
||||
template <WriteBarrier::ValueMode value_mode, typename HeapHandleCallback,
|
||||
typename MemberStorage>
|
||||
static V8_INLINE WriteBarrier::Type Get(const void* slot, MemberStorage value,
|
||||
WriteBarrier::Params& params,
|
||||
HeapHandleCallback callback) {
|
||||
@ -215,7 +217,7 @@ class V8_EXPORT WriteBarrierTypeForCagedHeapPolicy final {
|
||||
template <>
|
||||
struct WriteBarrierTypeForCagedHeapPolicy::ValueModeDispatch<
|
||||
WriteBarrier::ValueMode::kValuePresent> {
|
||||
template <typename HeapHandleCallback>
|
||||
template <typename HeapHandleCallback, typename MemberStorage>
|
||||
static V8_INLINE WriteBarrier::Type Get(const void* slot,
|
||||
MemberStorage storage,
|
||||
WriteBarrier::Params& params,
|
||||
@ -313,11 +315,9 @@ class V8_EXPORT WriteBarrierTypeForNonCagedHeapPolicy final {
|
||||
}
|
||||
|
||||
template <WriteBarrier::ValueMode value_mode, typename HeapHandleCallback>
|
||||
static V8_INLINE WriteBarrier::Type Get(const void* slot, MemberStorage value,
|
||||
static V8_INLINE WriteBarrier::Type Get(const void* slot, RawPointer value,
|
||||
WriteBarrier::Params& params,
|
||||
HeapHandleCallback callback) {
|
||||
// `MemberStorage` will always be `RawPointer` for non-caged heap builds.
|
||||
// Just convert to `void*` in this case.
|
||||
return ValueModeDispatch<value_mode>::Get(slot, value.Load(), params,
|
||||
callback);
|
||||
}
|
||||
@ -391,6 +391,7 @@ WriteBarrier::Type WriteBarrier::GetWriteBarrierType(
|
||||
}
|
||||
|
||||
// static
|
||||
template <typename MemberStorage>
|
||||
WriteBarrier::Type WriteBarrier::GetWriteBarrierType(
|
||||
const void* slot, MemberStorage value, WriteBarrier::Params& params) {
|
||||
return WriteBarrierTypePolicy::Get<ValueMode::kValuePresent>(slot, value,
|
||||
|
@ -28,13 +28,11 @@ namespace internal {
|
||||
|
||||
// MemberBase always refers to the object as const object and defers to
|
||||
// BasicMember on casting to the right type as needed.
|
||||
template <typename StorageType>
|
||||
class V8_TRIVIAL_ABI MemberBase {
|
||||
public:
|
||||
#if defined(CPPGC_POINTER_COMPRESSION)
|
||||
using RawStorage = CompressedPointer;
|
||||
#else // !defined(CPPGC_POINTER_COMPRESSION)
|
||||
using RawStorage = RawPointer;
|
||||
#endif // !defined(CPPGC_POINTER_COMPRESSION)
|
||||
using RawStorage = StorageType;
|
||||
|
||||
protected:
|
||||
struct AtomicInitializerTag {};
|
||||
|
||||
@ -75,16 +73,19 @@ class V8_TRIVIAL_ABI MemberBase {
|
||||
|
||||
// The basic class from which all Member classes are 'generated'.
|
||||
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
||||
typename CheckingPolicy>
|
||||
class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
||||
typename CheckingPolicy, typename StorageType>
|
||||
class V8_TRIVIAL_ABI BasicMember final : private MemberBase<StorageType>,
|
||||
private CheckingPolicy {
|
||||
using Base = MemberBase<StorageType>;
|
||||
|
||||
public:
|
||||
using PointeeType = T;
|
||||
using RawStorage = typename Base::RawStorage;
|
||||
|
||||
V8_INLINE constexpr BasicMember() = default;
|
||||
V8_INLINE constexpr BasicMember(std::nullptr_t) {} // NOLINT
|
||||
V8_INLINE BasicMember(SentinelPointer s) : MemberBase(s) {} // NOLINT
|
||||
V8_INLINE BasicMember(T* raw) : MemberBase(raw) { // NOLINT
|
||||
V8_INLINE constexpr BasicMember(std::nullptr_t) {} // NOLINT
|
||||
V8_INLINE BasicMember(SentinelPointer s) : Base(s) {} // NOLINT
|
||||
V8_INLINE BasicMember(T* raw) : Base(raw) { // NOLINT
|
||||
InitializingWriteBarrier(raw);
|
||||
this->CheckPointer(Get());
|
||||
}
|
||||
@ -94,13 +95,13 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
||||
// Atomic ctor. Using the AtomicInitializerTag forces BasicMember to
|
||||
// initialize using atomic assignments. This is required for preventing
|
||||
// data races with concurrent marking.
|
||||
using AtomicInitializerTag = MemberBase::AtomicInitializerTag;
|
||||
using AtomicInitializerTag = typename Base::AtomicInitializerTag;
|
||||
V8_INLINE BasicMember(std::nullptr_t, AtomicInitializerTag atomic)
|
||||
: MemberBase(nullptr, atomic) {}
|
||||
: Base(nullptr, atomic) {}
|
||||
V8_INLINE BasicMember(SentinelPointer s, AtomicInitializerTag atomic)
|
||||
: MemberBase(s, atomic) {}
|
||||
: Base(s, atomic) {}
|
||||
V8_INLINE BasicMember(T* raw, AtomicInitializerTag atomic)
|
||||
: MemberBase(raw, atomic) {
|
||||
: Base(raw, atomic) {
|
||||
InitializingWriteBarrier(raw);
|
||||
this->CheckPointer(Get());
|
||||
}
|
||||
@ -119,7 +120,7 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
||||
std::enable_if_t<internal::IsDecayedSameV<T, U>>* = nullptr>
|
||||
V8_INLINE BasicMember( // NOLINT
|
||||
const BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
|
||||
OtherCheckingPolicy>& other)
|
||||
OtherCheckingPolicy, StorageType>& other)
|
||||
: BasicMember(other.GetRawStorage()) {}
|
||||
|
||||
template <typename U, typename OtherBarrierPolicy, typename OtherWeaknessTag,
|
||||
@ -127,7 +128,7 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
||||
std::enable_if_t<internal::IsStrictlyBaseOfV<T, U>>* = nullptr>
|
||||
V8_INLINE BasicMember( // NOLINT
|
||||
const BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
|
||||
OtherCheckingPolicy>& other)
|
||||
OtherCheckingPolicy, StorageType>& other)
|
||||
: BasicMember(other.Get()) {}
|
||||
|
||||
// Move ctor.
|
||||
@ -142,8 +143,9 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
||||
template <typename U, typename OtherBarrierPolicy, typename OtherWeaknessTag,
|
||||
typename OtherCheckingPolicy,
|
||||
std::enable_if_t<internal::IsDecayedSameV<T, U>>* = nullptr>
|
||||
V8_INLINE BasicMember(BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
|
||||
OtherCheckingPolicy>&& other) noexcept
|
||||
V8_INLINE BasicMember(
|
||||
BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy, OtherCheckingPolicy,
|
||||
StorageType>&& other) noexcept
|
||||
: BasicMember(other.GetRawStorage()) {
|
||||
other.Clear();
|
||||
}
|
||||
@ -151,8 +153,9 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
||||
template <typename U, typename OtherBarrierPolicy, typename OtherWeaknessTag,
|
||||
typename OtherCheckingPolicy,
|
||||
std::enable_if_t<internal::IsStrictlyBaseOfV<T, U>>* = nullptr>
|
||||
V8_INLINE BasicMember(BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
|
||||
OtherCheckingPolicy>&& other) noexcept
|
||||
V8_INLINE BasicMember(
|
||||
BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy, OtherCheckingPolicy,
|
||||
StorageType>&& other) noexcept
|
||||
: BasicMember(other.Get()) {
|
||||
other.Clear();
|
||||
}
|
||||
@ -179,7 +182,7 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
||||
typename OtherCheckingPolicy>
|
||||
V8_INLINE BasicMember& operator=(
|
||||
const BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
|
||||
OtherCheckingPolicy>& other) {
|
||||
OtherCheckingPolicy, StorageType>& other) {
|
||||
if constexpr (internal::IsDecayedSameV<T, U>) {
|
||||
return operator=(other.GetRawStorage());
|
||||
} else {
|
||||
@ -201,8 +204,8 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
||||
template <typename U, typename OtherWeaknessTag, typename OtherBarrierPolicy,
|
||||
typename OtherCheckingPolicy>
|
||||
V8_INLINE BasicMember& operator=(
|
||||
BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
|
||||
OtherCheckingPolicy>&& other) noexcept {
|
||||
BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy, OtherCheckingPolicy,
|
||||
StorageType>&& other) noexcept {
|
||||
if constexpr (internal::IsDecayedSameV<T, U>) {
|
||||
operator=(other.GetRawStorage());
|
||||
} else {
|
||||
@ -226,7 +229,7 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
||||
}
|
||||
|
||||
V8_INLINE BasicMember& operator=(T* other) {
|
||||
SetRawAtomic(other);
|
||||
Base::SetRawAtomic(other);
|
||||
AssigningWriteBarrier(other);
|
||||
this->CheckPointer(Get());
|
||||
return *this;
|
||||
@ -237,20 +240,20 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
||||
return *this;
|
||||
}
|
||||
V8_INLINE BasicMember& operator=(SentinelPointer s) {
|
||||
SetRawAtomic(s);
|
||||
Base::SetRawAtomic(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename OtherWeaknessTag, typename OtherBarrierPolicy,
|
||||
typename OtherCheckingPolicy>
|
||||
V8_INLINE void Swap(BasicMember<T, OtherWeaknessTag, OtherBarrierPolicy,
|
||||
OtherCheckingPolicy>& other) {
|
||||
OtherCheckingPolicy, StorageType>& other) {
|
||||
auto tmp = GetRawStorage();
|
||||
*this = other;
|
||||
other = tmp;
|
||||
}
|
||||
|
||||
V8_INLINE explicit operator bool() const { return !IsCleared(); }
|
||||
V8_INLINE explicit operator bool() const { return !Base::IsCleared(); }
|
||||
V8_INLINE operator T*() const { return Get(); }
|
||||
V8_INLINE T* operator->() const { return Get(); }
|
||||
V8_INLINE T& operator*() const { return *Get(); }
|
||||
@ -264,10 +267,12 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
||||
// The const_cast below removes the constness from MemberBase storage. The
|
||||
// following static_cast re-adds any constness if specified through the
|
||||
// user-visible template parameter T.
|
||||
return static_cast<T*>(const_cast<void*>(MemberBase::GetRaw()));
|
||||
return static_cast<T*>(const_cast<void*>(Base::GetRaw()));
|
||||
}
|
||||
|
||||
V8_INLINE void Clear() { SetRawStorageAtomic(RawStorage{}); }
|
||||
V8_INLINE void Clear() {
|
||||
Base::SetRawStorageAtomic(RawStorage{});
|
||||
}
|
||||
|
||||
V8_INLINE T* Release() {
|
||||
T* result = Get();
|
||||
@ -276,41 +281,42 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
||||
}
|
||||
|
||||
V8_INLINE const T** GetSlotForTesting() const {
|
||||
return reinterpret_cast<const T**>(GetRawSlot());
|
||||
return reinterpret_cast<const T**>(Base::GetRawSlot());
|
||||
}
|
||||
|
||||
V8_INLINE RawStorage GetRawStorage() const {
|
||||
return MemberBase::GetRawStorage();
|
||||
return Base::GetRawStorage();
|
||||
}
|
||||
|
||||
private:
|
||||
V8_INLINE explicit BasicMember(RawStorage raw) : MemberBase(raw) {
|
||||
V8_INLINE explicit BasicMember(RawStorage raw) : Base(raw) {
|
||||
InitializingWriteBarrier(Get());
|
||||
this->CheckPointer(Get());
|
||||
}
|
||||
|
||||
V8_INLINE BasicMember& operator=(RawStorage other) {
|
||||
SetRawStorageAtomic(other);
|
||||
Base::SetRawStorageAtomic(other);
|
||||
AssigningWriteBarrier();
|
||||
this->CheckPointer(Get());
|
||||
return *this;
|
||||
}
|
||||
|
||||
V8_INLINE const T* GetRawAtomic() const {
|
||||
return static_cast<const T*>(MemberBase::GetRawAtomic());
|
||||
return static_cast<const T*>(Base::GetRawAtomic());
|
||||
}
|
||||
|
||||
V8_INLINE void InitializingWriteBarrier(T* value) const {
|
||||
WriteBarrierPolicy::InitializingBarrier(GetRawSlot(), value);
|
||||
WriteBarrierPolicy::InitializingBarrier(Base::GetRawSlot(), value);
|
||||
}
|
||||
V8_INLINE void AssigningWriteBarrier(T* value) const {
|
||||
WriteBarrierPolicy::AssigningBarrier(GetRawSlot(), value);
|
||||
WriteBarrierPolicy::AssigningBarrier(Base::GetRawSlot(), value);
|
||||
}
|
||||
V8_INLINE void AssigningWriteBarrier() const {
|
||||
WriteBarrierPolicy::AssigningBarrier(GetRawSlot(), GetRawStorage());
|
||||
WriteBarrierPolicy::AssigningBarrier(Base::GetRawSlot(),
|
||||
Base::GetRawStorage());
|
||||
}
|
||||
|
||||
V8_INLINE void ClearFromGC() const { MemberBase::ClearFromGC(); }
|
||||
V8_INLINE void ClearFromGC() const { Base::ClearFromGC(); }
|
||||
|
||||
V8_INLINE T* GetFromGC() const { return Get(); }
|
||||
|
||||
@ -319,19 +325,20 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
||||
template <typename U>
|
||||
friend struct cppgc::TraceTrait;
|
||||
template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
|
||||
typename CheckingPolicy1>
|
||||
typename CheckingPolicy1, typename StorageType1>
|
||||
friend class BasicMember;
|
||||
};
|
||||
|
||||
// Member equality operators.
|
||||
template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
|
||||
typename CheckingPolicy1, typename T2, typename WeaknessTag2,
|
||||
typename WriteBarrierPolicy2, typename CheckingPolicy2>
|
||||
typename WriteBarrierPolicy2, typename CheckingPolicy2,
|
||||
typename StorageType>
|
||||
V8_INLINE bool operator==(
|
||||
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1>&
|
||||
member1,
|
||||
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2>&
|
||||
member2) {
|
||||
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1,
|
||||
StorageType>& member1,
|
||||
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2,
|
||||
StorageType>& member2) {
|
||||
if constexpr (internal::IsDecayedSameV<T1, T2>) {
|
||||
// Check compressed pointers if types are the same.
|
||||
return member1.GetRawStorage() == member2.GetRawStorage();
|
||||
@ -345,31 +352,32 @@ V8_INLINE bool operator==(
|
||||
|
||||
template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
|
||||
typename CheckingPolicy1, typename T2, typename WeaknessTag2,
|
||||
typename WriteBarrierPolicy2, typename CheckingPolicy2>
|
||||
typename WriteBarrierPolicy2, typename CheckingPolicy2,
|
||||
typename StorageType>
|
||||
V8_INLINE bool operator!=(
|
||||
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1>&
|
||||
member1,
|
||||
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2>&
|
||||
member2) {
|
||||
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1,
|
||||
StorageType>& member1,
|
||||
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2,
|
||||
StorageType>& member2) {
|
||||
return !(member1 == member2);
|
||||
}
|
||||
|
||||
// Equality with raw pointers.
|
||||
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
||||
typename CheckingPolicy, typename U>
|
||||
V8_INLINE bool operator==(const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
||||
CheckingPolicy>& member,
|
||||
U* raw) {
|
||||
typename CheckingPolicy, typename StorageType, typename U>
|
||||
V8_INLINE bool operator==(
|
||||
const BasicMember<T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy,
|
||||
StorageType>& member,
|
||||
U* raw) {
|
||||
// Never allow comparison with erased pointers.
|
||||
static_assert(!internal::IsDecayedSameV<void, U>);
|
||||
|
||||
if constexpr (internal::IsDecayedSameV<T, U>) {
|
||||
// Check compressed pointers if types are the same.
|
||||
return member.GetRawStorage() == MemberBase::RawStorage(raw);
|
||||
return member.GetRawStorage() == StorageType(raw);
|
||||
} else if constexpr (internal::IsStrictlyBaseOfV<T, U>) {
|
||||
// Cast the raw pointer to T, which may adjust the pointer.
|
||||
return member.GetRawStorage() ==
|
||||
MemberBase::RawStorage(static_cast<T*>(raw));
|
||||
return member.GetRawStorage() == StorageType(static_cast<T*>(raw));
|
||||
} else {
|
||||
// Otherwise, decompressed the member.
|
||||
return member.Get() == raw;
|
||||
@ -377,104 +385,112 @@ V8_INLINE bool operator==(const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
||||
}
|
||||
|
||||
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
||||
typename CheckingPolicy, typename U>
|
||||
V8_INLINE bool operator!=(const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
||||
CheckingPolicy>& member,
|
||||
U* raw) {
|
||||
typename CheckingPolicy, typename StorageType, typename U>
|
||||
V8_INLINE bool operator!=(
|
||||
const BasicMember<T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy,
|
||||
StorageType>& member,
|
||||
U* raw) {
|
||||
return !(member == raw);
|
||||
}
|
||||
|
||||
template <typename T, typename U, typename WeaknessTag,
|
||||
typename WriteBarrierPolicy, typename CheckingPolicy>
|
||||
V8_INLINE bool operator==(T* raw,
|
||||
const BasicMember<U, WeaknessTag, WriteBarrierPolicy,
|
||||
CheckingPolicy>& member) {
|
||||
typename WriteBarrierPolicy, typename CheckingPolicy,
|
||||
typename StorageType>
|
||||
V8_INLINE bool operator==(
|
||||
T* raw, const BasicMember<U, WeaknessTag, WriteBarrierPolicy,
|
||||
CheckingPolicy, StorageType>& member) {
|
||||
return member == raw;
|
||||
}
|
||||
|
||||
template <typename T, typename U, typename WeaknessTag,
|
||||
typename WriteBarrierPolicy, typename CheckingPolicy>
|
||||
V8_INLINE bool operator!=(T* raw,
|
||||
const BasicMember<U, WeaknessTag, WriteBarrierPolicy,
|
||||
CheckingPolicy>& member) {
|
||||
typename WriteBarrierPolicy, typename CheckingPolicy,
|
||||
typename StorageType>
|
||||
V8_INLINE bool operator!=(
|
||||
T* raw, const BasicMember<U, WeaknessTag, WriteBarrierPolicy,
|
||||
CheckingPolicy, StorageType>& member) {
|
||||
return !(raw == member);
|
||||
}
|
||||
|
||||
// Equality with sentinel.
|
||||
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
||||
typename CheckingPolicy>
|
||||
V8_INLINE bool operator==(const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
||||
CheckingPolicy>& member,
|
||||
SentinelPointer) {
|
||||
typename CheckingPolicy, typename StorageType>
|
||||
V8_INLINE bool operator==(
|
||||
const BasicMember<T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy,
|
||||
StorageType>& member,
|
||||
SentinelPointer) {
|
||||
return member.GetRawStorage().IsSentinel();
|
||||
}
|
||||
|
||||
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
||||
typename CheckingPolicy>
|
||||
V8_INLINE bool operator!=(const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
||||
CheckingPolicy>& member,
|
||||
SentinelPointer s) {
|
||||
typename CheckingPolicy, typename StorageType>
|
||||
V8_INLINE bool operator!=(
|
||||
const BasicMember<T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy,
|
||||
StorageType>& member,
|
||||
SentinelPointer s) {
|
||||
return !(member == s);
|
||||
}
|
||||
|
||||
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
||||
typename CheckingPolicy>
|
||||
V8_INLINE bool operator==(SentinelPointer s,
|
||||
const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
||||
CheckingPolicy>& member) {
|
||||
typename CheckingPolicy, typename StorageType>
|
||||
V8_INLINE bool operator==(
|
||||
SentinelPointer s, const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
||||
CheckingPolicy, StorageType>& member) {
|
||||
return member == s;
|
||||
}
|
||||
|
||||
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
||||
typename CheckingPolicy>
|
||||
V8_INLINE bool operator!=(SentinelPointer s,
|
||||
const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
||||
CheckingPolicy>& member) {
|
||||
typename CheckingPolicy, typename StorageType>
|
||||
V8_INLINE bool operator!=(
|
||||
SentinelPointer s, const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
||||
CheckingPolicy, StorageType>& member) {
|
||||
return !(s == member);
|
||||
}
|
||||
|
||||
// Equality with nullptr.
|
||||
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
||||
typename CheckingPolicy>
|
||||
V8_INLINE bool operator==(const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
||||
CheckingPolicy>& member,
|
||||
std::nullptr_t) {
|
||||
typename CheckingPolicy, typename StorageType>
|
||||
V8_INLINE bool operator==(
|
||||
const BasicMember<T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy,
|
||||
StorageType>& member,
|
||||
std::nullptr_t) {
|
||||
return !static_cast<bool>(member);
|
||||
}
|
||||
|
||||
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
||||
typename CheckingPolicy>
|
||||
V8_INLINE bool operator!=(const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
||||
CheckingPolicy>& member,
|
||||
std::nullptr_t n) {
|
||||
typename CheckingPolicy, typename StorageType>
|
||||
V8_INLINE bool operator!=(
|
||||
const BasicMember<T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy,
|
||||
StorageType>& member,
|
||||
std::nullptr_t n) {
|
||||
return !(member == n);
|
||||
}
|
||||
|
||||
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
||||
typename CheckingPolicy>
|
||||
V8_INLINE bool operator==(std::nullptr_t n,
|
||||
const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
||||
CheckingPolicy>& member) {
|
||||
typename CheckingPolicy, typename StorageType>
|
||||
V8_INLINE bool operator==(
|
||||
std::nullptr_t n, const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
||||
CheckingPolicy, StorageType>& member) {
|
||||
return member == n;
|
||||
}
|
||||
|
||||
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
||||
typename CheckingPolicy>
|
||||
V8_INLINE bool operator!=(std::nullptr_t n,
|
||||
const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
||||
CheckingPolicy>& member) {
|
||||
typename CheckingPolicy, typename StorageType>
|
||||
V8_INLINE bool operator!=(
|
||||
std::nullptr_t n, const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
||||
CheckingPolicy, StorageType>& member) {
|
||||
return !(n == member);
|
||||
}
|
||||
|
||||
// Relational operators.
|
||||
template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
|
||||
typename CheckingPolicy1, typename T2, typename WeaknessTag2,
|
||||
typename WriteBarrierPolicy2, typename CheckingPolicy2>
|
||||
typename WriteBarrierPolicy2, typename CheckingPolicy2,
|
||||
typename StorageType>
|
||||
V8_INLINE bool operator<(
|
||||
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1>&
|
||||
member1,
|
||||
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2>&
|
||||
member2) {
|
||||
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1,
|
||||
StorageType>& member1,
|
||||
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2,
|
||||
StorageType>& member2) {
|
||||
static_assert(
|
||||
internal::IsDecayedSameV<T1, T2>,
|
||||
"Comparison works only for same pointer type modulo cv-qualifiers");
|
||||
@ -483,12 +499,13 @@ V8_INLINE bool operator<(
|
||||
|
||||
template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
|
||||
typename CheckingPolicy1, typename T2, typename WeaknessTag2,
|
||||
typename WriteBarrierPolicy2, typename CheckingPolicy2>
|
||||
typename WriteBarrierPolicy2, typename CheckingPolicy2,
|
||||
typename StorageType>
|
||||
V8_INLINE bool operator<=(
|
||||
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1>&
|
||||
member1,
|
||||
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2>&
|
||||
member2) {
|
||||
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1,
|
||||
StorageType>& member1,
|
||||
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2,
|
||||
StorageType>& member2) {
|
||||
static_assert(
|
||||
internal::IsDecayedSameV<T1, T2>,
|
||||
"Comparison works only for same pointer type modulo cv-qualifiers");
|
||||
@ -497,12 +514,13 @@ V8_INLINE bool operator<=(
|
||||
|
||||
template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
|
||||
typename CheckingPolicy1, typename T2, typename WeaknessTag2,
|
||||
typename WriteBarrierPolicy2, typename CheckingPolicy2>
|
||||
typename WriteBarrierPolicy2, typename CheckingPolicy2,
|
||||
typename StorageType>
|
||||
V8_INLINE bool operator>(
|
||||
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1>&
|
||||
member1,
|
||||
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2>&
|
||||
member2) {
|
||||
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1,
|
||||
StorageType>& member1,
|
||||
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2,
|
||||
StorageType>& member2) {
|
||||
static_assert(
|
||||
internal::IsDecayedSameV<T1, T2>,
|
||||
"Comparison works only for same pointer type modulo cv-qualifiers");
|
||||
@ -511,21 +529,23 @@ V8_INLINE bool operator>(
|
||||
|
||||
template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
|
||||
typename CheckingPolicy1, typename T2, typename WeaknessTag2,
|
||||
typename WriteBarrierPolicy2, typename CheckingPolicy2>
|
||||
typename WriteBarrierPolicy2, typename CheckingPolicy2,
|
||||
typename StorageType>
|
||||
V8_INLINE bool operator>=(
|
||||
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1>&
|
||||
member1,
|
||||
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2>&
|
||||
member2) {
|
||||
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1,
|
||||
StorageType>& member1,
|
||||
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2,
|
||||
StorageType>& member2) {
|
||||
static_assert(
|
||||
internal::IsDecayedSameV<T1, T2>,
|
||||
"Comparison works only for same pointer type modulo cv-qualifiers");
|
||||
return member1.GetRawStorage() >= member2.GetRawStorage();
|
||||
}
|
||||
|
||||
template <typename T, typename WriteBarrierPolicy, typename CheckingPolicy>
|
||||
struct IsWeak<
|
||||
internal::BasicMember<T, WeakMemberTag, WriteBarrierPolicy, CheckingPolicy>>
|
||||
template <typename T, typename WriteBarrierPolicy, typename CheckingPolicy,
|
||||
typename StorageType>
|
||||
struct IsWeak<internal::BasicMember<T, WeakMemberTag, WriteBarrierPolicy,
|
||||
CheckingPolicy, StorageType>>
|
||||
: std::true_type {};
|
||||
|
||||
} // namespace internal
|
||||
@ -536,8 +556,9 @@ struct IsWeak<
|
||||
* trace method.
|
||||
*/
|
||||
template <typename T>
|
||||
using Member = internal::BasicMember<T, internal::StrongMemberTag,
|
||||
internal::DijkstraWriteBarrierPolicy>;
|
||||
using Member = internal::BasicMember<
|
||||
T, internal::StrongMemberTag, internal::DijkstraWriteBarrierPolicy,
|
||||
internal::DefaultMemberCheckingPolicy, internal::DefaultMemberStorage>;
|
||||
|
||||
/**
|
||||
* WeakMember is similar to Member in that it is used to point to other garbage
|
||||
@ -548,8 +569,9 @@ using Member = internal::BasicMember<T, internal::StrongMemberTag,
|
||||
* will automatically be set to null.
|
||||
*/
|
||||
template <typename T>
|
||||
using WeakMember = internal::BasicMember<T, internal::WeakMemberTag,
|
||||
internal::DijkstraWriteBarrierPolicy>;
|
||||
using WeakMember = internal::BasicMember<
|
||||
T, internal::WeakMemberTag, internal::DijkstraWriteBarrierPolicy,
|
||||
internal::DefaultMemberCheckingPolicy, internal::DefaultMemberStorage>;
|
||||
|
||||
/**
|
||||
* UntracedMember is a pointer to an on-heap object that is not traced for some
|
||||
@ -558,8 +580,22 @@ using WeakMember = internal::BasicMember<T, internal::WeakMemberTag,
|
||||
* must be kept alive through other means.
|
||||
*/
|
||||
template <typename T>
|
||||
using UntracedMember = internal::BasicMember<T, internal::UntracedMemberTag,
|
||||
internal::NoWriteBarrierPolicy>;
|
||||
using UntracedMember = internal::BasicMember<
|
||||
T, internal::UntracedMemberTag, internal::NoWriteBarrierPolicy,
|
||||
internal::DefaultMemberCheckingPolicy, internal::DefaultMemberStorage>;
|
||||
|
||||
namespace subtle {
|
||||
|
||||
/**
|
||||
* UncompressedMember. Use with care in hot paths that would otherwise cause
|
||||
* many decompression cycles.
|
||||
*/
|
||||
template <typename T>
|
||||
using UncompressedMember = internal::BasicMember<
|
||||
T, internal::StrongMemberTag, internal::DijkstraWriteBarrierPolicy,
|
||||
internal::DefaultMemberCheckingPolicy, internal::RawPointer>;
|
||||
|
||||
} // namespace subtle
|
||||
|
||||
} // namespace cppgc
|
||||
|
||||
|
@ -114,11 +114,12 @@ class BasicPersistent final : public PersistentBase,
|
||||
// Constructor from member.
|
||||
template <typename U, typename MemberBarrierPolicy,
|
||||
typename MemberWeaknessTag, typename MemberCheckingPolicy,
|
||||
typename MemberStorageType,
|
||||
typename = std::enable_if_t<std::is_base_of<T, U>::value>>
|
||||
BasicPersistent(
|
||||
const internal::BasicMember<U, MemberBarrierPolicy, MemberWeaknessTag,
|
||||
MemberCheckingPolicy>& member,
|
||||
const SourceLocation& loc = SourceLocation::Current())
|
||||
BasicPersistent(const internal::BasicMember<
|
||||
U, MemberBarrierPolicy, MemberWeaknessTag,
|
||||
MemberCheckingPolicy, MemberStorageType>& member,
|
||||
const SourceLocation& loc = SourceLocation::Current())
|
||||
: BasicPersistent(member.Get(), loc) {}
|
||||
|
||||
~BasicPersistent() { Clear(); }
|
||||
@ -154,10 +155,12 @@ class BasicPersistent final : public PersistentBase,
|
||||
// Assignment from member.
|
||||
template <typename U, typename MemberBarrierPolicy,
|
||||
typename MemberWeaknessTag, typename MemberCheckingPolicy,
|
||||
typename MemberStorageType,
|
||||
typename = std::enable_if_t<std::is_base_of<T, U>::value>>
|
||||
BasicPersistent& operator=(
|
||||
const internal::BasicMember<U, MemberBarrierPolicy, MemberWeaknessTag,
|
||||
MemberCheckingPolicy>& member) {
|
||||
MemberCheckingPolicy, MemberStorageType>&
|
||||
member) {
|
||||
return operator=(member.Get());
|
||||
}
|
||||
|
||||
@ -286,36 +289,39 @@ bool operator!=(const BasicPersistent<T1, WeaknessPolicy1, LocationPolicy1,
|
||||
template <typename T1, typename PersistentWeaknessPolicy,
|
||||
typename PersistentLocationPolicy, typename PersistentCheckingPolicy,
|
||||
typename T2, typename MemberWriteBarrierPolicy,
|
||||
typename MemberWeaknessTag, typename MemberCheckingPolicy>
|
||||
typename MemberWeaknessTag, typename MemberCheckingPolicy,
|
||||
typename MemberStorageType>
|
||||
bool operator==(
|
||||
const BasicPersistent<T1, PersistentWeaknessPolicy,
|
||||
PersistentLocationPolicy, PersistentCheckingPolicy>&
|
||||
p,
|
||||
const BasicMember<T2, MemberWeaknessTag, MemberWriteBarrierPolicy,
|
||||
MemberCheckingPolicy>& m) {
|
||||
MemberCheckingPolicy, MemberStorageType>& m) {
|
||||
return p.Get() == m.Get();
|
||||
}
|
||||
|
||||
template <typename T1, typename PersistentWeaknessPolicy,
|
||||
typename PersistentLocationPolicy, typename PersistentCheckingPolicy,
|
||||
typename T2, typename MemberWriteBarrierPolicy,
|
||||
typename MemberWeaknessTag, typename MemberCheckingPolicy>
|
||||
typename MemberWeaknessTag, typename MemberCheckingPolicy,
|
||||
typename MemberStorageType>
|
||||
bool operator!=(
|
||||
const BasicPersistent<T1, PersistentWeaknessPolicy,
|
||||
PersistentLocationPolicy, PersistentCheckingPolicy>&
|
||||
p,
|
||||
const BasicMember<T2, MemberWeaknessTag, MemberWriteBarrierPolicy,
|
||||
MemberCheckingPolicy>& m) {
|
||||
MemberCheckingPolicy, MemberStorageType>& m) {
|
||||
return !(p == m);
|
||||
}
|
||||
|
||||
template <typename T1, typename MemberWriteBarrierPolicy,
|
||||
typename MemberWeaknessTag, typename MemberCheckingPolicy,
|
||||
typename T2, typename PersistentWeaknessPolicy,
|
||||
typename PersistentLocationPolicy, typename PersistentCheckingPolicy>
|
||||
typename MemberStorageType, typename T2,
|
||||
typename PersistentWeaknessPolicy, typename PersistentLocationPolicy,
|
||||
typename PersistentCheckingPolicy>
|
||||
bool operator==(
|
||||
const BasicMember<T2, MemberWeaknessTag, MemberWriteBarrierPolicy,
|
||||
MemberCheckingPolicy>& m,
|
||||
MemberCheckingPolicy, MemberStorageType>& m,
|
||||
const BasicPersistent<T1, PersistentWeaknessPolicy,
|
||||
PersistentLocationPolicy, PersistentCheckingPolicy>&
|
||||
p) {
|
||||
@ -324,11 +330,12 @@ bool operator==(
|
||||
|
||||
template <typename T1, typename MemberWriteBarrierPolicy,
|
||||
typename MemberWeaknessTag, typename MemberCheckingPolicy,
|
||||
typename T2, typename PersistentWeaknessPolicy,
|
||||
typename PersistentLocationPolicy, typename PersistentCheckingPolicy>
|
||||
typename MemberStorageType, typename T2,
|
||||
typename PersistentWeaknessPolicy, typename PersistentLocationPolicy,
|
||||
typename PersistentCheckingPolicy>
|
||||
bool operator!=(
|
||||
const BasicMember<T2, MemberWeaknessTag, MemberWriteBarrierPolicy,
|
||||
MemberCheckingPolicy>& m,
|
||||
MemberCheckingPolicy, MemberStorageType>& m,
|
||||
const BasicPersistent<T1, PersistentWeaknessPolicy,
|
||||
PersistentLocationPolicy, PersistentCheckingPolicy>&
|
||||
p) {
|
||||
|
@ -16,7 +16,7 @@ class Visitor;
|
||||
|
||||
namespace internal {
|
||||
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
||||
typename CheckingPolicy>
|
||||
typename CheckingPolicy, typename StorageType>
|
||||
class BasicMember;
|
||||
struct DijkstraWriteBarrierPolicy;
|
||||
struct NoWriteBarrierPolicy;
|
||||
@ -126,9 +126,10 @@ template <typename BasicMemberCandidate, typename WeaknessTag,
|
||||
typename WriteBarrierPolicy>
|
||||
struct IsSubclassOfBasicMemberTemplate {
|
||||
private:
|
||||
template <typename T, typename CheckingPolicy>
|
||||
template <typename T, typename CheckingPolicy, typename StorageType>
|
||||
static std::true_type SubclassCheck(
|
||||
BasicMember<T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy>*);
|
||||
BasicMember<T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy,
|
||||
StorageType>*);
|
||||
static std::false_type SubclassCheck(...);
|
||||
|
||||
public:
|
||||
|
@ -99,6 +99,20 @@ class V8_EXPORT Visitor {
|
||||
&HandleWeak<WeakMember<T>>, &weak_member);
|
||||
}
|
||||
|
||||
#if defined(CPPGC_POINTER_COMPRESSION)
|
||||
/**
|
||||
* Trace method for UncompressedMember.
|
||||
*
|
||||
* \param member UncompressedMember reference retaining an object.
|
||||
*/
|
||||
template <typename T>
|
||||
void Trace(const subtle::UncompressedMember<T>& member) {
|
||||
const T* value = member.GetRawAtomic();
|
||||
CPPGC_DCHECK(value != kSentinelPointer);
|
||||
TraceImpl(value);
|
||||
}
|
||||
#endif // defined(CPPGC_POINTER_COMPRESSION)
|
||||
|
||||
/**
|
||||
* Trace method for inlined objects that are not allocated themselves but
|
||||
* otherwise follow managed heap layout and have a Trace() method.
|
||||
|
@ -21,20 +21,21 @@ uintptr_t CageBaseGlobal::g_base_ = CageBaseGlobal::kLowerHalfWordMask;
|
||||
#if defined(CPPGC_POINTER_COMPRESSION)
|
||||
extern "C" V8_DONT_STRIP_SYMBOL V8_EXPORT_PRIVATE void*
|
||||
_cppgc_internal_Decompress_Compressed_Pointer(uint32_t cmprsd) {
|
||||
return MemberStorage::Decompress(cmprsd);
|
||||
return CompressedPointer::Decompress(cmprsd);
|
||||
}
|
||||
#endif // !defined(CPPGC_POINTER_COMPRESSION)
|
||||
|
||||
class MemberDebugHelper final {
|
||||
public:
|
||||
static void* PrintUncompressed(MemberBase* m) {
|
||||
static void* Uncompress(MemberBase<DefaultMemberStorage>* m) {
|
||||
return const_cast<void*>(m->GetRaw());
|
||||
}
|
||||
};
|
||||
|
||||
extern "C" V8_DONT_STRIP_SYMBOL V8_EXPORT_PRIVATE void*
|
||||
_cppgc_internal_Print_Member(MemberBase* m) {
|
||||
return MemberDebugHelper::PrintUncompressed(m);
|
||||
_cppgc_internal_Uncompress_Member(void* m) {
|
||||
return MemberDebugHelper::Uncompress(
|
||||
static_cast<MemberBase<DefaultMemberStorage>*>(m));
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
@ -68,7 +68,7 @@ struct CustomWriteBarrierPolicy {
|
||||
static void AssigningBarrier(const void* slot, const void* value) {
|
||||
++AssigningWriteBarriersTriggered;
|
||||
}
|
||||
static void AssigningBarrier(const void* slot, MemberStorage) {
|
||||
static void AssigningBarrier(const void* slot, DefaultMemberStorage) {
|
||||
++AssigningWriteBarriersTriggered;
|
||||
}
|
||||
};
|
||||
|
@ -297,7 +297,7 @@ class CppGCMemberPrinter(object):
|
||||
|
||||
def to_string(self):
|
||||
pointer = gdb.parse_and_eval(
|
||||
"_cppgc_internal_Print_Member((cppgc::internal::MemberBase*){})".format(
|
||||
"_cppgc_internal_Uncompress_Member((void*){})".format(
|
||||
self.val.address))
|
||||
return "{}Member<{}> pointing to {}".format(
|
||||
'' if self.category is None else self.category, self.pointee_type,
|
||||
|
Loading…
Reference in New Issue
Block a user