4392e0a4ad
This changeset include: 1. [prepare for migrate] move `cctest/compiler/value-helper.h`, `cctest/compiler/c-signature.h`, and `cctest/compiler/call-tester.h` to `test/common` directory because both `test-codegen` and a lot of cctest file include it. 2. [prepare for migrate] separate the tester helper part of `test-codegen` into a new `codegen-tester` file. 3. finally, migrate test-codegen.cc to `codegen-unittest.cc` Bug: v8:12781 Change-Id: Ia2f52c1d3b6b62501066dc1c4308a2c09d699e92 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3831146 Reviewed-by: Clemens Backes <clemensb@chromium.org> Commit-Queue: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/main@{#82630}
70 lines
1.4 KiB
C++
70 lines
1.4 KiB
C++
// Copyright 2018 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef WASM_ATOMICOP_UTILS_H
|
|
#define WASM_ATOMICOP_UTILS_H
|
|
|
|
#include "test/cctest/cctest.h"
|
|
#include "test/cctest/wasm/wasm-run-utils.h"
|
|
#include "test/common/value-helper.h"
|
|
|
|
namespace v8 {
|
|
namespace internal {
|
|
namespace wasm {
|
|
|
|
#define WASM_ATOMIC_OPERATION_LIST(V) \
|
|
V(Add) \
|
|
V(Sub) \
|
|
V(And) \
|
|
V(Or) \
|
|
V(Xor) \
|
|
V(Exchange)
|
|
|
|
using Uint64BinOp = uint64_t (*)(uint64_t, uint64_t);
|
|
using Uint32BinOp = uint32_t (*)(uint32_t, uint32_t);
|
|
using Uint16BinOp = uint16_t (*)(uint16_t, uint16_t);
|
|
using Uint8BinOp = uint8_t (*)(uint8_t, uint8_t);
|
|
|
|
template <typename T>
|
|
T Add(T a, T b) {
|
|
return a + b;
|
|
}
|
|
|
|
template <typename T>
|
|
T Sub(T a, T b) {
|
|
return a - b;
|
|
}
|
|
|
|
template <typename T>
|
|
T And(T a, T b) {
|
|
return a & b;
|
|
}
|
|
|
|
template <typename T>
|
|
T Or(T a, T b) {
|
|
return a | b;
|
|
}
|
|
|
|
template <typename T>
|
|
T Xor(T a, T b) {
|
|
return a ^ b;
|
|
}
|
|
|
|
template <typename T>
|
|
T Exchange(T a, T b) {
|
|
return b;
|
|
}
|
|
|
|
template <typename T>
|
|
T CompareExchange(T initial, T a, T b) {
|
|
if (initial == a) return b;
|
|
return a;
|
|
}
|
|
|
|
} // namespace wasm
|
|
} // namespace internal
|
|
} // namespace v8
|
|
|
|
#endif
|