Commit de50808c authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

Fix compare_exchange for gcc 4.8

gcc 4.8 fails to compile an {std::atomic::compare_exchange_strong} with
{memory_order_acq_rel} with this error:
error: invalid failure memory model for ‘__atomic_compare_exchange’

This makes our gcov bot fail:
https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Linux64%20-%20gcov%20coverage/16053

According to the documentation, giving a single {memory_order_acq_rel}
is equivalent to specifying {memory_order_acq_rel} as success memory
order and {memory_order_acquire} for failure. This CL refactors the code
to do this explicitly.

R=ulan@chromium.org
CC=machenbach@chromium.org

Bug: v8:8238

Cq-Include-Trybots: luci.v8.try:v8_linux64_tsan_rel
Change-Id: Idcc69ee4b4ac53edc4fd1aa28eac7377f08044ce
Reviewed-on: https://chromium-review.googlesource.com/c/1329693Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57426}
parent 425799f3
......@@ -121,7 +121,8 @@ class V8_EXPORT_PRIVATE Cancelable {
Status* previous = nullptr) {
// {compare_exchange_strong} updates {expected}.
bool success = status_.compare_exchange_strong(expected, desired,
std::memory_order_acq_rel);
std::memory_order_acq_rel,
std::memory_order_acquire);
if (previous) *previous = expected;
return success;
}
......
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