Commit 1abf6972 authored by Gabriel Charette's avatar Gabriel Charette Committed by V8 LUCI CQ

[v8] Fix data race in TRACE_EVENT macros.

Mirrors a Chromium change @
https://chromium-review.googlesource.com/c/chromium/src/+/3680123

Bug: chromium:1330114
Change-Id: I6fdfd93264e669965245f5ba696fb5b605e417fe
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3687370
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Commit-Queue: Hannes Payer <hpayer@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80963}
parent 2b32409c
......@@ -129,10 +129,14 @@ enum CategoryGroupEnabledFlags {
->UpdateTraceEventDuration
// Defines atomic operations used internally by the tracing system.
// Acquire/release barriers are important here: crbug.com/1330114#c8.
#define TRACE_EVENT_API_ATOMIC_WORD v8::base::AtomicWord
#define TRACE_EVENT_API_ATOMIC_LOAD(var) v8::base::Relaxed_Load(&(var))
#define TRACE_EVENT_API_ATOMIC_LOAD(var) v8::base::Acquire_Load(&(var))
#define TRACE_EVENT_API_ATOMIC_STORE(var, value) \
v8::base::Relaxed_Store(&(var), (value))
v8::base::Release_Store(&(var), (value))
// This load can be Relaxed because it's reading the state of
// `category_group_enabled` and not inferring other variable's state from the
// result.
#define TRACE_EVENT_API_LOAD_CATEGORY_GROUP_ENABLED() \
v8::base::Relaxed_Load(reinterpret_cast<const v8::base::Atomic8*>( \
INTERNAL_TRACE_EVENT_UID(category_group_enabled)))
......
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