Commit 3687a512 authored by Anton Bikineev's avatar Anton Bikineev Committed by V8 LUCI CQ

cppgc: Avoid decompression cycle when assigning Member from raw ptr

Bug: chromium:1325007
Change-Id: I1d84175a50adc03fdb7a504432fda088b6f3d736
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3758214Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81717}
parent 0be6542c
......@@ -268,7 +268,7 @@ class BasicMember final : private MemberBase, private CheckingPolicy {
V8_INLINE constexpr BasicMember(std::nullptr_t) {} // NOLINT
V8_INLINE BasicMember(SentinelPointer s) : MemberBase(s) {} // NOLINT
V8_INLINE BasicMember(T* raw) : MemberBase(raw) { // NOLINT
InitializingWriteBarrier();
InitializingWriteBarrier(raw);
this->CheckPointer(Get());
}
V8_INLINE BasicMember(T& raw) // NOLINT
......@@ -284,7 +284,7 @@ class BasicMember final : private MemberBase, private CheckingPolicy {
: MemberBase(s, atomic) {}
V8_INLINE BasicMember(T* raw, AtomicInitializerTag atomic)
: MemberBase(raw, atomic) {
InitializingWriteBarrier();
InitializingWriteBarrier(raw);
this->CheckPointer(Get());
}
V8_INLINE BasicMember(T& raw, AtomicInitializerTag atomic)
......@@ -410,7 +410,7 @@ class BasicMember final : private MemberBase, private CheckingPolicy {
V8_INLINE BasicMember& operator=(T* other) {
SetRawAtomic(other);
AssigningWriteBarrier();
AssigningWriteBarrier(other);
this->CheckPointer(Get());
return *this;
}
......@@ -468,13 +468,13 @@ class BasicMember final : private MemberBase, private CheckingPolicy {
private:
V8_INLINE explicit BasicMember(RawStorage raw) : MemberBase(raw) {
InitializingWriteBarrier();
InitializingWriteBarrier(Get());
this->CheckPointer(Get());
}
V8_INLINE BasicMember& operator=(RawStorage other) {
SetRawStorageAtomic(other);
AssigningWriteBarrier();
AssigningWriteBarrier(Get());
this->CheckPointer(Get());
return *this;
}
......@@ -483,11 +483,11 @@ class BasicMember final : private MemberBase, private CheckingPolicy {
return static_cast<const T*>(MemberBase::GetRawAtomic());
}
V8_INLINE void InitializingWriteBarrier() const {
WriteBarrierPolicy::InitializingBarrier(GetRawSlot(), GetRaw());
V8_INLINE void InitializingWriteBarrier(T* value) const {
WriteBarrierPolicy::InitializingBarrier(GetRawSlot(), value);
}
V8_INLINE void AssigningWriteBarrier() const {
WriteBarrierPolicy::AssigningBarrier(GetRawSlot(), GetRaw());
V8_INLINE void AssigningWriteBarrier(T* value) const {
WriteBarrierPolicy::AssigningBarrier(GetRawSlot(), value);
}
V8_INLINE void ClearFromGC() const { MemberBase::ClearFromGC(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment