Commit e348fe2f authored by Shu-yu Guo's avatar Shu-yu Guo Committed by V8 LUCI CQ

[heap] Use rel/acq for CodeRange::embedded_blob_code_copy_

Rel/acq is needed to guarantee the memcpy for re-embedding builtins
should be visible to all threads once embedded_blob_code_copy_ is
observed to have the address of the copy.

Bug: v8:11460
Change-Id: I68d0c532b7c7bba3d2cafeb0ff83533a67a1447d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2890590Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Auto-Submit: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74529}
parent 82d193ec
...@@ -104,7 +104,7 @@ uint8_t* CodeRange::RemapEmbeddedBuiltins(Isolate* isolate, ...@@ -104,7 +104,7 @@ uint8_t* CodeRange::RemapEmbeddedBuiltins(Isolate* isolate,
CHECK(!code_region.is_empty()); CHECK(!code_region.is_empty());
uint8_t* embedded_blob_code_copy = uint8_t* embedded_blob_code_copy =
embedded_blob_code_copy_.load(std::memory_order_relaxed); embedded_blob_code_copy_.load(std::memory_order_acquire);
if (embedded_blob_code_copy) { if (embedded_blob_code_copy) {
DCHECK( DCHECK(
code_region.contains(reinterpret_cast<Address>(embedded_blob_code_copy), code_region.contains(reinterpret_cast<Address>(embedded_blob_code_copy),
...@@ -148,7 +148,7 @@ uint8_t* CodeRange::RemapEmbeddedBuiltins(Isolate* isolate, ...@@ -148,7 +148,7 @@ uint8_t* CodeRange::RemapEmbeddedBuiltins(Isolate* isolate,
} }
embedded_blob_code_copy_.store(embedded_blob_code_copy, embedded_blob_code_copy_.store(embedded_blob_code_copy,
std::memory_order_relaxed); std::memory_order_release);
return embedded_blob_code_copy; return embedded_blob_code_copy;
} }
......
...@@ -85,7 +85,7 @@ class CodeRange final : public VirtualMemoryCage { ...@@ -85,7 +85,7 @@ class CodeRange final : public VirtualMemoryCage {
// created by itself, i.e. without contention. Additionally, the first // created by itself, i.e. without contention. Additionally, the first
// Isolate usually remaps builtins on machines with enough memory, not // Isolate usually remaps builtins on machines with enough memory, not
// subsequent Isolates in the same process. // subsequent Isolates in the same process.
return embedded_blob_code_copy_.load(std::memory_order_relaxed); return embedded_blob_code_copy_.load(std::memory_order_acquire);
} }
bool InitReservation(v8::PageAllocator* page_allocator, size_t requested); bool InitReservation(v8::PageAllocator* page_allocator, size_t requested);
......
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