• Clemens Backes's avatar
    Fix data race in array sorting · 9c5623c7
    Clemens Backes authored
    For copying the SharedArrayBuffer content, we cannot use a simple
    {memcpy} because that produces data races with thread concurrently
    modifying the content. Instead, use a custom {Relaxed_Memcpy} that uses
    proper relaxed atomics. The implementation is slightly optimized to do
    word-sized loads and stores where possible. If we still get performance
    regressions, we can optimize it further in follow-up CLs.
    
    R=ulan@chromium.org
    CC=mlippautz@chromium.org
    
    Bug: v8:11704, chromium:1205290
    Change-Id: Ie34afc5c22ec5496c0fe822d55d4788031f06c54
    Cq-Include-Trybots: luci.v8.try:v8_linux64_tsan_rel_ng
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2874652
    Commit-Queue: Clemens Backes <clemensb@chromium.org>
    Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#74403}
    9c5623c7
atomicops.h 12.3 KB