diff options
author | Michaël Zasso <targos@protonmail.com> | 2018-09-21 09:14:51 +0200 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2018-09-22 18:29:25 +0200 |
commit | 0e7ddbd3d7e9439c67573b854c49cf82c398ae82 (patch) | |
tree | 2afe372acde921cb57ddb3444ff00c5adef8848c /deps/v8/test/cctest/wasm/test-run-wasm.cc | |
parent | 13245dc50da4cb7443c39ef6c68d419d5e6336d4 (diff) | |
download | android-node-v8-0e7ddbd3d7e9439c67573b854c49cf82c398ae82.tar.gz android-node-v8-0e7ddbd3d7e9439c67573b854c49cf82c398ae82.tar.bz2 android-node-v8-0e7ddbd3d7e9439c67573b854c49cf82c398ae82.zip |
deps: update V8 to 7.0.276.20
PR-URL: https://github.com/nodejs/node/pull/22754
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'deps/v8/test/cctest/wasm/test-run-wasm.cc')
-rw-r--r-- | deps/v8/test/cctest/wasm/test-run-wasm.cc | 809 |
1 files changed, 404 insertions, 405 deletions
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm.cc b/deps/v8/test/cctest/wasm/test-run-wasm.cc index bf47ddeadb..0ba12aedd9 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm.cc @@ -27,7 +27,7 @@ namespace test_run_wasm { #define RET_I8(x) WASM_I32V_2(x), kExprReturn WASM_EXEC_TEST(Int32Const) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); const int32_t kExpectedValue = 0x11223344; // return(kExpectedValue) BUILD(r, WASM_I32V_5(kExpectedValue)); @@ -36,7 +36,7 @@ WASM_EXEC_TEST(Int32Const) { WASM_EXEC_TEST(Int32Const_many) { FOR_INT32_INPUTS(i) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); const int32_t kExpectedValue = *i; // return(kExpectedValue) BUILD(r, WASM_I32V(kExpectedValue)); @@ -46,58 +46,58 @@ WASM_EXEC_TEST(Int32Const_many) { WASM_EXEC_TEST(GraphTrimming) { // This WebAssembly code requires graph trimming in the TurboFan compiler. - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, kExprGetLocal, 0, kExprGetLocal, 0, kExprGetLocal, 0, kExprI32RemS, kExprI32Eq, kExprGetLocal, 0, kExprI32DivS, kExprUnreachable); r.Call(1); } WASM_EXEC_TEST(Int32Param0) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); // return(local[0]) BUILD(r, WASM_GET_LOCAL(0)); FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } } WASM_EXEC_TEST(Int32Param0_fallthru) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); // local[0] BUILD(r, WASM_GET_LOCAL(0)); FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } } WASM_EXEC_TEST(Int32Param1) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); // local[1] BUILD(r, WASM_GET_LOCAL(1)); FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(-111, *i)); } } WASM_EXEC_TEST(Int32Add) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); // 11 + 44 BUILD(r, WASM_I32_ADD(WASM_I32V_1(11), WASM_I32V_1(44))); CHECK_EQ(55, r.Call()); } WASM_EXEC_TEST(Int32Add_P) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); // p0 + 13 BUILD(r, WASM_I32_ADD(WASM_I32V_1(13), WASM_GET_LOCAL(0))); FOR_INT32_INPUTS(i) { CHECK_EQ(*i + 13, r.Call(*i)); } } WASM_EXEC_TEST(Int32Add_P_fallthru) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); // p0 + 13 BUILD(r, WASM_I32_ADD(WASM_I32V_1(13), WASM_GET_LOCAL(0))); FOR_INT32_INPUTS(i) { CHECK_EQ(*i + 13, r.Call(*i)); } } -static void RunInt32AddTest(WasmExecutionMode execution_mode, const byte* code, +static void RunInt32AddTest(ExecutionTier execution_tier, const byte* code, size_t size) { TestSignatures sigs; - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); r.builder().AddSignature(sigs.ii_v()); r.builder().AddSignature(sigs.iii_v()); r.Build(code, code + size); @@ -114,7 +114,7 @@ WASM_EXEC_TEST(Int32Add_P2) { EXPERIMENTAL_FLAG_SCOPE(mv); static const byte code[] = { WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}; - RunInt32AddTest(execution_mode, code, sizeof(code)); + RunInt32AddTest(execution_tier, code, sizeof(code)); } WASM_EXEC_TEST(Int32Add_block1) { @@ -122,7 +122,7 @@ WASM_EXEC_TEST(Int32Add_block1) { static const byte code[] = { WASM_BLOCK_X(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), kExprI32Add}; - RunInt32AddTest(execution_mode, code, sizeof(code)); + RunInt32AddTest(execution_tier, code, sizeof(code)); } WASM_EXEC_TEST(Int32Add_block2) { @@ -130,7 +130,7 @@ WASM_EXEC_TEST(Int32Add_block2) { static const byte code[] = { WASM_BLOCK_X(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), kExprBr, DEPTH_0), kExprI32Add}; - RunInt32AddTest(execution_mode, code, sizeof(code)); + RunInt32AddTest(execution_tier, code, sizeof(code)); } WASM_EXEC_TEST(Int32Add_multi_if) { @@ -140,11 +140,11 @@ WASM_EXEC_TEST(Int32Add_multi_if) { WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_SEQ(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0))), kExprI32Add}; - RunInt32AddTest(execution_mode, code, sizeof(code)); + RunInt32AddTest(execution_tier, code, sizeof(code)); } WASM_EXEC_TEST(Float32Add) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); // int(11.5f + 44.5f) BUILD(r, WASM_I32_SCONVERT_F32(WASM_F32_ADD(WASM_F32(11.5f), WASM_F32(44.5f)))); @@ -152,7 +152,7 @@ WASM_EXEC_TEST(Float32Add) { } WASM_EXEC_TEST(Float64Add) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); // return int(13.5d + 43.5d) BUILD(r, WASM_I32_SCONVERT_F64(WASM_F64_ADD(WASM_F64(13.5), WASM_F64(43.5)))); CHECK_EQ(57, r.Call()); @@ -161,18 +161,18 @@ WASM_EXEC_TEST(Float64Add) { // clang-format messes up the FOR_INT32_INPUTS macros. // clang-format off template<typename ctype> -static void TestInt32Binop(WasmExecutionMode execution_mode, WasmOpcode opcode, +static void TestInt32Binop(ExecutionTier execution_tier, WasmOpcode opcode, ctype(*expected)(ctype, ctype)) { FOR_INT32_INPUTS(i) { FOR_INT32_INPUTS(j) { - WasmRunner<ctype> r(execution_mode); + WasmRunner<ctype> r(execution_tier); // Apply {opcode} on two constants. BUILD(r, WASM_BINOP(opcode, WASM_I32V(*i), WASM_I32V(*j))); CHECK_EQ(expected(*i, *j), r.Call()); } } { - WasmRunner<ctype, ctype, ctype> r(execution_mode); + WasmRunner<ctype, ctype, ctype> r(execution_tier); // Apply {opcode} on two parameters. BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT32_INPUTS(i) { @@ -186,7 +186,7 @@ static void TestInt32Binop(WasmExecutionMode execution_mode, WasmOpcode opcode, #define WASM_I32_BINOP_TEST(expr, ctype, expected) \ WASM_EXEC_TEST(I32Binop_##expr) { \ - TestInt32Binop<ctype>(execution_mode, kExprI32##expr, \ + TestInt32Binop<ctype>(execution_tier, kExprI32##expr, \ [](ctype a, ctype b) -> ctype { return expected; }); \ } @@ -221,16 +221,16 @@ WASM_I32_BINOP_TEST(GeU, uint32_t, a >= b) #undef WASM_I32_BINOP_TEST -void TestInt32Unop(WasmExecutionMode execution_mode, WasmOpcode opcode, +void TestInt32Unop(ExecutionTier execution_tier, WasmOpcode opcode, int32_t expected, int32_t a) { { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); // return op K BUILD(r, WASM_UNOP(opcode, WASM_I32V(a))); CHECK_EQ(expected, r.Call()); } { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); // return op a BUILD(r, WASM_UNOP(opcode, WASM_GET_LOCAL(0))); CHECK_EQ(expected, r.Call(a)); @@ -238,96 +238,96 @@ void TestInt32Unop(WasmExecutionMode execution_mode, WasmOpcode opcode, } WASM_EXEC_TEST(Int32Clz) { - TestInt32Unop(execution_mode, kExprI32Clz, 0, 0x80001000); - TestInt32Unop(execution_mode, kExprI32Clz, 1, 0x40000500); - TestInt32Unop(execution_mode, kExprI32Clz, 2, 0x20000300); - TestInt32Unop(execution_mode, kExprI32Clz, 3, 0x10000003); - TestInt32Unop(execution_mode, kExprI32Clz, 4, 0x08050000); - TestInt32Unop(execution_mode, kExprI32Clz, 5, 0x04006000); - TestInt32Unop(execution_mode, kExprI32Clz, 6, 0x02000000); - TestInt32Unop(execution_mode, kExprI32Clz, 7, 0x010000A0); - TestInt32Unop(execution_mode, kExprI32Clz, 8, 0x00800C00); - TestInt32Unop(execution_mode, kExprI32Clz, 9, 0x00400000); - TestInt32Unop(execution_mode, kExprI32Clz, 10, 0x0020000D); - TestInt32Unop(execution_mode, kExprI32Clz, 11, 0x00100F00); - TestInt32Unop(execution_mode, kExprI32Clz, 12, 0x00080000); - TestInt32Unop(execution_mode, kExprI32Clz, 13, 0x00041000); - TestInt32Unop(execution_mode, kExprI32Clz, 14, 0x00020020); - TestInt32Unop(execution_mode, kExprI32Clz, 15, 0x00010300); - TestInt32Unop(execution_mode, kExprI32Clz, 16, 0x00008040); - TestInt32Unop(execution_mode, kExprI32Clz, 17, 0x00004005); - TestInt32Unop(execution_mode, kExprI32Clz, 18, 0x00002050); - TestInt32Unop(execution_mode, kExprI32Clz, 19, 0x00001700); - TestInt32Unop(execution_mode, kExprI32Clz, 20, 0x00000870); - TestInt32Unop(execution_mode, kExprI32Clz, 21, 0x00000405); - TestInt32Unop(execution_mode, kExprI32Clz, 22, 0x00000203); - TestInt32Unop(execution_mode, kExprI32Clz, 23, 0x00000101); - TestInt32Unop(execution_mode, kExprI32Clz, 24, 0x00000089); - TestInt32Unop(execution_mode, kExprI32Clz, 25, 0x00000041); - TestInt32Unop(execution_mode, kExprI32Clz, 26, 0x00000022); - TestInt32Unop(execution_mode, kExprI32Clz, 27, 0x00000013); - TestInt32Unop(execution_mode, kExprI32Clz, 28, 0x00000008); - TestInt32Unop(execution_mode, kExprI32Clz, 29, 0x00000004); - TestInt32Unop(execution_mode, kExprI32Clz, 30, 0x00000002); - TestInt32Unop(execution_mode, kExprI32Clz, 31, 0x00000001); - TestInt32Unop(execution_mode, kExprI32Clz, 32, 0x00000000); + TestInt32Unop(execution_tier, kExprI32Clz, 0, 0x80001000); + TestInt32Unop(execution_tier, kExprI32Clz, 1, 0x40000500); + TestInt32Unop(execution_tier, kExprI32Clz, 2, 0x20000300); + TestInt32Unop(execution_tier, kExprI32Clz, 3, 0x10000003); + TestInt32Unop(execution_tier, kExprI32Clz, 4, 0x08050000); + TestInt32Unop(execution_tier, kExprI32Clz, 5, 0x04006000); + TestInt32Unop(execution_tier, kExprI32Clz, 6, 0x02000000); + TestInt32Unop(execution_tier, kExprI32Clz, 7, 0x010000A0); + TestInt32Unop(execution_tier, kExprI32Clz, 8, 0x00800C00); + TestInt32Unop(execution_tier, kExprI32Clz, 9, 0x00400000); + TestInt32Unop(execution_tier, kExprI32Clz, 10, 0x0020000D); + TestInt32Unop(execution_tier, kExprI32Clz, 11, 0x00100F00); + TestInt32Unop(execution_tier, kExprI32Clz, 12, 0x00080000); + TestInt32Unop(execution_tier, kExprI32Clz, 13, 0x00041000); + TestInt32Unop(execution_tier, kExprI32Clz, 14, 0x00020020); + TestInt32Unop(execution_tier, kExprI32Clz, 15, 0x00010300); + TestInt32Unop(execution_tier, kExprI32Clz, 16, 0x00008040); + TestInt32Unop(execution_tier, kExprI32Clz, 17, 0x00004005); + TestInt32Unop(execution_tier, kExprI32Clz, 18, 0x00002050); + TestInt32Unop(execution_tier, kExprI32Clz, 19, 0x00001700); + TestInt32Unop(execution_tier, kExprI32Clz, 20, 0x00000870); + TestInt32Unop(execution_tier, kExprI32Clz, 21, 0x00000405); + TestInt32Unop(execution_tier, kExprI32Clz, 22, 0x00000203); + TestInt32Unop(execution_tier, kExprI32Clz, 23, 0x00000101); + TestInt32Unop(execution_tier, kExprI32Clz, 24, 0x00000089); + TestInt32Unop(execution_tier, kExprI32Clz, 25, 0x00000041); + TestInt32Unop(execution_tier, kExprI32Clz, 26, 0x00000022); + TestInt32Unop(execution_tier, kExprI32Clz, 27, 0x00000013); + TestInt32Unop(execution_tier, kExprI32Clz, 28, 0x00000008); + TestInt32Unop(execution_tier, kExprI32Clz, 29, 0x00000004); + TestInt32Unop(execution_tier, kExprI32Clz, 30, 0x00000002); + TestInt32Unop(execution_tier, kExprI32Clz, 31, 0x00000001); + TestInt32Unop(execution_tier, kExprI32Clz, 32, 0x00000000); } WASM_EXEC_TEST(Int32Ctz) { - TestInt32Unop(execution_mode, kExprI32Ctz, 32, 0x00000000); - TestInt32Unop(execution_mode, kExprI32Ctz, 31, 0x80000000); - TestInt32Unop(execution_mode, kExprI32Ctz, 30, 0x40000000); - TestInt32Unop(execution_mode, kExprI32Ctz, 29, 0x20000000); - TestInt32Unop(execution_mode, kExprI32Ctz, 28, 0x10000000); - TestInt32Unop(execution_mode, kExprI32Ctz, 27, 0xA8000000); - TestInt32Unop(execution_mode, kExprI32Ctz, 26, 0xF4000000); - TestInt32Unop(execution_mode, kExprI32Ctz, 25, 0x62000000); - TestInt32Unop(execution_mode, kExprI32Ctz, 24, 0x91000000); - TestInt32Unop(execution_mode, kExprI32Ctz, 23, 0xCD800000); - TestInt32Unop(execution_mode, kExprI32Ctz, 22, 0x09400000); - TestInt32Unop(execution_mode, kExprI32Ctz, 21, 0xAF200000); - TestInt32Unop(execution_mode, kExprI32Ctz, 20, 0xAC100000); - TestInt32Unop(execution_mode, kExprI32Ctz, 19, 0xE0B80000); - TestInt32Unop(execution_mode, kExprI32Ctz, 18, 0x9CE40000); - TestInt32Unop(execution_mode, kExprI32Ctz, 17, 0xC7920000); - TestInt32Unop(execution_mode, kExprI32Ctz, 16, 0xB8F10000); - TestInt32Unop(execution_mode, kExprI32Ctz, 15, 0x3B9F8000); - TestInt32Unop(execution_mode, kExprI32Ctz, 14, 0xDB4C4000); - TestInt32Unop(execution_mode, kExprI32Ctz, 13, 0xE9A32000); - TestInt32Unop(execution_mode, kExprI32Ctz, 12, 0xFCA61000); - TestInt32Unop(execution_mode, kExprI32Ctz, 11, 0x6C8A7800); - TestInt32Unop(execution_mode, kExprI32Ctz, 10, 0x8CE5A400); - TestInt32Unop(execution_mode, kExprI32Ctz, 9, 0xCB7D0200); - TestInt32Unop(execution_mode, kExprI32Ctz, 8, 0xCB4DC100); - TestInt32Unop(execution_mode, kExprI32Ctz, 7, 0xDFBEC580); - TestInt32Unop(execution_mode, kExprI32Ctz, 6, 0x27A9DB40); - TestInt32Unop(execution_mode, kExprI32Ctz, 5, 0xDE3BCB20); - TestInt32Unop(execution_mode, kExprI32Ctz, 4, 0xD7E8A610); - TestInt32Unop(execution_mode, kExprI32Ctz, 3, 0x9AFDBC88); - TestInt32Unop(execution_mode, kExprI32Ctz, 2, 0x9AFDBC84); - TestInt32Unop(execution_mode, kExprI32Ctz, 1, 0x9AFDBC82); - TestInt32Unop(execution_mode, kExprI32Ctz, 0, 0x9AFDBC81); + TestInt32Unop(execution_tier, kExprI32Ctz, 32, 0x00000000); + TestInt32Unop(execution_tier, kExprI32Ctz, 31, 0x80000000); + TestInt32Unop(execution_tier, kExprI32Ctz, 30, 0x40000000); + TestInt32Unop(execution_tier, kExprI32Ctz, 29, 0x20000000); + TestInt32Unop(execution_tier, kExprI32Ctz, 28, 0x10000000); + TestInt32Unop(execution_tier, kExprI32Ctz, 27, 0xA8000000); + TestInt32Unop(execution_tier, kExprI32Ctz, 26, 0xF4000000); + TestInt32Unop(execution_tier, kExprI32Ctz, 25, 0x62000000); + TestInt32Unop(execution_tier, kExprI32Ctz, 24, 0x91000000); + TestInt32Unop(execution_tier, kExprI32Ctz, 23, 0xCD800000); + TestInt32Unop(execution_tier, kExprI32Ctz, 22, 0x09400000); + TestInt32Unop(execution_tier, kExprI32Ctz, 21, 0xAF200000); + TestInt32Unop(execution_tier, kExprI32Ctz, 20, 0xAC100000); + TestInt32Unop(execution_tier, kExprI32Ctz, 19, 0xE0B80000); + TestInt32Unop(execution_tier, kExprI32Ctz, 18, 0x9CE40000); + TestInt32Unop(execution_tier, kExprI32Ctz, 17, 0xC7920000); + TestInt32Unop(execution_tier, kExprI32Ctz, 16, 0xB8F10000); + TestInt32Unop(execution_tier, kExprI32Ctz, 15, 0x3B9F8000); + TestInt32Unop(execution_tier, kExprI32Ctz, 14, 0xDB4C4000); + TestInt32Unop(execution_tier, kExprI32Ctz, 13, 0xE9A32000); + TestInt32Unop(execution_tier, kExprI32Ctz, 12, 0xFCA61000); + TestInt32Unop(execution_tier, kExprI32Ctz, 11, 0x6C8A7800); + TestInt32Unop(execution_tier, kExprI32Ctz, 10, 0x8CE5A400); + TestInt32Unop(execution_tier, kExprI32Ctz, 9, 0xCB7D0200); + TestInt32Unop(execution_tier, kExprI32Ctz, 8, 0xCB4DC100); + TestInt32Unop(execution_tier, kExprI32Ctz, 7, 0xDFBEC580); + TestInt32Unop(execution_tier, kExprI32Ctz, 6, 0x27A9DB40); + TestInt32Unop(execution_tier, kExprI32Ctz, 5, 0xDE3BCB20); + TestInt32Unop(execution_tier, kExprI32Ctz, 4, 0xD7E8A610); + TestInt32Unop(execution_tier, kExprI32Ctz, 3, 0x9AFDBC88); + TestInt32Unop(execution_tier, kExprI32Ctz, 2, 0x9AFDBC84); + TestInt32Unop(execution_tier, kExprI32Ctz, 1, 0x9AFDBC82); + TestInt32Unop(execution_tier, kExprI32Ctz, 0, 0x9AFDBC81); } WASM_EXEC_TEST(Int32Popcnt) { - TestInt32Unop(execution_mode, kExprI32Popcnt, 32, 0xFFFFFFFF); - TestInt32Unop(execution_mode, kExprI32Popcnt, 0, 0x00000000); - TestInt32Unop(execution_mode, kExprI32Popcnt, 1, 0x00008000); - TestInt32Unop(execution_mode, kExprI32Popcnt, 13, 0x12345678); - TestInt32Unop(execution_mode, kExprI32Popcnt, 19, 0xFEDCBA09); + TestInt32Unop(execution_tier, kExprI32Popcnt, 32, 0xFFFFFFFF); + TestInt32Unop(execution_tier, kExprI32Popcnt, 0, 0x00000000); + TestInt32Unop(execution_tier, kExprI32Popcnt, 1, 0x00008000); + TestInt32Unop(execution_tier, kExprI32Popcnt, 13, 0x12345678); + TestInt32Unop(execution_tier, kExprI32Popcnt, 19, 0xFEDCBA09); } WASM_EXEC_TEST(I32Eqz) { - TestInt32Unop(execution_mode, kExprI32Eqz, 0, 1); - TestInt32Unop(execution_mode, kExprI32Eqz, 0, -1); - TestInt32Unop(execution_mode, kExprI32Eqz, 0, -827343); - TestInt32Unop(execution_mode, kExprI32Eqz, 0, 8888888); - TestInt32Unop(execution_mode, kExprI32Eqz, 1, 0); + TestInt32Unop(execution_tier, kExprI32Eqz, 0, 1); + TestInt32Unop(execution_tier, kExprI32Eqz, 0, -1); + TestInt32Unop(execution_tier, kExprI32Eqz, 0, -827343); + TestInt32Unop(execution_tier, kExprI32Eqz, 0, 8888888); + TestInt32Unop(execution_tier, kExprI32Eqz, 1, 0); } WASM_EXEC_TEST(Int32DivS_trap) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); BUILD(r, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); const int32_t kMin = std::numeric_limits<int32_t>::min(); CHECK_EQ(0, r.Call(0, 100)); @@ -338,7 +338,7 @@ WASM_EXEC_TEST(Int32DivS_trap) { } WASM_EXEC_TEST(Int32RemS_trap) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); const int32_t kMin = std::numeric_limits<int32_t>::min(); CHECK_EQ(33, r.Call(133, 100)); @@ -349,7 +349,7 @@ WASM_EXEC_TEST(Int32RemS_trap) { } WASM_EXEC_TEST(Int32DivU_trap) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); BUILD(r, WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); const int32_t kMin = std::numeric_limits<int32_t>::min(); CHECK_EQ(0, r.Call(0, 100)); @@ -360,7 +360,7 @@ WASM_EXEC_TEST(Int32DivU_trap) { } WASM_EXEC_TEST(Int32RemU_trap) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); BUILD(r, WASM_I32_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); CHECK_EQ(17, r.Call(217, 100)); const int32_t kMin = std::numeric_limits<int32_t>::min(); @@ -372,7 +372,7 @@ WASM_EXEC_TEST(Int32RemU_trap) { WASM_EXEC_TEST(Int32DivS_byzero_const) { for (int8_t denom = -2; denom < 8; ++denom) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_I32V_1(denom))); for (int32_t val = -7; val < 8; ++val) { if (denom == 0) { @@ -386,7 +386,7 @@ WASM_EXEC_TEST(Int32DivS_byzero_const) { WASM_EXEC_TEST(Int32AsmjsDivS_byzero_const) { for (int8_t denom = -2; denom < 8; ++denom) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); r.builder().ChangeOriginToAsmjs(); BUILD(r, WASM_I32_ASMJS_DIVS(WASM_GET_LOCAL(0), WASM_I32V_1(denom))); FOR_INT32_INPUTS(i) { @@ -403,7 +403,7 @@ WASM_EXEC_TEST(Int32AsmjsDivS_byzero_const) { WASM_EXEC_TEST(Int32AsmjsRemS_byzero_const) { for (int8_t denom = -2; denom < 8; ++denom) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); r.builder().ChangeOriginToAsmjs(); BUILD(r, WASM_I32_ASMJS_REMS(WASM_GET_LOCAL(0), WASM_I32V_1(denom))); FOR_INT32_INPUTS(i) { @@ -420,7 +420,7 @@ WASM_EXEC_TEST(Int32AsmjsRemS_byzero_const) { WASM_EXEC_TEST(Int32DivU_byzero_const) { for (uint32_t denom = 0xFFFFFFFE; denom < 8; ++denom) { - WasmRunner<uint32_t, uint32_t> r(execution_mode); + WasmRunner<uint32_t, uint32_t> r(execution_tier); BUILD(r, WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_I32V_1(denom))); for (uint32_t val = 0xFFFFFFF0; val < 8; ++val) { @@ -434,7 +434,7 @@ WASM_EXEC_TEST(Int32DivU_byzero_const) { } WASM_EXEC_TEST(Int32DivS_trap_effect) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); r.builder().AddMemory(kWasmPageSize); BUILD(r, WASM_IF_ELSE_I( @@ -455,34 +455,34 @@ WASM_EXEC_TEST(Int32DivS_trap_effect) { CHECK_TRAP(r.Call(0, 0)); } -void TestFloat32Binop(WasmExecutionMode execution_mode, WasmOpcode opcode, +void TestFloat32Binop(ExecutionTier execution_tier, WasmOpcode opcode, int32_t expected, float a, float b) { { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); // return K op K BUILD(r, WASM_BINOP(opcode, WASM_F32(a), WASM_F32(b))); CHECK_EQ(expected, r.Call()); } { - WasmRunner<int32_t, float, float> r(execution_mode); + WasmRunner<int32_t, float, float> r(execution_tier); // return a op b BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); CHECK_EQ(expected, r.Call(a, b)); } } -void TestFloat32BinopWithConvert(WasmExecutionMode execution_mode, +void TestFloat32BinopWithConvert(ExecutionTier execution_tier, WasmOpcode opcode, int32_t expected, float a, float b) { { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); // return int(K op K) BUILD(r, WASM_I32_SCONVERT_F32(WASM_BINOP(opcode, WASM_F32(a), WASM_F32(b)))); CHECK_EQ(expected, r.Call()); } { - WasmRunner<int32_t, float, float> r(execution_mode); + WasmRunner<int32_t, float, float> r(execution_tier); // return int(a op b) BUILD(r, WASM_I32_SCONVERT_F32( WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); @@ -490,66 +490,66 @@ void TestFloat32BinopWithConvert(WasmExecutionMode execution_mode, } } -void TestFloat32UnopWithConvert(WasmExecutionMode execution_mode, - WasmOpcode opcode, int32_t expected, float a) { +void TestFloat32UnopWithConvert(ExecutionTier execution_tier, WasmOpcode opcode, + int32_t expected, float a) { { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); // return int(op(K)) BUILD(r, WASM_I32_SCONVERT_F32(WASM_UNOP(opcode, WASM_F32(a)))); CHECK_EQ(expected, r.Call()); } { - WasmRunner<int32_t, float> r(execution_mode); + WasmRunner<int32_t, float> r(execution_tier); // return int(op(a)) BUILD(r, WASM_I32_SCONVERT_F32(WASM_UNOP(opcode, WASM_GET_LOCAL(0)))); CHECK_EQ(expected, r.Call(a)); } } -void TestFloat64Binop(WasmExecutionMode execution_mode, WasmOpcode opcode, +void TestFloat64Binop(ExecutionTier execution_tier, WasmOpcode opcode, int32_t expected, double a, double b) { { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); // return K op K BUILD(r, WASM_BINOP(opcode, WASM_F64(a), WASM_F64(b))); CHECK_EQ(expected, r.Call()); } { - WasmRunner<int32_t, double, double> r(execution_mode); + WasmRunner<int32_t, double, double> r(execution_tier); // return a op b BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); CHECK_EQ(expected, r.Call(a, b)); } } -void TestFloat64BinopWithConvert(WasmExecutionMode execution_mode, +void TestFloat64BinopWithConvert(ExecutionTier execution_tier, WasmOpcode opcode, int32_t expected, double a, double b) { { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); // return int(K op K) BUILD(r, WASM_I32_SCONVERT_F64(WASM_BINOP(opcode, WASM_F64(a), WASM_F64(b)))); CHECK_EQ(expected, r.Call()); } { - WasmRunner<int32_t, double, double> r(execution_mode); + WasmRunner<int32_t, double, double> r(execution_tier); BUILD(r, WASM_I32_SCONVERT_F64( WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); CHECK_EQ(expected, r.Call(a, b)); } } -void TestFloat64UnopWithConvert(WasmExecutionMode execution_mode, - WasmOpcode opcode, int32_t expected, double a) { +void TestFloat64UnopWithConvert(ExecutionTier execution_tier, WasmOpcode opcode, + int32_t expected, double a) { { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); // return int(op(K)) BUILD(r, WASM_I32_SCONVERT_F64(WASM_UNOP(opcode, WASM_F64(a)))); CHECK_EQ(expected, r.Call()); } { - WasmRunner<int32_t, double> r(execution_mode); + WasmRunner<int32_t, double> r(execution_tier); // return int(op(a)) BUILD(r, WASM_I32_SCONVERT_F64(WASM_UNOP(opcode, WASM_GET_LOCAL(0)))); CHECK_EQ(expected, r.Call(a)); @@ -557,50 +557,50 @@ void TestFloat64UnopWithConvert(WasmExecutionMode execution_mode, } WASM_EXEC_TEST(Float32Binops) { - TestFloat32Binop(execution_mode, kExprF32Eq, 1, 8.125f, 8.125f); - TestFloat32Binop(execution_mode, kExprF32Ne, 1, 8.125f, 8.127f); - TestFloat32Binop(execution_mode, kExprF32Lt, 1, -9.5f, -9.0f); - TestFloat32Binop(execution_mode, kExprF32Le, 1, -1111.0f, -1111.0f); - TestFloat32Binop(execution_mode, kExprF32Gt, 1, -9.0f, -9.5f); - TestFloat32Binop(execution_mode, kExprF32Ge, 1, -1111.0f, -1111.0f); + TestFloat32Binop(execution_tier, kExprF32Eq, 1, 8.125f, 8.125f); + TestFloat32Binop(execution_tier, kExprF32Ne, 1, 8.125f, 8.127f); + TestFloat32Binop(execution_tier, kExprF32Lt, 1, -9.5f, -9.0f); + TestFloat32Binop(execution_tier, kExprF32Le, 1, -1111.0f, -1111.0f); + TestFloat32Binop(execution_tier, kExprF32Gt, 1, -9.0f, -9.5f); + TestFloat32Binop(execution_tier, kExprF32Ge, 1, -1111.0f, -1111.0f); - TestFloat32BinopWithConvert(execution_mode, kExprF32Add, 10, 3.5f, 6.5f); - TestFloat32BinopWithConvert(execution_mode, kExprF32Sub, 2, 44.5f, 42.5f); - TestFloat32BinopWithConvert(execution_mode, kExprF32Mul, -66, -132.1f, 0.5f); - TestFloat32BinopWithConvert(execution_mode, kExprF32Div, 11, 22.1f, 2.0f); + TestFloat32BinopWithConvert(execution_tier, kExprF32Add, 10, 3.5f, 6.5f); + TestFloat32BinopWithConvert(execution_tier, kExprF32Sub, 2, 44.5f, 42.5f); + TestFloat32BinopWithConvert(execution_tier, kExprF32Mul, -66, -132.1f, 0.5f); + TestFloat32BinopWithConvert(execution_tier, kExprF32Div, 11, 22.1f, 2.0f); } WASM_EXEC_TEST(Float32Unops) { - TestFloat32UnopWithConvert(execution_mode, kExprF32Abs, 8, 8.125f); - TestFloat32UnopWithConvert(execution_mode, kExprF32Abs, 9, -9.125f); - TestFloat32UnopWithConvert(execution_mode, kExprF32Neg, -213, 213.125f); - TestFloat32UnopWithConvert(execution_mode, kExprF32Sqrt, 12, 144.4f); + TestFloat32UnopWithConvert(execution_tier, kExprF32Abs, 8, 8.125f); + TestFloat32UnopWithConvert(execution_tier, kExprF32Abs, 9, -9.125f); + TestFloat32UnopWithConvert(execution_tier, kExprF32Neg, -213, 213.125f); + TestFloat32UnopWithConvert(execution_tier, kExprF32Sqrt, 12, 144.4f); } WASM_EXEC_TEST(Float64Binops) { - TestFloat64Binop(execution_mode, kExprF64Eq, 1, 16.25, 16.25); - TestFloat64Binop(execution_mode, kExprF64Ne, 1, 16.25, 16.15); - TestFloat64Binop(execution_mode, kExprF64Lt, 1, -32.4, 11.7); - TestFloat64Binop(execution_mode, kExprF64Le, 1, -88.9, -88.9); - TestFloat64Binop(execution_mode, kExprF64Gt, 1, 11.7, -32.4); - TestFloat64Binop(execution_mode, kExprF64Ge, 1, -88.9, -88.9); - - TestFloat64BinopWithConvert(execution_mode, kExprF64Add, 100, 43.5, 56.5); - TestFloat64BinopWithConvert(execution_mode, kExprF64Sub, 200, 12200.1, + TestFloat64Binop(execution_tier, kExprF64Eq, 1, 16.25, 16.25); + TestFloat64Binop(execution_tier, kExprF64Ne, 1, 16.25, 16.15); + TestFloat64Binop(execution_tier, kExprF64Lt, 1, -32.4, 11.7); + TestFloat64Binop(execution_tier, kExprF64Le, 1, -88.9, -88.9); + TestFloat64Binop(execution_tier, kExprF64Gt, 1, 11.7, -32.4); + TestFloat64Binop(execution_tier, kExprF64Ge, 1, -88.9, -88.9); + + TestFloat64BinopWithConvert(execution_tier, kExprF64Add, 100, 43.5, 56.5); + TestFloat64BinopWithConvert(execution_tier, kExprF64Sub, 200, 12200.1, 12000.1); - TestFloat64BinopWithConvert(execution_mode, kExprF64Mul, -33, 134, -0.25); - TestFloat64BinopWithConvert(execution_mode, kExprF64Div, -1111, -2222.3, 2); + TestFloat64BinopWithConvert(execution_tier, kExprF64Mul, -33, 134, -0.25); + TestFloat64BinopWithConvert(execution_tier, kExprF64Div, -1111, -2222.3, 2); } WASM_EXEC_TEST(Float64Unops) { - TestFloat64UnopWithConvert(execution_mode, kExprF64Abs, 108, 108.125); - TestFloat64UnopWithConvert(execution_mode, kExprF64Abs, 209, -209.125); - TestFloat64UnopWithConvert(execution_mode, kExprF64Neg, -209, 209.125); - TestFloat64UnopWithConvert(execution_mode, kExprF64Sqrt, 13, 169.4); + TestFloat64UnopWithConvert(execution_tier, kExprF64Abs, 108, 108.125); + TestFloat64UnopWithConvert(execution_tier, kExprF64Abs, 209, -209.125); + TestFloat64UnopWithConvert(execution_tier, kExprF64Neg, -209, 209.125); + TestFloat64UnopWithConvert(execution_tier, kExprF64Sqrt, 13, 169.4); } WASM_EXEC_TEST(Float32Neg) { - WasmRunner<float, float> r(execution_mode); + WasmRunner<float, float> r(execution_tier); BUILD(r, WASM_F32_NEG(WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { @@ -610,7 +610,7 @@ WASM_EXEC_TEST(Float32Neg) { } WASM_EXEC_TEST(Float64Neg) { - WasmRunner<double, double> r(execution_mode); + WasmRunner<double, double> r(execution_tier); BUILD(r, WASM_F64_NEG(WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { @@ -620,7 +620,7 @@ WASM_EXEC_TEST(Float64Neg) { } WASM_EXEC_TEST(IfElse_P) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); // if (p0) return 11; else return 22; BUILD(r, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), // -- WASM_I32V_1(11), // -- @@ -632,34 +632,34 @@ WASM_EXEC_TEST(IfElse_P) { } WASM_EXEC_TEST(If_empty1) { - WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode); + WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier); BUILD(r, WASM_GET_LOCAL(0), kExprIf, kLocalVoid, kExprEnd, WASM_GET_LOCAL(1)); FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 9, *i)); } } WASM_EXEC_TEST(IfElse_empty1) { - WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode); + WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier); BUILD(r, WASM_GET_LOCAL(0), kExprIf, kLocalVoid, kExprElse, kExprEnd, WASM_GET_LOCAL(1)); FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 8, *i)); } } WASM_EXEC_TEST(IfElse_empty2) { - WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode); + WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier); BUILD(r, WASM_GET_LOCAL(0), kExprIf, kLocalVoid, WASM_NOP, kExprElse, kExprEnd, WASM_GET_LOCAL(1)); FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 7, *i)); } } WASM_EXEC_TEST(IfElse_empty3) { - WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode); + WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier); BUILD(r, WASM_GET_LOCAL(0), kExprIf, kLocalVoid, kExprElse, WASM_NOP, kExprEnd, WASM_GET_LOCAL(1)); FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 6, *i)); } } WASM_EXEC_TEST(If_chain1) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); // if (p0) 13; if (p0) 14; 15 BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_NOP), WASM_IF(WASM_GET_LOCAL(0), WASM_NOP), WASM_I32V_1(15)); @@ -667,7 +667,7 @@ WASM_EXEC_TEST(If_chain1) { } WASM_EXEC_TEST(If_chain_set) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); // if (p0) p1 = 73; if (p0) p1 = 74; p1 BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(1, WASM_I32V_2(73))), WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(1, WASM_I32V_2(74))), @@ -679,7 +679,7 @@ WASM_EXEC_TEST(If_chain_set) { } WASM_EXEC_TEST(IfElse_Unreachable1) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); // 0 ? unreachable : 27 BUILD(r, WASM_IF_ELSE_I(WASM_ZERO, // -- WASM_UNREACHABLE, // -- @@ -688,7 +688,7 @@ WASM_EXEC_TEST(IfElse_Unreachable1) { } WASM_EXEC_TEST(IfElse_Unreachable2) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); // 1 ? 28 : unreachable BUILD(r, WASM_IF_ELSE_I(WASM_I32V_1(1), // -- WASM_I32V_1(28), // -- @@ -697,21 +697,21 @@ WASM_EXEC_TEST(IfElse_Unreachable2) { } WASM_EXEC_TEST(Return12) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); BUILD(r, RET_I8(12)); CHECK_EQ(12, r.Call()); } WASM_EXEC_TEST(Return17) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); BUILD(r, WASM_BLOCK(RET_I8(17)), WASM_ZERO); CHECK_EQ(17, r.Call()); } WASM_EXEC_TEST(Return_I32) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, RET(WASM_GET_LOCAL(0))); @@ -719,7 +719,7 @@ WASM_EXEC_TEST(Return_I32) { } WASM_EXEC_TEST(Return_F32) { - WasmRunner<float, float> r(execution_mode); + WasmRunner<float, float> r(execution_tier); BUILD(r, RET(WASM_GET_LOCAL(0))); @@ -735,7 +735,7 @@ WASM_EXEC_TEST(Return_F32) { } WASM_EXEC_TEST(Return_F64) { - WasmRunner<double, double> r(execution_mode); + WasmRunner<double, double> r(execution_tier); BUILD(r, RET(WASM_GET_LOCAL(0))); @@ -751,7 +751,7 @@ WASM_EXEC_TEST(Return_F64) { } WASM_EXEC_TEST(Select_float_parameters) { - WasmRunner<float, float, float, int32_t> r(execution_mode); + WasmRunner<float, float, float, int32_t> r(execution_tier); // return select(11, 22, a); BUILD(r, WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_GET_LOCAL(2))); @@ -759,7 +759,7 @@ WASM_EXEC_TEST(Select_float_parameters) { } WASM_EXEC_TEST(Select) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); // return select(11, 22, a); BUILD(r, WASM_SELECT(WASM_I32V_1(11), WASM_I32V_1(22), WASM_GET_LOCAL(0))); FOR_INT32_INPUTS(i) { @@ -769,7 +769,7 @@ WASM_EXEC_TEST(Select) { } WASM_EXEC_TEST(Select_strict1) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); // select(a=0, a=1, a=2); return a BUILD(r, WASM_SELECT(WASM_TEE_LOCAL(0, WASM_ZERO), WASM_TEE_LOCAL(0, WASM_I32V_1(1)), @@ -779,7 +779,7 @@ WASM_EXEC_TEST(Select_strict1) { } WASM_EXEC_TEST(Select_strict2) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); r.AllocateLocal(kWasmI32); r.AllocateLocal(kWasmI32); // select(b=5, c=6, a) @@ -792,7 +792,7 @@ WASM_EXEC_TEST(Select_strict2) { } WASM_EXEC_TEST(Select_strict3) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); r.AllocateLocal(kWasmI32); r.AllocateLocal(kWasmI32); // select(b=5, c=6, a=b) @@ -806,7 +806,7 @@ WASM_EXEC_TEST(Select_strict3) { } WASM_EXEC_TEST(BrIf_strict) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I(WASM_BRV_IF(0, WASM_GET_LOCAL(0), WASM_TEE_LOCAL(0, WASM_I32V_2(99))))); @@ -814,7 +814,7 @@ WASM_EXEC_TEST(BrIf_strict) { } WASM_EXEC_TEST(Br_height) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I( WASM_BLOCK(WASM_BRV_IFD(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)), WASM_RETURN1(WASM_I32V_1(9))), @@ -827,7 +827,7 @@ WASM_EXEC_TEST(Br_height) { } WASM_EXEC_TEST(Regression_660262) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); r.builder().AddMemory(kWasmPageSize); BUILD(r, kExprI32Const, 0x00, kExprI32Const, 0x00, kExprI32LoadMem, 0x00, 0x0F, kExprBrTable, 0x00, 0x80, 0x00); // entries=0 @@ -835,14 +835,14 @@ WASM_EXEC_TEST(Regression_660262) { } WASM_EXEC_TEST(BrTable0a) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, B1(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(0)))), WASM_I32V_2(91)); FOR_INT32_INPUTS(i) { CHECK_EQ(91, r.Call(*i)); } } WASM_EXEC_TEST(BrTable0b) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, B1(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(0), BR_TARGET(0)))), WASM_I32V_2(92)); @@ -850,7 +850,7 @@ WASM_EXEC_TEST(BrTable0b) { } WASM_EXEC_TEST(BrTable0c) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD( r, B1(B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(0), BR_TARGET(1))), @@ -863,13 +863,13 @@ WASM_EXEC_TEST(BrTable0c) { } WASM_EXEC_TEST(BrTable1) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(0))), RET_I8(93)); FOR_INT32_INPUTS(i) { CHECK_EQ(93, r.Call(*i)); } } WASM_EXEC_TEST(BrTable_loop) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, B2(B1(WASM_LOOP(WASM_BR_TABLE(WASM_INC_LOCAL_BYV(0, 1), 2, BR_TARGET(2), BR_TARGET(1), BR_TARGET(0)))), @@ -883,7 +883,7 @@ WASM_EXEC_TEST(BrTable_loop) { } WASM_EXEC_TEST(BrTable_br) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(1), BR_TARGET(0))), RET_I8(91)), @@ -895,7 +895,7 @@ WASM_EXEC_TEST(BrTable_br) { } WASM_EXEC_TEST(BrTable_br2) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, B2(B2(B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 3, BR_TARGET(1), BR_TARGET(2), BR_TARGET(3), BR_TARGET(0))), @@ -926,7 +926,7 @@ WASM_EXEC_TEST(BrTable4) { RET_I8(73)), WASM_I32V_2(75)}; - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); r.Build(code, code + arraysize(code)); for (int x = -3; x < 50; ++x) { @@ -956,7 +956,7 @@ WASM_EXEC_TEST(BrTable4x4) { RET_I8(53)), WASM_I32V_2(55)}; - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); r.Build(code, code + arraysize(code)); for (int x = -6; x < 47; ++x) { @@ -981,7 +981,7 @@ WASM_EXEC_TEST(BrTable4_fallthru) { WASM_INC_LOCAL_BY(1, 8)), WASM_GET_LOCAL(1)}; - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); r.Build(code, code + arraysize(code)); CHECK_EQ(15, r.Call(0, 0)); @@ -1005,14 +1005,14 @@ WASM_EXEC_TEST(BrTable_loop_target) { BR_TARGET(0), BR_TARGET(1), BR_TARGET(1))), WASM_ONE)}; - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); r.Build(code, code + arraysize(code)); CHECK_EQ(1, r.Call(0)); } WASM_EXEC_TEST(F32ReinterpretI32) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); int32_t* memory = r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t)); @@ -1027,7 +1027,7 @@ WASM_EXEC_TEST(F32ReinterpretI32) { } WASM_EXEC_TEST(I32ReinterpretF32) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); int32_t* memory = r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t)); @@ -1046,7 +1046,7 @@ WASM_EXEC_TEST(I32ReinterpretF32) { #ifndef USE_SIMULATOR WASM_EXEC_TEST(SignallingNanSurvivesI32ReinterpretF32) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); BUILD(r, WASM_I32_REINTERPRET_F32( WASM_SEQ(kExprF32Const, 0x00, 0x00, 0xA0, 0x7F))); @@ -1058,7 +1058,7 @@ WASM_EXEC_TEST(SignallingNanSurvivesI32ReinterpretF32) { #endif WASM_EXEC_TEST(LoadMaxUint32Offset) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); r.builder().AddMemory(kWasmPageSize); BUILD(r, WASM_LOAD_MEM_OFFSET(MachineType::Int32(), // type @@ -1069,7 +1069,7 @@ WASM_EXEC_TEST(LoadMaxUint32Offset) { } WASM_EXEC_TEST(LoadStoreLoad) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); int32_t* memory = r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t)); @@ -1085,28 +1085,28 @@ WASM_EXEC_TEST(LoadStoreLoad) { } WASM_EXEC_TEST(UnalignedFloat32Load) { - WasmRunner<float> r(execution_mode); + WasmRunner<float> r(execution_tier); r.builder().AddMemory(kWasmPageSize); BUILD(r, WASM_LOAD_MEM_ALIGNMENT(MachineType::Float32(), WASM_ONE, 2)); r.Call(); } WASM_EXEC_TEST(UnalignedFloat64Load) { - WasmRunner<double> r(execution_mode); + WasmRunner<double> r(execution_tier); r.builder().AddMemory(kWasmPageSize); BUILD(r, WASM_LOAD_MEM_ALIGNMENT(MachineType::Float64(), WASM_ONE, 3)); r.Call(); } WASM_EXEC_TEST(UnalignedInt32Load) { - WasmRunner<uint32_t> r(execution_mode); + WasmRunner<uint32_t> r(execution_tier); r.builder().AddMemory(kWasmPageSize); BUILD(r, WASM_LOAD_MEM_ALIGNMENT(MachineType::Int32(), WASM_ONE, 2)); r.Call(); } WASM_EXEC_TEST(UnalignedInt32Store) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); r.builder().AddMemory(kWasmPageSize); BUILD(r, WASM_SEQ(WASM_STORE_MEM_ALIGNMENT(MachineType::Int32(), WASM_ONE, 2, WASM_I32V_1(1)), @@ -1115,7 +1115,7 @@ WASM_EXEC_TEST(UnalignedInt32Store) { } WASM_EXEC_TEST(UnalignedFloat32Store) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); r.builder().AddMemory(kWasmPageSize); BUILD(r, WASM_SEQ(WASM_STORE_MEM_ALIGNMENT(MachineType::Float32(), WASM_ONE, 2, WASM_F32(1.0)), @@ -1124,7 +1124,7 @@ WASM_EXEC_TEST(UnalignedFloat32Store) { } WASM_EXEC_TEST(UnalignedFloat64Store) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); r.builder().AddMemory(kWasmPageSize); BUILD(r, WASM_SEQ(WASM_STORE_MEM_ALIGNMENT(MachineType::Float64(), WASM_ONE, 3, WASM_F64(1.0)), @@ -1134,7 +1134,7 @@ WASM_EXEC_TEST(UnalignedFloat64Store) { WASM_EXEC_TEST(VoidReturn1) { const int32_t kExpected = -414444; - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); // Build the test function. WasmFunctionCompiler& test_func = r.NewFunction<void>(); @@ -1151,7 +1151,7 @@ WASM_EXEC_TEST(VoidReturn1) { WASM_EXEC_TEST(VoidReturn2) { const int32_t kExpected = -414444; - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); // Build the test function. WasmFunctionCompiler& test_func = r.NewFunction<void>(); @@ -1167,67 +1167,67 @@ WASM_EXEC_TEST(VoidReturn2) { } WASM_EXEC_TEST(BrEmpty) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_BRV(0, WASM_GET_LOCAL(0))); FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } } WASM_EXEC_TEST(BrIfEmpty) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_BRV_IF(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(0))); FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } } WASM_EXEC_TEST(Block_empty) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, kExprBlock, kLocalVoid, kExprEnd, WASM_GET_LOCAL(0)); FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } } WASM_EXEC_TEST(Block_empty_br1) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, B1(WASM_BR(0)), WASM_GET_LOCAL(0)); FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } } WASM_EXEC_TEST(Block_empty_brif1) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_ZERO)), WASM_GET_LOCAL(0)); FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } } WASM_EXEC_TEST(Block_empty_brif2) { - WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode); + WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier); BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_GET_LOCAL(1))), WASM_GET_LOCAL(0)); FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i, *i + 1)); } } WASM_EXEC_TEST(Block_i) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I(WASM_GET_LOCAL(0))); FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } } WASM_EXEC_TEST(Block_f) { - WasmRunner<float, float> r(execution_mode); + WasmRunner<float, float> r(execution_tier); BUILD(r, WASM_BLOCK_F(WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(*i, r.Call(*i)); } } WASM_EXEC_TEST(Block_d) { - WasmRunner<double, double> r(execution_mode); + WasmRunner<double, double> r(execution_tier); BUILD(r, WASM_BLOCK_D(WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { CHECK_FLOAT_EQ(*i, r.Call(*i)); } } WASM_EXEC_TEST(Block_br2) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0)))); FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, static_cast<uint32_t>(r.Call(*i))); } } WASM_EXEC_TEST(Block_If_P) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); // block { if (p0) break 51; 52; } BUILD(r, WASM_BLOCK_I( // -- WASM_IF(WASM_GET_LOCAL(0), // -- @@ -1240,49 +1240,49 @@ WASM_EXEC_TEST(Block_If_P) { } WASM_EXEC_TEST(Loop_empty) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, kExprLoop, kLocalVoid, kExprEnd, WASM_GET_LOCAL(0)); FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } } WASM_EXEC_TEST(Loop_i) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_LOOP_I(WASM_GET_LOCAL(0))); FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } } WASM_EXEC_TEST(Loop_f) { - WasmRunner<float, float> r(execution_mode); + WasmRunner<float, float> r(execution_tier); BUILD(r, WASM_LOOP_F(WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(*i, r.Call(*i)); } } WASM_EXEC_TEST(Loop_d) { - WasmRunner<double, double> r(execution_mode); + WasmRunner<double, double> r(execution_tier); BUILD(r, WASM_LOOP_D(WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { CHECK_FLOAT_EQ(*i, r.Call(*i)); } } WASM_EXEC_TEST(Loop_empty_br1) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, B1(WASM_LOOP(WASM_BR(1))), WASM_GET_LOCAL(0)); FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } } WASM_EXEC_TEST(Loop_empty_brif1) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, B1(WASM_LOOP(WASM_BR_IF(1, WASM_ZERO))), WASM_GET_LOCAL(0)); FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } } WASM_EXEC_TEST(Loop_empty_brif2) { - WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode); + WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier); BUILD(r, WASM_LOOP_I(WASM_BRV_IF(1, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i, *i + 1)); } } WASM_EXEC_TEST(Loop_empty_brif3) { - WasmRunner<uint32_t, uint32_t, uint32_t, uint32_t> r(execution_mode); + WasmRunner<uint32_t, uint32_t, uint32_t, uint32_t> r(execution_tier); BUILD(r, WASM_LOOP(WASM_BRV_IFD(1, WASM_GET_LOCAL(2), WASM_GET_LOCAL(0))), WASM_GET_LOCAL(1)); FOR_UINT32_INPUTS(i) { @@ -1294,7 +1294,7 @@ WASM_EXEC_TEST(Loop_empty_brif3) { } WASM_EXEC_TEST(Block_BrIf_P) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I(WASM_BRV_IFD(0, WASM_I32V_1(51), WASM_GET_LOCAL(0)), WASM_I32V_1(52))); FOR_INT32_INPUTS(i) { @@ -1304,7 +1304,7 @@ WASM_EXEC_TEST(Block_BrIf_P) { } WASM_EXEC_TEST(Block_IfElse_P_assign) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); // { if (p0) p0 = 71; else p0 = 72; return p0; } BUILD(r, // -- WASM_IF_ELSE(WASM_GET_LOCAL(0), // -- @@ -1318,7 +1318,7 @@ WASM_EXEC_TEST(Block_IfElse_P_assign) { } WASM_EXEC_TEST(Block_IfElse_P_return) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); // if (p0) return 81; else return 82; BUILD(r, // -- WASM_IF_ELSE(WASM_GET_LOCAL(0), // -- @@ -1332,7 +1332,7 @@ WASM_EXEC_TEST(Block_IfElse_P_return) { } WASM_EXEC_TEST(Block_If_P_assign) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); // { if (p0) p0 = 61; p0; } BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_I32V_1(61))), WASM_GET_LOCAL(0)); @@ -1343,14 +1343,14 @@ WASM_EXEC_TEST(Block_If_P_assign) { } WASM_EXEC_TEST(DanglingAssign) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); // { return 0; p0 = 0; } BUILD(r, WASM_BLOCK_I(RET_I8(99), WASM_TEE_LOCAL(0, WASM_ZERO))); CHECK_EQ(99, r.Call(1)); } WASM_EXEC_TEST(ExprIf_P) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); // p0 ? 11 : 22; BUILD(r, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), // -- WASM_I32V_1(11), // -- @@ -1362,7 +1362,7 @@ WASM_EXEC_TEST(ExprIf_P) { } WASM_EXEC_TEST(CountDown) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_LOOP(WASM_IFB(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I32V_1(1))), @@ -1374,7 +1374,7 @@ WASM_EXEC_TEST(CountDown) { } WASM_EXEC_TEST(CountDown_fallthru) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD( r, WASM_LOOP( @@ -1388,7 +1388,7 @@ WASM_EXEC_TEST(CountDown_fallthru) { } WASM_EXEC_TEST(WhileCountDown) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_WHILE(WASM_GET_LOCAL(0), WASM_SET_LOCAL( 0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I32V_1(1)))), @@ -1399,7 +1399,7 @@ WASM_EXEC_TEST(WhileCountDown) { } WASM_EXEC_TEST(Loop_if_break1) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); BUILD(r, WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(2, WASM_GET_LOCAL(1))), WASM_SET_LOCAL(0, WASM_I32V_2(99))), WASM_GET_LOCAL(0)); @@ -1410,7 +1410,7 @@ WASM_EXEC_TEST(Loop_if_break1) { } WASM_EXEC_TEST(Loop_if_break2) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); BUILD(r, WASM_LOOP(WASM_BRV_IF(1, WASM_GET_LOCAL(1), WASM_GET_LOCAL(0)), WASM_DROP, WASM_SET_LOCAL(0, WASM_I32V_2(99))), WASM_GET_LOCAL(0)); @@ -1421,7 +1421,7 @@ WASM_EXEC_TEST(Loop_if_break2) { } WASM_EXEC_TEST(Loop_if_break_fallthru) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, B1(WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BR(2)), WASM_SET_LOCAL(0, WASM_I32V_2(93)))), WASM_GET_LOCAL(0)); @@ -1432,7 +1432,7 @@ WASM_EXEC_TEST(Loop_if_break_fallthru) { } WASM_EXEC_TEST(Loop_if_break_fallthru2) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, B1(B1(WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BR(2)), WASM_SET_LOCAL(0, WASM_I32V_2(93))))), WASM_GET_LOCAL(0)); @@ -1443,7 +1443,7 @@ WASM_EXEC_TEST(Loop_if_break_fallthru2) { } WASM_EXEC_TEST(IfBreak1) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SEQ(WASM_BR(0), WASM_UNREACHABLE)), WASM_I32V_2(91)); CHECK_EQ(91, r.Call(0)); @@ -1452,7 +1452,7 @@ WASM_EXEC_TEST(IfBreak1) { } WASM_EXEC_TEST(IfBreak2) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SEQ(WASM_BR(0), RET_I8(77))), WASM_I32V_2(81)); CHECK_EQ(81, r.Call(0)); @@ -1461,7 +1461,7 @@ WASM_EXEC_TEST(IfBreak2) { } WASM_EXEC_TEST(LoadMemI32) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); int32_t* memory = r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t)); r.builder().RandomizeMemory(1111); @@ -1480,7 +1480,7 @@ WASM_EXEC_TEST(LoadMemI32) { WASM_EXEC_TEST(LoadMemI32_alignment) { for (byte alignment = 0; alignment <= 2; ++alignment) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); int32_t* memory = r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t)); r.builder().RandomizeMemory(1111); @@ -1500,7 +1500,7 @@ WASM_EXEC_TEST(LoadMemI32_alignment) { } WASM_EXEC_TEST(LoadMemI32_oob) { - WasmRunner<int32_t, uint32_t> r(execution_mode); + WasmRunner<int32_t, uint32_t> r(execution_tier); int32_t* memory = r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t)); r.builder().RandomizeMemory(1111); @@ -1529,7 +1529,7 @@ WASM_EXEC_TEST(LoadMem_offset_oob) { constexpr size_t num_bytes = kWasmPageSize; for (size_t m = 0; m < arraysize(machineTypes); ++m) { - WasmRunner<int32_t, uint32_t> r(execution_mode); + WasmRunner<int32_t, uint32_t> r(execution_tier); r.builder().AddMemoryElems<byte>(num_bytes); r.builder().RandomizeMemory(1116 + static_cast<int>(m)); @@ -1549,7 +1549,7 @@ WASM_EXEC_TEST(LoadMem_offset_oob) { } WASM_EXEC_TEST(LoadMemI32_offset) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); int32_t* memory = r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t)); r.builder().RandomizeMemory(1111); @@ -1581,7 +1581,7 @@ WASM_EXEC_TEST(LoadMemI32_const_oob_misaligned) { for (byte offset = 0; offset < kRunwayLength + 5; ++offset) { for (uint32_t index = kWasmPageSize - kRunwayLength; index < kWasmPageSize + 5; ++index) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); r.builder().AddMemoryElems<byte>(kWasmPageSize); r.builder().RandomizeMemory(); @@ -1604,7 +1604,7 @@ WASM_EXEC_TEST(LoadMemI32_const_oob) { for (byte offset = 0; offset < kRunwayLength + 5; offset += 4) { for (uint32_t index = kWasmPageSize - kRunwayLength; index < kWasmPageSize + 5; index += 4) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); r.builder().AddMemoryElems<byte>(kWasmPageSize); r.builder().RandomizeMemory(); @@ -1624,7 +1624,7 @@ WASM_EXEC_TEST(StoreMemI32_alignment) { const int32_t kWritten = 0x12345678; for (byte i = 0; i <= 2; ++i) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); int32_t* memory = r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t)); BUILD(r, WASM_STORE_MEM_ALIGNMENT(MachineType::Int32(), WASM_ZERO, i, @@ -1639,7 +1639,7 @@ WASM_EXEC_TEST(StoreMemI32_alignment) { } WASM_EXEC_TEST(StoreMemI32_offset) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); int32_t* memory = r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t)); const int32_t kWritten = 0xAABBCCDD; @@ -1672,7 +1672,7 @@ WASM_EXEC_TEST(StoreMem_offset_oob) { constexpr size_t num_bytes = kWasmPageSize; for (size_t m = 0; m < arraysize(machineTypes); ++m) { - WasmRunner<int32_t, uint32_t> r(execution_mode); + WasmRunner<int32_t, uint32_t> r(execution_tier); byte* memory = r.builder().AddMemoryElems<byte>(num_bytes); r.builder().RandomizeMemory(1119 + static_cast<int>(m)); @@ -1700,7 +1700,7 @@ WASM_EXEC_TEST(Store_i32_narrowed) { stored_size_in_bytes = std::max(1, stored_size_in_bytes * 2); constexpr int kBytes = 24; uint8_t expected_memory[kBytes] = {0}; - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize); constexpr uint32_t kPattern = 0x12345678; @@ -1724,7 +1724,7 @@ WASM_EXEC_TEST(Store_i32_narrowed) { WASM_EXEC_TEST(LoadMemI32_P) { const int kNumElems = 8; - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); int32_t* memory = r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t)); r.builder().RandomizeMemory(2222); @@ -1738,7 +1738,7 @@ WASM_EXEC_TEST(LoadMemI32_P) { WASM_EXEC_TEST(MemI32_Sum) { const int kNumElems = 20; - WasmRunner<uint32_t, int32_t> r(execution_mode); + WasmRunner<uint32_t, int32_t> r(execution_tier); uint32_t* memory = r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(int32_t)); const byte kSum = r.AllocateLocal(kWasmI32); @@ -1768,7 +1768,7 @@ WASM_EXEC_TEST(MemI32_Sum) { WASM_EXEC_TEST(CheckMachIntsZero) { const int kNumElems = 55; - WasmRunner<uint32_t, int32_t> r(execution_mode); + WasmRunner<uint32_t, int32_t> r(execution_tier); r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t)); BUILD(r, // -- @@ -1796,7 +1796,7 @@ WASM_EXEC_TEST(CheckMachIntsZero) { WASM_EXEC_TEST(MemF32_Sum) { const int kSize = 5; - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); r.builder().AddMemoryElems<float>(kWasmPageSize / sizeof(float)); float* buffer = r.builder().raw_mem_start<float>(); r.builder().WriteMemory(&buffer[0], -99.25f); @@ -1824,10 +1824,9 @@ WASM_EXEC_TEST(MemF32_Sum) { } template <typename T> -T GenerateAndRunFold(WasmExecutionMode execution_mode, WasmOpcode binop, - T* buffer, uint32_t size, ValueType astType, - MachineType memType) { - WasmRunner<int32_t, int32_t> r(execution_mode); +T GenerateAndRunFold(ExecutionTier execution_tier, WasmOpcode binop, T* buffer, + uint32_t size, ValueType astType, MachineType memType) { + WasmRunner<int32_t, int32_t> r(execution_tier); T* memory = r.builder().AddMemoryElems<T>(static_cast<uint32_t>( RoundUp(size * sizeof(T), kWasmPageSize) / sizeof(sizeof(T)))); for (uint32_t i = 0; i < size; ++i) { @@ -1855,19 +1854,19 @@ WASM_EXEC_TEST(MemF64_Mul) { const size_t kSize = 6; double buffer[kSize] = {1, 2, 2, 2, 2, 2}; double result = - GenerateAndRunFold<double>(execution_mode, kExprF64Mul, buffer, kSize, + GenerateAndRunFold<double>(execution_tier, kExprF64Mul, buffer, kSize, kWasmF64, MachineType::Float64()); CHECK_EQ(32, result); } WASM_EXEC_TEST(Build_Wasm_Infinite_Loop) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); // Only build the graph and compile, don't run. BUILD(r, WASM_INFINITE_LOOP, WASM_ZERO); } WASM_EXEC_TEST(Build_Wasm_Infinite_Loop_effect) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); r.builder().AddMemory(kWasmPageSize); // Only build the graph and compile, don't run. @@ -1876,49 +1875,49 @@ WASM_EXEC_TEST(Build_Wasm_Infinite_Loop_effect) { } WASM_EXEC_TEST(Unreachable0a) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_I32V_1(9)), RET(WASM_GET_LOCAL(0)))); CHECK_EQ(9, r.Call(0)); CHECK_EQ(9, r.Call(1)); } WASM_EXEC_TEST(Unreachable0b) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_I32V_1(7)), WASM_UNREACHABLE)); CHECK_EQ(7, r.Call(0)); CHECK_EQ(7, r.Call(1)); } WASM_COMPILED_EXEC_TEST(Build_Wasm_Unreachable1) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_UNREACHABLE); } WASM_COMPILED_EXEC_TEST(Build_Wasm_Unreachable2) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_UNREACHABLE, WASM_UNREACHABLE); } WASM_COMPILED_EXEC_TEST(Build_Wasm_Unreachable3) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_UNREACHABLE, WASM_UNREACHABLE, WASM_UNREACHABLE); } WASM_COMPILED_EXEC_TEST(Build_Wasm_UnreachableIf1) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_UNREACHABLE, WASM_IF(WASM_GET_LOCAL(0), WASM_SEQ(WASM_GET_LOCAL(0), WASM_DROP)), WASM_ZERO); } WASM_COMPILED_EXEC_TEST(Build_Wasm_UnreachableIf2) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_UNREACHABLE, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_UNREACHABLE)); } WASM_EXEC_TEST(Unreachable_Load) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); r.builder().AddMemory(kWasmPageSize); BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0)), WASM_LOAD_MEM(MachineType::Int8(), WASM_GET_LOCAL(0)))); @@ -1927,21 +1926,21 @@ WASM_EXEC_TEST(Unreachable_Load) { } WASM_EXEC_TEST(BrV_Fallthrough) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I(WASM_BLOCK(WASM_BRV(1, WASM_I32V_1(42))), WASM_I32V_1(22))); CHECK_EQ(42, r.Call()); } WASM_EXEC_TEST(Infinite_Loop_not_taken1) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_INFINITE_LOOP), WASM_I32V_1(45)); // Run the code, but don't go into the infinite loop. CHECK_EQ(45, r.Call(0)); } WASM_EXEC_TEST(Infinite_Loop_not_taken2) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I( WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I32V_1(45)), WASM_INFINITE_LOOP), @@ -1951,7 +1950,7 @@ WASM_EXEC_TEST(Infinite_Loop_not_taken2) { } WASM_EXEC_TEST(Infinite_Loop_not_taken2_brif) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I(WASM_BRV_IF(0, WASM_I32V_1(45), WASM_GET_LOCAL(0)), WASM_INFINITE_LOOP)); // Run the code, but don't go into the infinite loop. @@ -2005,7 +2004,7 @@ TEST(Build_Wasm_SimpleExprs) { } WASM_EXEC_TEST(Int32LoadInt8_signext) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); const int kNumElems = kWasmPageSize; int8_t* memory = r.builder().AddMemoryElems<int8_t>(kNumElems); r.builder().RandomizeMemory(); @@ -2018,7 +2017,7 @@ WASM_EXEC_TEST(Int32LoadInt8_signext) { } WASM_EXEC_TEST(Int32LoadInt8_zeroext) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); const int kNumElems = kWasmPageSize; byte* memory = r.builder().AddMemory(kNumElems); r.builder().RandomizeMemory(77); @@ -2031,7 +2030,7 @@ WASM_EXEC_TEST(Int32LoadInt8_zeroext) { } WASM_EXEC_TEST(Int32LoadInt16_signext) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); const int kNumBytes = kWasmPageSize; byte* memory = r.builder().AddMemory(kNumBytes); r.builder().RandomizeMemory(888); @@ -2045,7 +2044,7 @@ WASM_EXEC_TEST(Int32LoadInt16_signext) { } WASM_EXEC_TEST(Int32LoadInt16_zeroext) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); const int kNumBytes = kWasmPageSize; byte* memory = r.builder().AddMemory(kNumBytes); r.builder().RandomizeMemory(9999); @@ -2059,18 +2058,18 @@ WASM_EXEC_TEST(Int32LoadInt16_zeroext) { } WASM_EXEC_TEST(Int32Global) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); int32_t* global = r.builder().AddGlobal<int32_t>(); // global = global + p0 BUILD(r, WASM_SET_GLOBAL(0, WASM_I32_ADD(WASM_GET_GLOBAL(0), WASM_GET_LOCAL(0))), WASM_ZERO); - *global = 116; + WriteLittleEndianValue<int32_t>(global, 116); for (int i = 9; i < 444444; i += 111111) { - int32_t expected = *global + i; + int32_t expected = ReadLittleEndianValue<int32_t>(global) + i; r.Call(i); - CHECK_EQ(expected, *global); + CHECK_EQ(expected, ReadLittleEndianValue<int32_t>(global)); } } @@ -2078,7 +2077,7 @@ WASM_EXEC_TEST(Int32Globals_DontAlias) { const int kNumGlobals = 3; for (int g = 0; g < kNumGlobals; ++g) { // global = global + p0 - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); int32_t* globals[] = {r.builder().AddGlobal<int32_t>(), r.builder().AddGlobal<int32_t>(), r.builder().AddGlobal<int32_t>()}; @@ -2088,23 +2087,24 @@ WASM_EXEC_TEST(Int32Globals_DontAlias) { WASM_GET_GLOBAL(g)); // Check that reading/writing global number {g} doesn't alter the others. - *globals[g] = 116 * g; + WriteLittleEndianValue<int32_t>(globals[g], 116 * g); int32_t before[kNumGlobals]; for (int i = 9; i < 444444; i += 111113) { - int32_t sum = *globals[g] + i; - for (int j = 0; j < kNumGlobals; ++j) before[j] = *globals[j]; + int32_t sum = ReadLittleEndianValue<int32_t>(globals[g]) + i; + for (int j = 0; j < kNumGlobals; ++j) + before[j] = ReadLittleEndianValue<int32_t>(globals[j]); int32_t result = r.Call(i); CHECK_EQ(sum, result); for (int j = 0; j < kNumGlobals; ++j) { int32_t expected = j == g ? sum : before[j]; - CHECK_EQ(expected, *globals[j]); + CHECK_EQ(expected, ReadLittleEndianValue<int32_t>(globals[j])); } } } } WASM_EXEC_TEST(Float32Global) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); float* global = r.builder().AddGlobal<float>(); // global = global + p0 BUILD(r, WASM_SET_GLOBAL( @@ -2112,16 +2112,16 @@ WASM_EXEC_TEST(Float32Global) { WASM_F32_SCONVERT_I32(WASM_GET_LOCAL(0)))), WASM_ZERO); - *global = 1.25; + WriteLittleEndianValue<float>(global, 1.25); for (int i = 9; i < 4444; i += 1111) { - volatile float expected = *global + i; + volatile float expected = ReadLittleEndianValue<float>(global) + i; r.Call(i); - CHECK_EQ(expected, *global); + CHECK_EQ(expected, ReadLittleEndianValue<float>(global)); } } WASM_EXEC_TEST(Float64Global) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); double* global = r.builder().AddGlobal<double>(); // global = global + p0 BUILD(r, WASM_SET_GLOBAL( @@ -2129,16 +2129,16 @@ WASM_EXEC_TEST(Float64Global) { WASM_F64_SCONVERT_I32(WASM_GET_LOCAL(0)))), WASM_ZERO); - *global = 1.25; + WriteLittleEndianValue<double>(global, 1.25); for (int i = 9; i < 4444; i += 1111) { - volatile double expected = *global + i; + volatile double expected = ReadLittleEndianValue<double>(global) + i; r.Call(i); - CHECK_EQ(expected, *global); + CHECK_EQ(expected, ReadLittleEndianValue<double>(global)); } } WASM_EXEC_TEST(MixedGlobals) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); int32_t* unused = r.builder().AddGlobal<int32_t>(); byte* memory = r.builder().AddMemory(kWasmPageSize); @@ -2164,17 +2164,20 @@ WASM_EXEC_TEST(MixedGlobals) { memory[7] = 0x99; r.Call(1); - CHECK(static_cast<int32_t>(0xEE55CCAA) == *var_int32); - CHECK(static_cast<uint32_t>(0xEE55CCAA) == *var_uint32); - CHECK(bit_cast<float>(0xEE55CCAA) == *var_float); - CHECK(bit_cast<double>(0x99112233EE55CCAAULL) == *var_double); + CHECK(static_cast<int32_t>(0xEE55CCAA) == + ReadLittleEndianValue<int32_t>(var_int32)); + CHECK(static_cast<uint32_t>(0xEE55CCAA) == + ReadLittleEndianValue<uint32_t>(var_uint32)); + CHECK(bit_cast<float>(0xEE55CCAA) == ReadLittleEndianValue<float>(var_float)); + CHECK(bit_cast<double>(0x99112233EE55CCAAULL) == + ReadLittleEndianValue<double>(var_double)); USE(unused); } WASM_EXEC_TEST(CallEmpty) { const int32_t kExpected = -414444; - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); // Build the target function. WasmFunctionCompiler& target_func = r.NewFunction<int>(); @@ -2188,7 +2191,7 @@ WASM_EXEC_TEST(CallEmpty) { } WASM_EXEC_TEST(CallF32StackParameter) { - WasmRunner<float> r(execution_mode); + WasmRunner<float> r(execution_tier); // Build the target function. ValueType param_types[20]; @@ -2211,7 +2214,7 @@ WASM_EXEC_TEST(CallF32StackParameter) { } WASM_EXEC_TEST(CallF64StackParameter) { - WasmRunner<double> r(execution_mode); + WasmRunner<double> r(execution_tier); // Build the target function. ValueType param_types[20]; @@ -2234,7 +2237,7 @@ WASM_EXEC_TEST(CallF64StackParameter) { } WASM_EXEC_TEST(CallVoid) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); const byte kMemOffset = 8; const int32_t kElemNum = kMemOffset / sizeof(int32_t); @@ -2259,7 +2262,7 @@ WASM_EXEC_TEST(CallVoid) { } WASM_EXEC_TEST(Call_Int32Add) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); // Build the target function. WasmFunctionCompiler& t = r.NewFunction<int32_t, int32_t, int32_t>(); @@ -2279,7 +2282,7 @@ WASM_EXEC_TEST(Call_Int32Add) { } WASM_EXEC_TEST(Call_Float32Sub) { - WasmRunner<float, float, float> r(execution_mode); + WasmRunner<float, float, float> r(execution_tier); // Build the target function. WasmFunctionCompiler& target_func = r.NewFunction<float, float, float>(); @@ -2295,7 +2298,7 @@ WASM_EXEC_TEST(Call_Float32Sub) { } WASM_EXEC_TEST(Call_Float64Sub) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); double* memory = r.builder().AddMemoryElems<double>(kWasmPageSize / sizeof(double)); @@ -2329,7 +2332,7 @@ WASM_EXEC_TEST(Call_Float64Sub) { for (size_t i = 0; i < sizeof(__buf); ++i) vec.push_back(__buf[i]); \ } while (false) -static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) { +static void Run_WasmMixedCall_N(ExecutionTier execution_tier, int start) { const int kExpected = 6333; const int kElemSize = 8; TestSignatures sigs; @@ -2345,7 +2348,7 @@ static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) { for (int which = 0; which < num_params; ++which) { v8::internal::AccountingAllocator allocator; Zone zone(&allocator, ZONE_NAME); - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); r.builder().AddMemory(kWasmPageSize); MachineType* memtypes = &mixed[start]; MachineType result = memtypes[which]; @@ -2404,13 +2407,13 @@ static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) { } } -WASM_EXEC_TEST(MixedCall_0) { Run_WasmMixedCall_N(execution_mode, 0); } -WASM_EXEC_TEST(MixedCall_1) { Run_WasmMixedCall_N(execution_mode, 1); } -WASM_EXEC_TEST(MixedCall_2) { Run_WasmMixedCall_N(execution_mode, 2); } -WASM_EXEC_TEST(MixedCall_3) { Run_WasmMixedCall_N(execution_mode, 3); } +WASM_EXEC_TEST(MixedCall_0) { Run_WasmMixedCall_N(execution_tier, 0); } +WASM_EXEC_TEST(MixedCall_1) { Run_WasmMixedCall_N(execution_tier, 1); } +WASM_EXEC_TEST(MixedCall_2) { Run_WasmMixedCall_N(execution_tier, 2); } +WASM_EXEC_TEST(MixedCall_3) { Run_WasmMixedCall_N(execution_tier, 3); } WASM_EXEC_TEST(AddCall) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); WasmFunctionCompiler& t1 = r.NewFunction<int32_t, int32_t, int32_t>(); BUILD(t1, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); @@ -2429,7 +2432,7 @@ WASM_EXEC_TEST(AddCall) { WASM_EXEC_TEST(MultiReturnSub) { EXPERIMENTAL_FLAG_SCOPE(mv); - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); ValueType storage[] = {kWasmI32, kWasmI32, kWasmI32, kWasmI32}; FunctionSig sig_ii_ii(2, 2, storage); @@ -2449,7 +2452,7 @@ WASM_EXEC_TEST(MultiReturnSub) { } template <typename T> -void RunMultiReturnSelect(WasmExecutionMode execution_mode, const T* inputs) { +void RunMultiReturnSelect(ExecutionTier execution_tier, const T* inputs) { EXPERIMENTAL_FLAG_SCOPE(mv); ValueType type = ValueTypes::ValueTypeFor(MachineTypeForC<T>()); ValueType storage[] = {type, type, type, type, type, type}; @@ -2460,7 +2463,7 @@ void RunMultiReturnSelect(WasmExecutionMode execution_mode, const T* inputs) { for (size_t i = 0; i < kNumParams; i++) { for (size_t j = 0; j < kNumParams; j++) { for (int k = 0; k < 2; k++) { - WasmRunner<T, T, T, T, T> r(execution_mode); + WasmRunner<T, T, T, T, T> r(execution_tier); WasmFunctionCompiler& r1 = r.NewFunction(&sig); BUILD(r1, WASM_GET_LOCAL(i), WASM_GET_LOCAL(j)); @@ -2486,12 +2489,12 @@ void RunMultiReturnSelect(WasmExecutionMode execution_mode, const T* inputs) { WASM_EXEC_TEST(MultiReturnSelect_i32) { static const int32_t inputs[] = {3333333, 4444444, -55555555, -7777777}; - RunMultiReturnSelect<int32_t>(execution_mode, inputs); + RunMultiReturnSelect<int32_t>(execution_tier, inputs); } WASM_EXEC_TEST(MultiReturnSelect_f32) { static const float inputs[] = {33.33333f, 444.4444f, -55555.555f, -77777.77f}; - RunMultiReturnSelect<float>(execution_mode, inputs); + RunMultiReturnSelect<float>(execution_tier, inputs); } WASM_EXEC_TEST(MultiReturnSelect_i64) { @@ -2499,17 +2502,17 @@ WASM_EXEC_TEST(MultiReturnSelect_i64) { // TODO(titzer): implement int64-lowering for multiple return values static const int64_t inputs[] = {33333338888, 44444446666, -555555553333, -77777771111}; - RunMultiReturnSelect<int64_t>(execution_mode, inputs); + RunMultiReturnSelect<int64_t>(execution_tier, inputs); #endif } WASM_EXEC_TEST(MultiReturnSelect_f64) { static const double inputs[] = {3.333333, 44444.44, -55.555555, -7777.777}; - RunMultiReturnSelect<double>(execution_mode, inputs); + RunMultiReturnSelect<double>(execution_tier, inputs); } WASM_EXEC_TEST(ExprBlock2a) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I32V_1(1))), WASM_I32V_1(1))); CHECK_EQ(1, r.Call(0)); @@ -2517,7 +2520,7 @@ WASM_EXEC_TEST(ExprBlock2a) { } WASM_EXEC_TEST(ExprBlock2b) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I32V_1(1))), WASM_I32V_1(2))); CHECK_EQ(2, r.Call(0)); @@ -2525,7 +2528,7 @@ WASM_EXEC_TEST(ExprBlock2b) { } WASM_EXEC_TEST(ExprBlock2c) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I(WASM_BRV_IFD(0, WASM_I32V_1(1), WASM_GET_LOCAL(0)), WASM_I32V_1(1))); CHECK_EQ(1, r.Call(0)); @@ -2533,7 +2536,7 @@ WASM_EXEC_TEST(ExprBlock2c) { } WASM_EXEC_TEST(ExprBlock2d) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I(WASM_BRV_IFD(0, WASM_I32V_1(1), WASM_GET_LOCAL(0)), WASM_I32V_1(2))); CHECK_EQ(2, r.Call(0)); @@ -2541,7 +2544,7 @@ WASM_EXEC_TEST(ExprBlock2d) { } WASM_EXEC_TEST(ExprBlock_ManualSwitch) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I(WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I32V_1(1)), WASM_BRV(1, WASM_I32V_1(11))), WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I32V_1(2)), @@ -2563,7 +2566,7 @@ WASM_EXEC_TEST(ExprBlock_ManualSwitch) { } WASM_EXEC_TEST(ExprBlock_ManualSwitch_brif) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I( WASM_BRV_IFD(0, WASM_I32V_1(11), WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I32V_1(1))), @@ -2586,7 +2589,7 @@ WASM_EXEC_TEST(ExprBlock_ManualSwitch_brif) { } WASM_EXEC_TEST(If_nested) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); BUILD( r, @@ -2602,7 +2605,7 @@ WASM_EXEC_TEST(If_nested) { } WASM_EXEC_TEST(ExprBlock_if) { - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I(WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_BRV(0, WASM_I32V_1(11)), @@ -2613,7 +2616,7 @@ WASM_EXEC_TEST(ExprBlock_if) { } WASM_EXEC_TEST(ExprBlock_nested_ifs) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I(WASM_IF_ELSE_I( WASM_GET_LOCAL(0), @@ -2630,7 +2633,7 @@ WASM_EXEC_TEST(ExprBlock_nested_ifs) { WASM_EXEC_TEST(SimpleCallIndirect) { TestSignatures sigs; - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); WasmFunctionCompiler& t1 = r.NewFunction(sigs.i_ii()); BUILD(t1, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); @@ -2664,7 +2667,7 @@ WASM_EXEC_TEST(SimpleCallIndirect) { WASM_EXEC_TEST(MultipleCallIndirect) { TestSignatures sigs; - WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_tier); WasmFunctionCompiler& t1 = r.NewFunction(sigs.i_ii()); BUILD(t1, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); @@ -2707,7 +2710,7 @@ WASM_EXEC_TEST(MultipleCallIndirect) { WASM_EXEC_TEST(CallIndirect_EmptyTable) { TestSignatures sigs; - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); // One function. WasmFunctionCompiler& t1 = r.NewFunction(sigs.i_ii()); @@ -2730,7 +2733,7 @@ WASM_EXEC_TEST(CallIndirect_EmptyTable) { WASM_EXEC_TEST(CallIndirect_canonical) { TestSignatures sigs; - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); WasmFunctionCompiler& t1 = r.NewFunction(sigs.i_ii()); BUILD(t1, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); @@ -2772,63 +2775,63 @@ WASM_EXEC_TEST(CallIndirect_canonical) { } WASM_EXEC_TEST(F32Floor) { - WasmRunner<float, float> r(execution_mode); + WasmRunner<float, float> r(execution_tier); BUILD(r, WASM_F32_FLOOR(WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(floorf(*i), r.Call(*i)); } } WASM_EXEC_TEST(F32Ceil) { - WasmRunner<float, float> r(execution_mode); + WasmRunner<float, float> r(execution_tier); BUILD(r, WASM_F32_CEIL(WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(ceilf(*i), r.Call(*i)); } } WASM_EXEC_TEST(F32Trunc) { - WasmRunner<float, float> r(execution_mode); + WasmRunner<float, float> r(execution_tier); BUILD(r, WASM_F32_TRUNC(WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(truncf(*i), r.Call(*i)); } } WASM_EXEC_TEST(F32NearestInt) { - WasmRunner<float, float> r(execution_mode); + WasmRunner<float, float> r(execution_tier); BUILD(r, WASM_F32_NEARESTINT(WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(nearbyintf(*i), r.Call(*i)); } } WASM_EXEC_TEST(F64Floor) { - WasmRunner<double, double> r(execution_mode); + WasmRunner<double, double> r(execution_tier); BUILD(r, WASM_F64_FLOOR(WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(floor(*i), r.Call(*i)); } } WASM_EXEC_TEST(F64Ceil) { - WasmRunner<double, double> r(execution_mode); + WasmRunner<double, double> r(execution_tier); BUILD(r, WASM_F64_CEIL(WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ceil(*i), r.Call(*i)); } } WASM_EXEC_TEST(F64Trunc) { - WasmRunner<double, double> r(execution_mode); + WasmRunner<double, double> r(execution_tier); BUILD(r, WASM_F64_TRUNC(WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(trunc(*i), r.Call(*i)); } } WASM_EXEC_TEST(F64NearestInt) { - WasmRunner<double, double> r(execution_mode); + WasmRunner<double, double> r(execution_tier); BUILD(r, WASM_F64_NEARESTINT(WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(nearbyint(*i), r.Call(*i)); } } WASM_EXEC_TEST(F32Min) { - WasmRunner<float, float, float> r(execution_mode); + WasmRunner<float, float, float> r(execution_tier); BUILD(r, WASM_F32_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_FLOAT32_INPUTS(i) { @@ -2837,7 +2840,7 @@ WASM_EXEC_TEST(F32Min) { } WASM_EXEC_TEST(F64Min) { - WasmRunner<double, double, double> r(execution_mode); + WasmRunner<double, double, double> r(execution_tier); BUILD(r, WASM_F64_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_FLOAT64_INPUTS(i) { @@ -2846,7 +2849,7 @@ WASM_EXEC_TEST(F64Min) { } WASM_EXEC_TEST(F32Max) { - WasmRunner<float, float, float> r(execution_mode); + WasmRunner<float, float, float> r(execution_tier); BUILD(r, WASM_F32_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_FLOAT32_INPUTS(i) { @@ -2855,7 +2858,7 @@ WASM_EXEC_TEST(F32Max) { } WASM_EXEC_TEST(F64Max) { - WasmRunner<double, double, double> r(execution_mode); + WasmRunner<double, double, double> r(execution_tier); BUILD(r, WASM_F64_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_FLOAT64_INPUTS(i) { @@ -2867,7 +2870,7 @@ WASM_EXEC_TEST(F64Max) { } WASM_EXEC_TEST(I32SConvertF32) { - WasmRunner<int32_t, float> r(execution_mode); + WasmRunner<int32_t, float> r(execution_tier); BUILD(r, WASM_I32_SCONVERT_F32(WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { @@ -2881,7 +2884,7 @@ WASM_EXEC_TEST(I32SConvertF32) { WASM_EXEC_TEST(I32SConvertSatF32) { EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions); - WasmRunner<int32_t, float> r(execution_mode); + WasmRunner<int32_t, float> r(execution_tier); BUILD(r, WASM_I32_SCONVERT_SAT_F32(WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { @@ -2897,7 +2900,7 @@ WASM_EXEC_TEST(I32SConvertSatF32) { } WASM_EXEC_TEST(I32SConvertF64) { - WasmRunner<int32_t, double> r(execution_mode); + WasmRunner<int32_t, double> r(execution_tier); BUILD(r, WASM_I32_SCONVERT_F64(WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { @@ -2911,7 +2914,7 @@ WASM_EXEC_TEST(I32SConvertF64) { WASM_EXEC_TEST(I32SConvertSatF64) { EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions); - WasmRunner<int32_t, double> r(execution_mode); + WasmRunner<int32_t, double> r(execution_tier); BUILD(r, WASM_I32_SCONVERT_SAT_F64(WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { int32_t expected = @@ -2926,7 +2929,7 @@ WASM_EXEC_TEST(I32SConvertSatF64) { } WASM_EXEC_TEST(I32UConvertF32) { - WasmRunner<uint32_t, float> r(execution_mode); + WasmRunner<uint32_t, float> r(execution_tier); BUILD(r, WASM_I32_UCONVERT_F32(WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { if (is_inbounds<uint32_t>(*i)) { @@ -2939,7 +2942,7 @@ WASM_EXEC_TEST(I32UConvertF32) { WASM_EXEC_TEST(I32UConvertSatF32) { EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions); - WasmRunner<uint32_t, float> r(execution_mode); + WasmRunner<uint32_t, float> r(execution_tier); BUILD(r, WASM_I32_UCONVERT_SAT_F32(WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { int32_t expected = @@ -2954,7 +2957,7 @@ WASM_EXEC_TEST(I32UConvertSatF32) { } WASM_EXEC_TEST(I32UConvertF64) { - WasmRunner<uint32_t, double> r(execution_mode); + WasmRunner<uint32_t, double> r(execution_tier); BUILD(r, WASM_I32_UCONVERT_F64(WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { if (is_inbounds<uint32_t>(*i)) { @@ -2967,7 +2970,7 @@ WASM_EXEC_TEST(I32UConvertF64) { WASM_EXEC_TEST(I32UConvertSatF64) { EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions); - WasmRunner<uint32_t, double> r(execution_mode); + WasmRunner<uint32_t, double> r(execution_tier); BUILD(r, WASM_I32_UCONVERT_SAT_F64(WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { int32_t expected = @@ -2982,7 +2985,7 @@ WASM_EXEC_TEST(I32UConvertSatF64) { } WASM_EXEC_TEST(F64CopySign) { - WasmRunner<double, double, double> r(execution_mode); + WasmRunner<double, double, double> r(execution_tier); BUILD(r, WASM_F64_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_FLOAT64_INPUTS(i) { @@ -2991,7 +2994,7 @@ WASM_EXEC_TEST(F64CopySign) { } WASM_EXEC_TEST(F32CopySign) { - WasmRunner<float, float, float> r(execution_mode); + WasmRunner<float, float, float> r(execution_tier); BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_FLOAT32_INPUTS(i) { @@ -2999,12 +3002,12 @@ WASM_EXEC_TEST(F32CopySign) { } } -static void CompileCallIndirectMany(WasmExecutionMode mode, ValueType param) { +static void CompileCallIndirectMany(ExecutionTier tier, ValueType param) { // Make sure we don't run out of registers when compiling indirect calls // with many many parameters. TestSignatures sigs; for (byte num_params = 0; num_params < 40; ++num_params) { - WasmRunner<void> r(mode); + WasmRunner<void> r(tier); FunctionSig* sig = sigs.many(r.zone(), kWasmStmt, param, num_params); r.builder().AddSignature(sig); @@ -3025,19 +3028,19 @@ static void CompileCallIndirectMany(WasmExecutionMode mode, ValueType param) { } WASM_COMPILED_EXEC_TEST(Compile_Wasm_CallIndirect_Many_i32) { - CompileCallIndirectMany(execution_mode, kWasmI32); + CompileCallIndirectMany(execution_tier, kWasmI32); } WASM_COMPILED_EXEC_TEST(Compile_Wasm_CallIndirect_Many_f32) { - CompileCallIndirectMany(execution_mode, kWasmF32); + CompileCallIndirectMany(execution_tier, kWasmF32); } WASM_COMPILED_EXEC_TEST(Compile_Wasm_CallIndirect_Many_f64) { - CompileCallIndirectMany(execution_mode, kWasmF64); + CompileCallIndirectMany(execution_tier, kWasmF64); } WASM_EXEC_TEST(Int32RemS_dead) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, WASM_ZERO); const int32_t kMin = std::numeric_limits<int32_t>::min(); @@ -3050,7 +3053,7 @@ WASM_EXEC_TEST(Int32RemS_dead) { } WASM_EXEC_TEST(BrToLoopWithValue) { - WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); // Subtracts <1> times 3 from <0> and returns the result. BUILD(r, // loop i32 @@ -3070,7 +3073,7 @@ WASM_EXEC_TEST(BrToLoopWithValue) { WASM_EXEC_TEST(BrToLoopWithoutValue) { // This was broken in the interpreter, see http://crbug.com/715454 - WasmRunner<int32_t, int32_t> r(execution_mode); + WasmRunner<int32_t, int32_t> r(execution_tier); BUILD( r, kExprLoop, kLocalI32, // loop i32 WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_ONE)), // dec <0> @@ -3081,31 +3084,31 @@ WASM_EXEC_TEST(BrToLoopWithoutValue) { } WASM_EXEC_TEST(LoopsWithValues) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); BUILD(r, WASM_LOOP_I(WASM_LOOP_I(WASM_ONE), WASM_ONE, kExprI32Add)); CHECK_EQ(2, r.Call()); } WASM_EXEC_TEST(InvalidStackAfterUnreachable) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); BUILD(r, kExprUnreachable, kExprI32Add); CHECK_TRAP32(r.Call()); } WASM_EXEC_TEST(InvalidStackAfterBr) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); BUILD(r, WASM_BRV(0, WASM_I32V_1(27)), kExprI32Add); CHECK_EQ(27, r.Call()); } WASM_EXEC_TEST(InvalidStackAfterReturn) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); BUILD(r, WASM_RETURN1(WASM_I32V_1(17)), kExprI32Add); CHECK_EQ(17, r.Call()); } WASM_EXEC_TEST(BranchOverUnreachableCode) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); BUILD(r, // Start a block which breaks in the middle (hence unreachable code // afterwards) and continue execution after this block. @@ -3116,7 +3119,7 @@ WASM_EXEC_TEST(BranchOverUnreachableCode) { } WASM_EXEC_TEST(BranchOverUnreachableCodeInLoop0) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I( // Start a loop which breaks in the middle (hence unreachable code @@ -3130,7 +3133,7 @@ WASM_EXEC_TEST(BranchOverUnreachableCodeInLoop0) { } WASM_EXEC_TEST(BranchOverUnreachableCodeInLoop1) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I( // Start a loop which breaks in the middle (hence unreachable code @@ -3143,7 +3146,7 @@ WASM_EXEC_TEST(BranchOverUnreachableCodeInLoop1) { } WASM_EXEC_TEST(BranchOverUnreachableCodeInLoop2) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); BUILD(r, WASM_BLOCK_I( // Start a loop which breaks in the middle (hence unreachable code @@ -3157,13 +3160,13 @@ WASM_EXEC_TEST(BranchOverUnreachableCodeInLoop2) { } WASM_EXEC_TEST(BlockInsideUnreachable) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); BUILD(r, WASM_RETURN1(WASM_I32V_1(17)), WASM_BLOCK(WASM_BR(0))); CHECK_EQ(17, r.Call()); } WASM_EXEC_TEST(IfInsideUnreachable) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); BUILD( r, WASM_RETURN1(WASM_I32V_1(17)), WASM_IF_ELSE_I(WASM_ONE, WASM_BRV(0, WASM_ONE), WASM_RETURN1(WASM_ONE))); @@ -3177,9 +3180,8 @@ WASM_EXEC_TEST(IfInsideUnreachable) { // not overwritten. template <typename ctype> void BinOpOnDifferentRegisters( - WasmExecutionMode execution_mode, ValueType type, - Vector<const ctype> inputs, WasmOpcode opcode, - std::function<ctype(ctype, ctype, bool*)> expect_fn) { + ExecutionTier execution_tier, ValueType type, Vector<const ctype> inputs, + WasmOpcode opcode, std::function<ctype(ctype, ctype, bool*)> expect_fn) { static constexpr int kMaxNumLocals = 8; for (int num_locals = 1; num_locals < kMaxNumLocals; ++num_locals) { // {init_locals_code} is shared by all code generated in the loop below. @@ -3202,7 +3204,7 @@ void BinOpOnDifferentRegisters( } for (int lhs = 0; lhs < num_locals; ++lhs) { for (int rhs = 0; rhs < num_locals; ++rhs) { - WasmRunner<int32_t> r(execution_mode); + WasmRunner<int32_t> r(execution_tier); ctype* memory = r.builder().AddMemoryElems<ctype>(kWasmPageSize / sizeof(ctype)); for (int i = 0; i < num_locals; ++i) { @@ -3226,8 +3228,7 @@ void BinOpOnDifferentRegisters( ctype value = i == lhs ? lhs_value : i == rhs ? rhs_value : static_cast<ctype>(i + 47); - WriteLittleEndianValue<ctype>( - reinterpret_cast<Address>(&memory[i]), value); + WriteLittleEndianValue<ctype>(&memory[i], value); } bool trap = false; int64_t expect = expect_fn(lhs_value, rhs_value, &trap); @@ -3236,14 +3237,12 @@ void BinOpOnDifferentRegisters( continue; } CHECK_EQ(0, r.Call()); - CHECK_EQ(expect, ReadLittleEndianValue<ctype>( - reinterpret_cast<Address>(&memory[0]))); + CHECK_EQ(expect, ReadLittleEndianValue<ctype>(&memory[0])); for (int i = 0; i < num_locals; ++i) { ctype value = i == lhs ? lhs_value : i == rhs ? rhs_value : static_cast<ctype>(i + 47); - CHECK_EQ(value, ReadLittleEndianValue<ctype>( - reinterpret_cast<Address>(&memory[i + 1]))); + CHECK_EQ(value, ReadLittleEndianValue<ctype>(&memory[i + 1])); } } } @@ -3260,37 +3259,37 @@ static constexpr int64_t kSome64BitInputs[] = { WASM_EXEC_TEST(I32AddOnDifferentRegisters) { BinOpOnDifferentRegisters<int32_t>( - execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Add, + execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Add, [](int32_t lhs, int32_t rhs, bool* trap) { return lhs + rhs; }); } WASM_EXEC_TEST(I32SubOnDifferentRegisters) { BinOpOnDifferentRegisters<int32_t>( - execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Sub, + execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Sub, [](int32_t lhs, int32_t rhs, bool* trap) { return lhs - rhs; }); } WASM_EXEC_TEST(I32MulOnDifferentRegisters) { BinOpOnDifferentRegisters<int32_t>( - execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Mul, + execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Mul, [](int32_t lhs, int32_t rhs, bool* trap) { return lhs * rhs; }); } WASM_EXEC_TEST(I32ShlOnDifferentRegisters) { BinOpOnDifferentRegisters<int32_t>( - execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Shl, + execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Shl, [](int32_t lhs, int32_t rhs, bool* trap) { return lhs << (rhs & 31); }); } WASM_EXEC_TEST(I32ShrSOnDifferentRegisters) { BinOpOnDifferentRegisters<int32_t>( - execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32ShrS, + execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32ShrS, [](int32_t lhs, int32_t rhs, bool* trap) { return lhs >> (rhs & 31); }); } WASM_EXEC_TEST(I32ShrUOnDifferentRegisters) { BinOpOnDifferentRegisters<int32_t>( - execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32ShrU, + execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32ShrU, [](int32_t lhs, int32_t rhs, bool* trap) { return static_cast<uint32_t>(lhs) >> (rhs & 31); }); @@ -3298,7 +3297,7 @@ WASM_EXEC_TEST(I32ShrUOnDifferentRegisters) { WASM_EXEC_TEST(I32DivSOnDifferentRegisters) { BinOpOnDifferentRegisters<int32_t>( - execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32DivS, + execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32DivS, [](int32_t lhs, int32_t rhs, bool* trap) { *trap = rhs == 0; return *trap ? 0 : lhs / rhs; @@ -3307,7 +3306,7 @@ WASM_EXEC_TEST(I32DivSOnDifferentRegisters) { WASM_EXEC_TEST(I32DivUOnDifferentRegisters) { BinOpOnDifferentRegisters<int32_t>( - execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32DivU, + execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32DivU, [](uint32_t lhs, uint32_t rhs, bool* trap) { *trap = rhs == 0; return *trap ? 0 : lhs / rhs; @@ -3316,7 +3315,7 @@ WASM_EXEC_TEST(I32DivUOnDifferentRegisters) { WASM_EXEC_TEST(I32RemSOnDifferentRegisters) { BinOpOnDifferentRegisters<int32_t>( - execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32RemS, + execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32RemS, [](int32_t lhs, int32_t rhs, bool* trap) { *trap = rhs == 0; return *trap || rhs == -1 ? 0 : lhs % rhs; @@ -3325,7 +3324,7 @@ WASM_EXEC_TEST(I32RemSOnDifferentRegisters) { WASM_EXEC_TEST(I32RemUOnDifferentRegisters) { BinOpOnDifferentRegisters<int32_t>( - execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32RemU, + execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32RemU, [](uint32_t lhs, uint32_t rhs, bool* trap) { *trap = rhs == 0; return *trap ? 0 : lhs % rhs; @@ -3334,37 +3333,37 @@ WASM_EXEC_TEST(I32RemUOnDifferentRegisters) { WASM_EXEC_TEST(I64AddOnDifferentRegisters) { BinOpOnDifferentRegisters<int64_t>( - execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Add, + execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Add, [](int64_t lhs, int64_t rhs, bool* trap) { return lhs + rhs; }); } WASM_EXEC_TEST(I64SubOnDifferentRegisters) { BinOpOnDifferentRegisters<int64_t>( - execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Sub, + execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Sub, [](int64_t lhs, int64_t rhs, bool* trap) { return lhs - rhs; }); } WASM_EXEC_TEST(I64MulOnDifferentRegisters) { BinOpOnDifferentRegisters<int64_t>( - execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Mul, + execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Mul, [](int64_t lhs, int64_t rhs, bool* trap) { return lhs * rhs; }); } WASM_EXEC_TEST(I64ShlOnDifferentRegisters) { BinOpOnDifferentRegisters<int64_t>( - execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Shl, + execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Shl, [](int64_t lhs, int64_t rhs, bool* trap) { return lhs << (rhs & 63); }); } WASM_EXEC_TEST(I64ShrSOnDifferentRegisters) { BinOpOnDifferentRegisters<int64_t>( - execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64ShrS, + execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64ShrS, [](int64_t lhs, int64_t rhs, bool* trap) { return lhs >> (rhs & 63); }); } WASM_EXEC_TEST(I64ShrUOnDifferentRegisters) { BinOpOnDifferentRegisters<int64_t>( - execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64ShrU, + execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64ShrU, [](int64_t lhs, int64_t rhs, bool* trap) { return static_cast<uint64_t>(lhs) >> (rhs & 63); }); @@ -3372,7 +3371,7 @@ WASM_EXEC_TEST(I64ShrUOnDifferentRegisters) { WASM_EXEC_TEST(I64DivSOnDifferentRegisters) { BinOpOnDifferentRegisters<int64_t>( - execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64DivS, + execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64DivS, [](int64_t lhs, int64_t rhs, bool* trap) { *trap = rhs == 0 || (rhs == -1 && lhs == std::numeric_limits<int64_t>::min()); @@ -3382,7 +3381,7 @@ WASM_EXEC_TEST(I64DivSOnDifferentRegisters) { WASM_EXEC_TEST(I64DivUOnDifferentRegisters) { BinOpOnDifferentRegisters<int64_t>( - execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64DivU, + execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64DivU, [](uint64_t lhs, uint64_t rhs, bool* trap) { *trap = rhs == 0; return *trap ? 0 : lhs / rhs; @@ -3391,7 +3390,7 @@ WASM_EXEC_TEST(I64DivUOnDifferentRegisters) { WASM_EXEC_TEST(I64RemSOnDifferentRegisters) { BinOpOnDifferentRegisters<int64_t>( - execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64RemS, + execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64RemS, [](int64_t lhs, int64_t rhs, bool* trap) { *trap = rhs == 0; return *trap || rhs == -1 ? 0 : lhs % rhs; @@ -3400,7 +3399,7 @@ WASM_EXEC_TEST(I64RemSOnDifferentRegisters) { WASM_EXEC_TEST(I64RemUOnDifferentRegisters) { BinOpOnDifferentRegisters<int64_t>( - execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64RemU, + execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64RemU, [](uint64_t lhs, uint64_t rhs, bool* trap) { *trap = rhs == 0; return *trap ? 0 : lhs % rhs; @@ -3408,7 +3407,7 @@ WASM_EXEC_TEST(I64RemUOnDifferentRegisters) { } TEST(Liftoff_tier_up) { - WasmRunner<int32_t, int32_t, int32_t> r(WasmExecutionMode::kExecuteLiftoff); + WasmRunner<int32_t, int32_t, int32_t> r(ExecutionTier::kBaseline); WasmFunctionCompiler& add = r.NewFunction<int32_t, int32_t, int32_t>("add"); BUILD(add, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |