Commit 9e9c61b6 authored by Dominik Inführ's avatar Dominik Inführ Committed by V8 LUCI CQ

[objects] Use atomic for JSGlobalObject::native_context_unchecked

Speculative fix for a data race involving memory measurement. For memory
measurement we use JSGlobalObject::native_context_unchecked in
NativeContextInferrer::InferForJSObject when trying to infer the
NativeContext for a JS object from a concurrent marking thread. This
load can race e.g. with the context deserializer running on the main
thread. Fix this race by making the load relaxed atomic.

Bug: chromium:1269681
Change-Id: Id04a92572d7d722594b2f8465e579b7231e54e29
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3277885
Auto-Submit: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77870}
parent 8e98695c
......@@ -470,7 +470,8 @@ void JSObject::InitializeBody(Map map, int start_offset,
}
DEF_GETTER(JSGlobalObject, native_context_unchecked, Object) {
return TaggedField<Object, kNativeContextOffset>::load(cage_base, *this);
return TaggedField<Object, kNativeContextOffset>::Relaxed_Load(cage_base,
*this);
}
bool JSMessageObject::DidEnsureSourcePositionsAvailable() const {
......
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