Commit 6b794a42 authored by Mike Stanton's avatar Mike Stanton Committed by Commit Bot

[TurboFan] Make TSAN happy with background Code reads

Perform relaxed reads/writes on the builtin index.

Bug: v8:11478, v8:7790
Change-Id: I488fd30e6635f39bb46440e9d5230ab311825e7d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2716290Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73012}
parent 3ac389fa
......@@ -492,14 +492,14 @@ inline HandlerTable::CatchPrediction Code::GetBuiltinCatchPrediction() {
}
int Code::builtin_index() const {
int index = ReadField<int>(kBuiltinIndexOffset);
int index = RELAXED_READ_INT_FIELD(*this, kBuiltinIndexOffset);
DCHECK(index == Builtins::kNoBuiltinId || Builtins::IsBuiltinId(index));
return index;
}
void Code::set_builtin_index(int index) {
DCHECK(index == Builtins::kNoBuiltinId || Builtins::IsBuiltinId(index));
WriteField<int>(kBuiltinIndexOffset, index);
RELAXED_WRITE_INT_FIELD(*this, kBuiltinIndexOffset, index);
}
bool Code::is_builtin() const {
......
......@@ -553,7 +553,15 @@
#define RELAXED_WRITE_INT32_FIELD(p, offset, value) \
base::Relaxed_Store( \
reinterpret_cast<base::Atomic32*>(FIELD_ADDR(p, offset)), \
static_cast<base::Atomic32>(value));
static_cast<base::Atomic32>(value))
static_assert(sizeof(int) == sizeof(int32_t),
"sizeof int must match sizeof int32_t");
#define RELAXED_READ_INT_FIELD(p, offset) RELAXED_READ_INT32_FIELD(p, offset)
#define RELAXED_WRITE_INT_FIELD(p, offset, value) \
RELAXED_WRITE_INT32_FIELD(p, offset, value)
#define RELAXED_READ_BYTE_FIELD(p, offset) \
static_cast<byte>(base::Relaxed_Load( \
......
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