
v8 team insists that in order to avoid C++ UB, all writes to memory owned by SharedArrayBuffers should be done with C++ relaxed-atomics. That's why in order to use async readback in WebCodecs API without introducing extra copies, we need to use RelaxedAtomicWriteMemcpy(). My micro-benchmarks didn't find any difference in performance between RelaxedAtomicWriteMemcpy() and memcpy(), therefore we don't need to make effort to use memcpy in cases where we don't copy to SharedArrayBuffers. Bug: 340606792 Change-Id: I8faec3dd3e79cbd61c14aee292ea6d873317129f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6176228 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Commit-Queue: Eugene Zemtsov <eugene@chromium.org> Cr-Commit-Position: refs/heads/main@{#1407599}