Commit b20ecdbd authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[ptr-compr][cleanup] Cleanup TaggedField<>::store() implementation

When concurrent marking is on then normal stores to tagged fields must
be relaxed stores.

Bug: v8:9396
Change-Id: Id1189a6c7df5ae8e9e5dc4dad653d35bdd109c5e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1677207Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62378}
parent 9c1363e5
...@@ -134,11 +134,7 @@ ...@@ -134,11 +134,7 @@
} \ } \
void holder::set_##name(type value, WriteBarrierMode mode) { \ void holder::set_##name(type value, WriteBarrierMode mode) { \
DCHECK(set_condition); \ DCHECK(set_condition); \
if (V8_CONCURRENT_MARKING_BOOL) { \ TaggedField<type, offset>::store(*this, value); \
TaggedField<type, offset>::Relaxed_Store(*this, value); \
} else { \
TaggedField<type, offset>::store(*this, value); \
} \
CONDITIONAL_WRITE_BARRIER(*this, offset, value, mode); \ CONDITIONAL_WRITE_BARRIER(*this, offset, value, mode); \
} }
...@@ -178,11 +174,7 @@ ...@@ -178,11 +174,7 @@
} \ } \
void holder::set_##name(MaybeObject value, WriteBarrierMode mode) { \ void holder::set_##name(MaybeObject value, WriteBarrierMode mode) { \
DCHECK(set_condition); \ DCHECK(set_condition); \
if (V8_CONCURRENT_MARKING_BOOL) { \ TaggedField<MaybeObject, offset>::store(*this, value); \
TaggedField<MaybeObject, offset>::Relaxed_Store(*this, value); \
} else { \
TaggedField<MaybeObject, offset>::store(*this, value); \
} \
CONDITIONAL_WEAK_WRITE_BARRIER(*this, offset, value, mode); \ CONDITIONAL_WEAK_WRITE_BARRIER(*this, offset, value, mode); \
} }
...@@ -193,19 +185,15 @@ ...@@ -193,19 +185,15 @@
WEAK_ACCESSORS_CHECKED(holder, name, offset, true) WEAK_ACCESSORS_CHECKED(holder, name, offset, true)
// Getter that returns a Smi as an int and writes an int as a Smi. // Getter that returns a Smi as an int and writes an int as a Smi.
#define SMI_ACCESSORS_CHECKED(holder, name, offset, condition) \ #define SMI_ACCESSORS_CHECKED(holder, name, offset, condition) \
int holder::name() const { \ int holder::name() const { \
DCHECK(condition); \ DCHECK(condition); \
Smi value = TaggedField<Smi, offset>::load(*this); \ Smi value = TaggedField<Smi, offset>::load(*this); \
return value.value(); \ return value.value(); \
} \ } \
void holder::set_##name(int value) { \ void holder::set_##name(int value) { \
DCHECK(condition); \ DCHECK(condition); \
if (V8_CONCURRENT_MARKING_BOOL) { \ TaggedField<Smi, offset>::store(*this, Smi::FromInt(value)); \
TaggedField<Smi, offset>::Relaxed_Store(*this, Smi::FromInt(value)); \
} else { \
TaggedField<Smi, offset>::store(*this, Smi::FromInt(value)); \
} \
} }
#define SMI_ACCESSORS(holder, name, offset) \ #define SMI_ACCESSORS(holder, name, offset) \
......
...@@ -70,20 +70,21 @@ T TaggedField<T, kFieldOffset>::load(Isolate* isolate, HeapObject host, ...@@ -70,20 +70,21 @@ T TaggedField<T, kFieldOffset>::load(Isolate* isolate, HeapObject host,
// static // static
template <typename T, int kFieldOffset> template <typename T, int kFieldOffset>
void TaggedField<T, kFieldOffset>::store(HeapObject host, T value) { void TaggedField<T, kFieldOffset>::store(HeapObject host, T value) {
#ifdef V8_CONCURRENT_MARKING
Relaxed_Store(host, value);
#else
*location(host) = full_to_tagged(value.ptr()); *location(host) = full_to_tagged(value.ptr());
#endif
} }
// static // static
template <typename T, int kFieldOffset> template <typename T, int kFieldOffset>
void TaggedField<T, kFieldOffset>::store(HeapObject host, int offset, T value) { void TaggedField<T, kFieldOffset>::store(HeapObject host, int offset, T value) {
#ifdef V8_CONCURRENT_MARKING
Relaxed_Store(host, offset, value);
#else
*location(host, offset) = full_to_tagged(value.ptr()); *location(host, offset) = full_to_tagged(value.ptr());
} #endif
// static
template <typename T, int kFieldOffset>
T TaggedField<T, kFieldOffset>::Relaxed_Load(HeapObject host) {
AtomicTagged_t value = AsAtomicTagged::Relaxed_Load(location(host));
return T(tagged_to_full(host.ptr(), value));
} }
// static // static
...@@ -93,14 +94,6 @@ T TaggedField<T, kFieldOffset>::Relaxed_Load(HeapObject host, int offset) { ...@@ -93,14 +94,6 @@ T TaggedField<T, kFieldOffset>::Relaxed_Load(HeapObject host, int offset) {
return T(tagged_to_full(host.ptr(), value)); return T(tagged_to_full(host.ptr(), value));
} }
// static
template <typename T, int kFieldOffset>
T TaggedField<T, kFieldOffset>::Relaxed_Load(Isolate* isolate,
HeapObject host) {
AtomicTagged_t value = AsAtomicTagged::Relaxed_Load(location(host));
return T(tagged_to_full(isolate, value));
}
// static // static
template <typename T, int kFieldOffset> template <typename T, int kFieldOffset>
T TaggedField<T, kFieldOffset>::Relaxed_Load(Isolate* isolate, HeapObject host, T TaggedField<T, kFieldOffset>::Relaxed_Load(Isolate* isolate, HeapObject host,
......
...@@ -43,10 +43,9 @@ class TaggedField : public AllStatic { ...@@ -43,10 +43,9 @@ class TaggedField : public AllStatic {
static inline void store(HeapObject host, T value); static inline void store(HeapObject host, T value);
static inline void store(HeapObject host, int offset, T value); static inline void store(HeapObject host, int offset, T value);
static inline T Relaxed_Load(HeapObject host); static inline T Relaxed_Load(HeapObject host, int offset = 0);
static inline T Relaxed_Load(HeapObject host, int offset); static inline T Relaxed_Load(Isolate* isolate, HeapObject host,
static inline T Relaxed_Load(Isolate* isolate, HeapObject host); int offset = 0);
static inline T Relaxed_Load(Isolate* isolate, HeapObject host, int offset);
static inline void Relaxed_Store(HeapObject host, T value); static inline void Relaxed_Store(HeapObject host, T value);
static inline void Relaxed_Store(HeapObject host, int offset, T value); static inline void Relaxed_Store(HeapObject host, int offset, T value);
......
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