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 @@
} \
void holder::set_##name(type value, WriteBarrierMode mode) { \
DCHECK(set_condition); \
if (V8_CONCURRENT_MARKING_BOOL) { \
TaggedField<type, offset>::Relaxed_Store(*this, value); \
} else { \
TaggedField<type, offset>::store(*this, value); \
} \
CONDITIONAL_WRITE_BARRIER(*this, offset, value, mode); \
}
......@@ -178,11 +174,7 @@
} \
void holder::set_##name(MaybeObject value, WriteBarrierMode mode) { \
DCHECK(set_condition); \
if (V8_CONCURRENT_MARKING_BOOL) { \
TaggedField<MaybeObject, offset>::Relaxed_Store(*this, value); \
} else { \
TaggedField<MaybeObject, offset>::store(*this, value); \
} \
CONDITIONAL_WEAK_WRITE_BARRIER(*this, offset, value, mode); \
}
......@@ -201,11 +193,7 @@
} \
void holder::set_##name(int value) { \
DCHECK(condition); \
if (V8_CONCURRENT_MARKING_BOOL) { \
TaggedField<Smi, offset>::Relaxed_Store(*this, Smi::FromInt(value)); \
} else { \
TaggedField<Smi, offset>::store(*this, Smi::FromInt(value)); \
} \
}
#define SMI_ACCESSORS(holder, name, offset) \
......
......@@ -70,20 +70,21 @@ T TaggedField<T, kFieldOffset>::load(Isolate* isolate, HeapObject host,
// static
template <typename T, int kFieldOffset>
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());
#endif
}
// static
template <typename T, int kFieldOffset>
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());
}
// 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));
#endif
}
// static
......@@ -93,14 +94,6 @@ T TaggedField<T, kFieldOffset>::Relaxed_Load(HeapObject host, int offset) {
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
template <typename T, int kFieldOffset>
T TaggedField<T, kFieldOffset>::Relaxed_Load(Isolate* isolate, HeapObject host,
......
......@@ -43,10 +43,9 @@ class TaggedField : public AllStatic {
static inline void store(HeapObject host, 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);
static inline T Relaxed_Load(Isolate* isolate, HeapObject host);
static inline T Relaxed_Load(Isolate* isolate, HeapObject host, int offset);
static inline T Relaxed_Load(HeapObject host, int offset = 0);
static inline T Relaxed_Load(Isolate* isolate, HeapObject host,
int offset = 0);
static inline void Relaxed_Store(HeapObject host, 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