diff options
Diffstat (limited to 'deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc')
-rw-r--r-- | deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc | 123 |
1 files changed, 81 insertions, 42 deletions
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc b/deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc index cb291b8741..b7b200984d 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc @@ -52,9 +52,10 @@ T CompareExchange(T initial, T a, T b) { return a; } -void RunU32BinOp(WasmOpcode wasm_op, Uint32BinOp expected_op) { +void RunU32BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op, + Uint32BinOp expected_op) { EXPERIMENTAL_FLAG_SCOPE(threads); - WasmRunner<uint32_t, uint32_t> r(kExecuteCompiled); + WasmRunner<uint32_t, uint32_t> r(execution_mode); uint32_t* memory = r.builder().AddMemoryElems<uint32_t>(8); r.builder().SetHasSharedMemory(); @@ -72,16 +73,29 @@ void RunU32BinOp(WasmOpcode wasm_op, Uint32BinOp expected_op) { } } -TEST(I32AtomicAdd) { RunU32BinOp(kExprI32AtomicAdd, Add); } -TEST(I32AtomicSub) { RunU32BinOp(kExprI32AtomicSub, Sub); } -TEST(I32AtomicAnd) { RunU32BinOp(kExprI32AtomicAnd, And); } -TEST(I32AtomicOr) { RunU32BinOp(kExprI32AtomicOr, Or); } -TEST(I32AtomicXor) { RunU32BinOp(kExprI32AtomicXor, Xor); } -TEST(I32AtomicExchange) { RunU32BinOp(kExprI32AtomicExchange, Exchange); } +WASM_EXEC_TEST(I32AtomicAdd) { + RunU32BinOp(execution_mode, kExprI32AtomicAdd, Add); +} +WASM_EXEC_TEST(I32AtomicSub) { + RunU32BinOp(execution_mode, kExprI32AtomicSub, Sub); +} +WASM_EXEC_TEST(I32AtomicAnd) { + RunU32BinOp(execution_mode, kExprI32AtomicAnd, And); +} +WASM_EXEC_TEST(I32AtomicOr) { + RunU32BinOp(execution_mode, kExprI32AtomicOr, Or); +} +WASM_EXEC_TEST(I32AtomicXor) { + RunU32BinOp(execution_mode, kExprI32AtomicXor, Xor); +} +WASM_EXEC_TEST(I32AtomicExchange) { + RunU32BinOp(execution_mode, kExprI32AtomicExchange, Exchange); +} -void RunU16BinOp(WasmOpcode wasm_op, Uint16BinOp expected_op) { +void RunU16BinOp(WasmExecutionMode mode, WasmOpcode wasm_op, + Uint16BinOp expected_op) { EXPERIMENTAL_FLAG_SCOPE(threads); - WasmRunner<uint32_t, uint32_t> r(kExecuteCompiled); + WasmRunner<uint32_t, uint32_t> r(mode); r.builder().SetHasSharedMemory(); uint16_t* memory = r.builder().AddMemoryElems<uint16_t>(8); @@ -99,16 +113,29 @@ void RunU16BinOp(WasmOpcode wasm_op, Uint16BinOp expected_op) { } } -TEST(I32AtomicAdd16U) { RunU16BinOp(kExprI32AtomicAdd16U, Add); } -TEST(I32AtomicSub16U) { RunU16BinOp(kExprI32AtomicSub16U, Sub); } -TEST(I32AtomicAnd16U) { RunU16BinOp(kExprI32AtomicAnd16U, And); } -TEST(I32AtomicOr16U) { RunU16BinOp(kExprI32AtomicOr16U, Or); } -TEST(I32AtomicXor16U) { RunU16BinOp(kExprI32AtomicXor16U, Xor); } -TEST(I32AtomicExchange16U) { RunU16BinOp(kExprI32AtomicExchange16U, Exchange); } +WASM_EXEC_TEST(I32AtomicAdd16U) { + RunU16BinOp(execution_mode, kExprI32AtomicAdd16U, Add); +} +WASM_EXEC_TEST(I32AtomicSub16U) { + RunU16BinOp(execution_mode, kExprI32AtomicSub16U, Sub); +} +WASM_EXEC_TEST(I32AtomicAnd16U) { + RunU16BinOp(execution_mode, kExprI32AtomicAnd16U, And); +} +WASM_EXEC_TEST(I32AtomicOr16U) { + RunU16BinOp(execution_mode, kExprI32AtomicOr16U, Or); +} +WASM_EXEC_TEST(I32AtomicXor16U) { + RunU16BinOp(execution_mode, kExprI32AtomicXor16U, Xor); +} +WASM_EXEC_TEST(I32AtomicExchange16U) { + RunU16BinOp(execution_mode, kExprI32AtomicExchange16U, Exchange); +} -void RunU8BinOp(WasmOpcode wasm_op, Uint8BinOp expected_op) { +void RunU8BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op, + Uint8BinOp expected_op) { EXPERIMENTAL_FLAG_SCOPE(threads); - WasmRunner<uint32_t, uint32_t> r(kExecuteCompiled); + WasmRunner<uint32_t, uint32_t> r(execution_mode); r.builder().SetHasSharedMemory(); uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(8); @@ -126,16 +153,28 @@ void RunU8BinOp(WasmOpcode wasm_op, Uint8BinOp expected_op) { } } -TEST(I32AtomicAdd8U) { RunU8BinOp(kExprI32AtomicAdd8U, Add); } -TEST(I32AtomicSub8U) { RunU8BinOp(kExprI32AtomicSub8U, Sub); } -TEST(I32AtomicAnd8U) { RunU8BinOp(kExprI32AtomicAnd8U, And); } -TEST(I32AtomicOr8U) { RunU8BinOp(kExprI32AtomicOr8U, Or); } -TEST(I32AtomicXor8U) { RunU8BinOp(kExprI32AtomicXor8U, Xor); } -TEST(I32AtomicExchange8U) { RunU8BinOp(kExprI32AtomicExchange8U, Exchange); } +WASM_EXEC_TEST(I32AtomicAdd8U) { + RunU8BinOp(execution_mode, kExprI32AtomicAdd8U, Add); +} +WASM_EXEC_TEST(I32AtomicSub8U) { + RunU8BinOp(execution_mode, kExprI32AtomicSub8U, Sub); +} +WASM_EXEC_TEST(I32AtomicAnd8U) { + RunU8BinOp(execution_mode, kExprI32AtomicAnd8U, And); +} +WASM_EXEC_TEST(I32AtomicOr8U) { + RunU8BinOp(execution_mode, kExprI32AtomicOr8U, Or); +} +WASM_EXEC_TEST(I32AtomicXor8U) { + RunU8BinOp(execution_mode, kExprI32AtomicXor8U, Xor); +} +WASM_EXEC_TEST(I32AtomicExchange8U) { + RunU8BinOp(execution_mode, kExprI32AtomicExchange8U, Exchange); +} -TEST(I32AtomicCompareExchange) { +WASM_COMPILED_EXEC_TEST(I32AtomicCompareExchange) { EXPERIMENTAL_FLAG_SCOPE(threads); - WasmRunner<uint32_t, uint32_t, uint32_t> r(kExecuteCompiled); + WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode); r.builder().SetHasSharedMemory(); uint32_t* memory = r.builder().AddMemoryElems<uint32_t>(8); BUILD(r, WASM_ATOMICS_TERNARY_OP( @@ -153,9 +192,9 @@ TEST(I32AtomicCompareExchange) { } } -TEST(I32AtomicCompareExchange16U) { +WASM_COMPILED_EXEC_TEST(I32AtomicCompareExchange16U) { EXPERIMENTAL_FLAG_SCOPE(threads); - WasmRunner<uint32_t, uint32_t, uint32_t> r(kExecuteCompiled); + WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode); r.builder().SetHasSharedMemory(); uint16_t* memory = r.builder().AddMemoryElems<uint16_t>(8); BUILD(r, WASM_ATOMICS_TERNARY_OP(kExprI32AtomicCompareExchange16U, @@ -174,9 +213,9 @@ TEST(I32AtomicCompareExchange16U) { } } -TEST(I32AtomicCompareExchange8U) { +WASM_COMPILED_EXEC_TEST(I32AtomicCompareExchange8U) { EXPERIMENTAL_FLAG_SCOPE(threads); - WasmRunner<uint32_t, uint32_t, uint32_t> r(kExecuteCompiled); + WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode); r.builder().SetHasSharedMemory(); uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(8); BUILD(r, @@ -195,9 +234,9 @@ TEST(I32AtomicCompareExchange8U) { } } -TEST(I32AtomicLoad) { +WASM_COMPILED_EXEC_TEST(I32AtomicLoad) { EXPERIMENTAL_FLAG_SCOPE(threads); - WasmRunner<uint32_t> r(kExecuteCompiled); + WasmRunner<uint32_t> r(execution_mode); r.builder().SetHasSharedMemory(); uint32_t* memory = r.builder().AddMemoryElems<uint32_t>(8); BUILD(r, WASM_ATOMICS_LOAD_OP(kExprI32AtomicLoad, WASM_ZERO, @@ -210,9 +249,9 @@ TEST(I32AtomicLoad) { } } -TEST(I32AtomicLoad16U) { +WASM_COMPILED_EXEC_TEST(I32AtomicLoad16U) { EXPERIMENTAL_FLAG_SCOPE(threads); - WasmRunner<uint32_t> r(kExecuteCompiled); + WasmRunner<uint32_t> r(execution_mode); r.builder().SetHasSharedMemory(); uint16_t* memory = r.builder().AddMemoryElems<uint16_t>(8); BUILD(r, WASM_ATOMICS_LOAD_OP(kExprI32AtomicLoad16U, WASM_ZERO, @@ -225,9 +264,9 @@ TEST(I32AtomicLoad16U) { } } -TEST(I32AtomicLoad8U) { +WASM_COMPILED_EXEC_TEST(I32AtomicLoad8U) { EXPERIMENTAL_FLAG_SCOPE(threads); - WasmRunner<uint32_t> r(kExecuteCompiled); + WasmRunner<uint32_t> r(execution_mode); r.builder().SetHasSharedMemory(); uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(8); BUILD(r, WASM_ATOMICS_LOAD_OP(kExprI32AtomicLoad8U, WASM_ZERO, @@ -240,9 +279,9 @@ TEST(I32AtomicLoad8U) { } } -TEST(I32AtomicStoreLoad) { +WASM_COMPILED_EXEC_TEST(I32AtomicStoreLoad) { EXPERIMENTAL_FLAG_SCOPE(threads); - WasmRunner<uint32_t, uint32_t> r(kExecuteCompiled); + WasmRunner<uint32_t, uint32_t> r(execution_mode); r.builder().SetHasSharedMemory(); uint32_t* memory = r.builder().AddMemoryElems<uint32_t>(8); @@ -259,9 +298,9 @@ TEST(I32AtomicStoreLoad) { } } -TEST(I32AtomicStoreLoad16U) { +WASM_COMPILED_EXEC_TEST(I32AtomicStoreLoad16U) { EXPERIMENTAL_FLAG_SCOPE(threads); - WasmRunner<uint32_t, uint32_t> r(kExecuteCompiled); + WasmRunner<uint32_t, uint32_t> r(execution_mode); r.builder().SetHasSharedMemory(); uint16_t* memory = r.builder().AddMemoryElems<uint16_t>(8); @@ -279,9 +318,9 @@ TEST(I32AtomicStoreLoad16U) { } } -TEST(I32AtomicStoreLoad8U) { +WASM_COMPILED_EXEC_TEST(I32AtomicStoreLoad8U) { EXPERIMENTAL_FLAG_SCOPE(threads); - WasmRunner<uint32_t, uint32_t> r(kExecuteCompiled); + WasmRunner<uint32_t, uint32_t> r(execution_mode); r.builder().SetHasSharedMemory(); uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(8); |