| Index: test/cctest/wasm/test-run-wasm-64.cc
|
| diff --git a/test/cctest/wasm/test-run-wasm-64.cc b/test/cctest/wasm/test-run-wasm-64.cc
|
| index 529555c429a17fbd2b852700db1af00efb2098c4..ed78cf656a0590c99be61fdd2e2830b86a04bca8 100644
|
| --- a/test/cctest/wasm/test-run-wasm-64.cc
|
| +++ b/test/cctest/wasm/test-run-wasm-64.cc
|
| @@ -120,7 +120,7 @@
|
|
|
| WASM_EXEC_TEST(Return_I64) {
|
| REQUIRE(I64Return);
|
| - WasmRunner<int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64());
|
|
|
| BUILD(r, WASM_RETURN1(WASM_GET_LOCAL(0)));
|
|
|
| @@ -129,7 +129,8 @@
|
|
|
| WASM_EXEC_TEST(I64Add) {
|
| REQUIRE(I64Add);
|
| - WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| FOR_INT64_INPUTS(i) {
|
| FOR_INT64_INPUTS(j) { CHECK_EQ(*i + *j, r.Call(*i, *j)); }
|
| @@ -138,7 +139,8 @@
|
|
|
| WASM_EXEC_TEST(I64Sub) {
|
| REQUIRE(I64Sub);
|
| - WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| FOR_INT64_INPUTS(i) {
|
| FOR_INT64_INPUTS(j) { CHECK_EQ(*i - *j, r.Call(*i, *j)); }
|
| @@ -148,7 +150,8 @@
|
| WASM_EXEC_TEST(I64AddUseOnlyLowWord) {
|
| REQUIRE(I64Add);
|
| REQUIRE(I32ConvertI64);
|
| - WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I32_CONVERT_I64(
|
| WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
|
| FOR_INT64_INPUTS(i) {
|
| @@ -161,7 +164,8 @@
|
| WASM_EXEC_TEST(I64SubUseOnlyLowWord) {
|
| REQUIRE(I64Sub);
|
| REQUIRE(I32ConvertI64);
|
| - WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I32_CONVERT_I64(
|
| WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
|
| FOR_INT64_INPUTS(i) {
|
| @@ -174,7 +178,8 @@
|
| WASM_EXEC_TEST(I64MulUseOnlyLowWord) {
|
| REQUIRE(I64Mul);
|
| REQUIRE(I32ConvertI64);
|
| - WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I32_CONVERT_I64(
|
| WASM_I64_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
|
| FOR_INT64_INPUTS(i) {
|
| @@ -187,7 +192,8 @@
|
| WASM_EXEC_TEST(I64ShlUseOnlyLowWord) {
|
| REQUIRE(I64Shl);
|
| REQUIRE(I32ConvertI64);
|
| - WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I32_CONVERT_I64(
|
| WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
|
| FOR_INT64_INPUTS(i) {
|
| @@ -201,7 +207,8 @@
|
| WASM_EXEC_TEST(I64ShrUseOnlyLowWord) {
|
| REQUIRE(I64ShrU);
|
| REQUIRE(I32ConvertI64);
|
| - WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I32_CONVERT_I64(
|
| WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
|
| FOR_UINT64_INPUTS(i) {
|
| @@ -215,7 +222,8 @@
|
| WASM_EXEC_TEST(I64SarUseOnlyLowWord) {
|
| REQUIRE(I64ShrS);
|
| REQUIRE(I32ConvertI64);
|
| - WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I32_CONVERT_I64(
|
| WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
|
| FOR_INT64_INPUTS(i) {
|
| @@ -228,7 +236,8 @@
|
|
|
| WASM_EXEC_TEST_WITH_TRAP(I64DivS) {
|
| REQUIRE(I64DivS);
|
| - WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| FOR_INT64_INPUTS(i) {
|
| FOR_INT64_INPUTS(j) {
|
| @@ -245,7 +254,8 @@
|
|
|
| WASM_EXEC_TEST_WITH_TRAP(I64DivS_Trap) {
|
| REQUIRE(I64DivS);
|
| - WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| CHECK_EQ(0, r.Call(asi64(0), asi64(100)));
|
| CHECK_TRAP64(r.Call(asi64(100), asi64(0)));
|
| @@ -257,7 +267,7 @@
|
| WASM_EXEC_TEST_WITH_TRAP(I64DivS_Byzero_Const) {
|
| REQUIRE(I64DivS);
|
| for (int8_t denom = -2; denom < 8; denom++) {
|
| - WasmRunner<int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64());
|
| BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_I64V_1(denom)));
|
| for (int64_t val = -7; val < 8; val++) {
|
| if (denom == 0) {
|
| @@ -271,7 +281,8 @@
|
|
|
| WASM_EXEC_TEST_WITH_TRAP(I64DivU) {
|
| REQUIRE(I64DivU);
|
| - WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
|
| + WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64(),
|
| + MachineType::Uint64());
|
| BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| FOR_UINT64_INPUTS(i) {
|
| FOR_UINT64_INPUTS(j) {
|
| @@ -286,9 +297,10 @@
|
|
|
| WASM_EXEC_TEST_WITH_TRAP(I64DivU_Trap) {
|
| REQUIRE(I64DivU);
|
| - WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
|
| + WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64(),
|
| + MachineType::Uint64());
|
| BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| - CHECK_EQ(0, r.Call(asu64(0), asu64(100)));
|
| + CHECK_EQ(0u, r.Call(asu64(0), asu64(100)));
|
| CHECK_TRAP64(r.Call(asu64(100), asu64(0)));
|
| CHECK_TRAP64(r.Call(asu64(1001), asu64(0)));
|
| CHECK_TRAP64(r.Call(std::numeric_limits<uint64_t>::max(), asu64(0)));
|
| @@ -297,7 +309,7 @@
|
| WASM_EXEC_TEST_WITH_TRAP(I64DivU_Byzero_Const) {
|
| REQUIRE(I64DivU);
|
| for (uint64_t denom = 0xfffffffffffffffe; denom < 8; denom++) {
|
| - WasmRunner<uint64_t, uint64_t> r(execution_mode);
|
| + WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64());
|
| BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_I64V_1(denom)));
|
|
|
| for (uint64_t val = 0xfffffffffffffff0; val < 8; val++) {
|
| @@ -312,7 +324,8 @@
|
|
|
| WASM_EXEC_TEST_WITH_TRAP(I64RemS) {
|
| REQUIRE(I64RemS);
|
| - WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| FOR_INT64_INPUTS(i) {
|
| FOR_INT64_INPUTS(j) {
|
| @@ -327,7 +340,8 @@
|
|
|
| WASM_EXEC_TEST_WITH_TRAP(I64RemS_Trap) {
|
| REQUIRE(I64RemS);
|
| - WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| CHECK_EQ(33, r.Call(asi64(133), asi64(100)));
|
| CHECK_EQ(0, r.Call(std::numeric_limits<int64_t>::min(), asi64(-1)));
|
| @@ -338,7 +352,8 @@
|
|
|
| WASM_EXEC_TEST_WITH_TRAP(I64RemU) {
|
| REQUIRE(I64RemU);
|
| - WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
|
| + WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64(),
|
| + MachineType::Uint64());
|
| BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| FOR_UINT64_INPUTS(i) {
|
| FOR_UINT64_INPUTS(j) {
|
| @@ -353,9 +368,10 @@
|
|
|
| WASM_EXEC_TEST_WITH_TRAP(I64RemU_Trap) {
|
| REQUIRE(I64RemU);
|
| - WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
|
| + WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64(),
|
| + MachineType::Uint64());
|
| BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| - CHECK_EQ(17, r.Call(asu64(217), asu64(100)));
|
| + CHECK_EQ(17u, r.Call(asu64(217), asu64(100)));
|
| CHECK_TRAP64(r.Call(asu64(100), asu64(0)));
|
| CHECK_TRAP64(r.Call(asu64(1001), asu64(0)));
|
| CHECK_TRAP64(r.Call(std::numeric_limits<uint64_t>::max(), asu64(0)));
|
| @@ -363,7 +379,8 @@
|
|
|
| WASM_EXEC_TEST(I64And) {
|
| REQUIRE(I64And);
|
| - WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_AND(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| FOR_INT64_INPUTS(i) {
|
| FOR_INT64_INPUTS(j) { CHECK_EQ((*i) & (*j), r.Call(*i, *j)); }
|
| @@ -372,7 +389,8 @@
|
|
|
| WASM_EXEC_TEST(I64Ior) {
|
| REQUIRE(I64Ior);
|
| - WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_IOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| FOR_INT64_INPUTS(i) {
|
| FOR_INT64_INPUTS(j) { CHECK_EQ((*i) | (*j), r.Call(*i, *j)); }
|
| @@ -381,7 +399,8 @@
|
|
|
| WASM_EXEC_TEST(I64Xor) {
|
| REQUIRE(I64Xor);
|
| - WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| FOR_INT64_INPUTS(i) {
|
| FOR_INT64_INPUTS(j) { CHECK_EQ((*i) ^ (*j), r.Call(*i, *j)); }
|
| @@ -391,7 +410,8 @@
|
| WASM_EXEC_TEST(I64Shl) {
|
| REQUIRE(I64Shl);
|
| {
|
| - WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
|
| + WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64(),
|
| + MachineType::Uint64());
|
| BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
|
|
| FOR_UINT64_INPUTS(i) {
|
| @@ -402,22 +422,22 @@
|
| }
|
| }
|
| {
|
| - WasmRunner<uint64_t, int64_t> r(execution_mode);
|
| + WasmRunner<uint64_t> r(execution_mode, MachineType::Int64());
|
| BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(0)));
|
| FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 0, r.Call(*i)); }
|
| }
|
| {
|
| - WasmRunner<uint64_t, int64_t> r(execution_mode);
|
| + WasmRunner<uint64_t> r(execution_mode, MachineType::Int64());
|
| BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(32)));
|
| FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 32, r.Call(*i)); }
|
| }
|
| {
|
| - WasmRunner<uint64_t, int64_t> r(execution_mode);
|
| + WasmRunner<uint64_t> r(execution_mode, MachineType::Int64());
|
| BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(20)));
|
| FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 20, r.Call(*i)); }
|
| }
|
| {
|
| - WasmRunner<uint64_t, int64_t> r(execution_mode);
|
| + WasmRunner<uint64_t> r(execution_mode, MachineType::Int64());
|
| BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(40)));
|
| FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 40, r.Call(*i)); }
|
| }
|
| @@ -426,7 +446,8 @@
|
| WASM_EXEC_TEST(I64ShrU) {
|
| REQUIRE(I64ShrU);
|
| {
|
| - WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
|
| + WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64(),
|
| + MachineType::Uint64());
|
| BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
|
|
| FOR_UINT64_INPUTS(i) {
|
| @@ -437,22 +458,22 @@
|
| }
|
| }
|
| {
|
| - WasmRunner<uint64_t, int64_t> r(execution_mode);
|
| + WasmRunner<uint64_t> r(execution_mode, MachineType::Int64());
|
| BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(0)));
|
| FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 0, r.Call(*i)); }
|
| }
|
| {
|
| - WasmRunner<uint64_t, int64_t> r(execution_mode);
|
| + WasmRunner<uint64_t> r(execution_mode, MachineType::Int64());
|
| BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(32)));
|
| FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 32, r.Call(*i)); }
|
| }
|
| {
|
| - WasmRunner<uint64_t, int64_t> r(execution_mode);
|
| + WasmRunner<uint64_t> r(execution_mode, MachineType::Int64());
|
| BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(20)));
|
| FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 20, r.Call(*i)); }
|
| }
|
| {
|
| - WasmRunner<uint64_t, int64_t> r(execution_mode);
|
| + WasmRunner<uint64_t> r(execution_mode, MachineType::Int64());
|
| BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(40)));
|
| FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 40, r.Call(*i)); }
|
| }
|
| @@ -461,7 +482,8 @@
|
| WASM_EXEC_TEST(I64ShrS) {
|
| REQUIRE(I64ShrS);
|
| {
|
| - WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
|
|
| FOR_INT64_INPUTS(i) {
|
| @@ -472,22 +494,22 @@
|
| }
|
| }
|
| {
|
| - WasmRunner<int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64());
|
| BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(0)));
|
| FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 0, r.Call(*i)); }
|
| }
|
| {
|
| - WasmRunner<int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64());
|
| BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(32)));
|
| FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 32, r.Call(*i)); }
|
| }
|
| {
|
| - WasmRunner<int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64());
|
| BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(20)));
|
| FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 20, r.Call(*i)); }
|
| }
|
| {
|
| - WasmRunner<int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64());
|
| BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(40)));
|
| FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 40, r.Call(*i)); }
|
| }
|
| @@ -495,7 +517,8 @@
|
|
|
| WASM_EXEC_TEST(I64Eq) {
|
| REQUIRE(I64Eq);
|
| - WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_EQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| FOR_INT64_INPUTS(i) {
|
| FOR_INT64_INPUTS(j) { CHECK_EQ(*i == *j ? 1 : 0, r.Call(*i, *j)); }
|
| @@ -504,7 +527,8 @@
|
|
|
| WASM_EXEC_TEST(I64Ne) {
|
| REQUIRE(I64Ne);
|
| - WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_NE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| FOR_INT64_INPUTS(i) {
|
| FOR_INT64_INPUTS(j) { CHECK_EQ(*i != *j ? 1 : 0, r.Call(*i, *j)); }
|
| @@ -513,7 +537,8 @@
|
|
|
| WASM_EXEC_TEST(I64LtS) {
|
| REQUIRE(I64LtS);
|
| - WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_LTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| FOR_INT64_INPUTS(i) {
|
| FOR_INT64_INPUTS(j) { CHECK_EQ(*i < *j ? 1 : 0, r.Call(*i, *j)); }
|
| @@ -522,7 +547,8 @@
|
|
|
| WASM_EXEC_TEST(I64LeS) {
|
| REQUIRE(I64LeS);
|
| - WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_LES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| FOR_INT64_INPUTS(i) {
|
| FOR_INT64_INPUTS(j) { CHECK_EQ(*i <= *j ? 1 : 0, r.Call(*i, *j)); }
|
| @@ -531,7 +557,8 @@
|
|
|
| WASM_EXEC_TEST(I64LtU) {
|
| REQUIRE(I64LtU);
|
| - WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_LTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| FOR_UINT64_INPUTS(i) {
|
| FOR_UINT64_INPUTS(j) { CHECK_EQ(*i < *j ? 1 : 0, r.Call(*i, *j)); }
|
| @@ -540,7 +567,8 @@
|
|
|
| WASM_EXEC_TEST(I64LeU) {
|
| REQUIRE(I64LeU);
|
| - WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_LEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| FOR_UINT64_INPUTS(i) {
|
| FOR_UINT64_INPUTS(j) { CHECK_EQ(*i <= *j ? 1 : 0, r.Call(*i, *j)); }
|
| @@ -549,7 +577,8 @@
|
|
|
| WASM_EXEC_TEST(I64GtS) {
|
| REQUIRE(I64GtS);
|
| - WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_GTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| FOR_INT64_INPUTS(i) {
|
| FOR_INT64_INPUTS(j) { CHECK_EQ(*i > *j ? 1 : 0, r.Call(*i, *j)); }
|
| @@ -558,7 +587,8 @@
|
|
|
| WASM_EXEC_TEST(I64GeS) {
|
| REQUIRE(I64GeS);
|
| - WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_GES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| FOR_INT64_INPUTS(i) {
|
| FOR_INT64_INPUTS(j) { CHECK_EQ(*i >= *j ? 1 : 0, r.Call(*i, *j)); }
|
| @@ -567,7 +597,8 @@
|
|
|
| WASM_EXEC_TEST(I64GtU) {
|
| REQUIRE(I64GtU);
|
| - WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_GTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| FOR_UINT64_INPUTS(i) {
|
| FOR_UINT64_INPUTS(j) { CHECK_EQ(*i > *j ? 1 : 0, r.Call(*i, *j)); }
|
| @@ -576,7 +607,8 @@
|
|
|
| WASM_EXEC_TEST(I64GeU) {
|
| REQUIRE(I64GeU);
|
| - WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_GEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| FOR_UINT64_INPUTS(i) {
|
| FOR_UINT64_INPUTS(j) { CHECK_EQ(*i >= *j ? 1 : 0, r.Call(*i, *j)); }
|
| @@ -594,14 +626,14 @@
|
|
|
| WASM_EXEC_TEST(I64SConvertI32) {
|
| REQUIRE(I64SConvertI32);
|
| - WasmRunner<int64_t, int32_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int32());
|
| BUILD(r, WASM_I64_SCONVERT_I32(WASM_GET_LOCAL(0)));
|
| FOR_INT32_INPUTS(i) { CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); }
|
| }
|
|
|
| WASM_EXEC_TEST(I64UConvertI32) {
|
| REQUIRE(I64UConvertI32);
|
| - WasmRunner<int64_t, uint32_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Uint32());
|
| BUILD(r, WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(0)));
|
| FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); }
|
| }
|
| @@ -616,7 +648,7 @@
|
| {26, 0x1123456782345678},
|
| {38, 0xffedcba09edcba09}};
|
|
|
| - WasmRunner<int64_t, uint64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Uint64());
|
| BUILD(r, WASM_I64_POPCNT(WASM_GET_LOCAL(0)));
|
| for (size_t i = 0; i < arraysize(values); i++) {
|
| CHECK_EQ(values[i].expected, r.Call(values[i].input));
|
| @@ -625,7 +657,7 @@
|
|
|
| WASM_EXEC_TEST(F32SConvertI64) {
|
| REQUIRE(F32SConvertI64);
|
| - WasmRunner<float, int64_t> r(execution_mode);
|
| + WasmRunner<float> r(execution_mode, MachineType::Int64());
|
| BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0)));
|
| FOR_INT64_INPUTS(i) { CHECK_FLOAT_EQ(static_cast<float>(*i), r.Call(*i)); }
|
| }
|
| @@ -711,7 +743,7 @@
|
| {0x8000008000000001, 0x5f000001},
|
| {0x8000000000000400, 0x5f000000},
|
| {0x8000000000000401, 0x5f000000}};
|
| - WasmRunner<float, uint64_t> r(execution_mode);
|
| + WasmRunner<float> r(execution_mode, MachineType::Uint64());
|
| BUILD(r, WASM_F32_UCONVERT_I64(WASM_GET_LOCAL(0)));
|
| for (size_t i = 0; i < arraysize(values); i++) {
|
| CHECK_EQ(bit_cast<float>(values[i].expected), r.Call(values[i].input));
|
| @@ -720,7 +752,7 @@
|
|
|
| WASM_EXEC_TEST(F64SConvertI64) {
|
| REQUIRE(F64SConvertI64);
|
| - WasmRunner<double, int64_t> r(execution_mode);
|
| + WasmRunner<double> r(execution_mode, MachineType::Int64());
|
| BUILD(r, WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0)));
|
| FOR_INT64_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(*i), r.Call(*i)); }
|
| }
|
| @@ -805,7 +837,7 @@
|
| {0x8000008000000001, 0x43e0000010000000},
|
| {0x8000000000000400, 0x43e0000000000000},
|
| {0x8000000000000401, 0x43e0000000000001}};
|
| - WasmRunner<double, uint64_t> r(execution_mode);
|
| + WasmRunner<double> r(execution_mode, MachineType::Uint64());
|
| BUILD(r, WASM_F64_UCONVERT_I64(WASM_GET_LOCAL(0)));
|
| for (size_t i = 0; i < arraysize(values); i++) {
|
| CHECK_EQ(bit_cast<double>(values[i].expected), r.Call(values[i].input));
|
| @@ -813,7 +845,7 @@
|
| }
|
|
|
| WASM_EXEC_TEST_WITH_TRAP(I64SConvertF32a) {
|
| - WasmRunner<int64_t, float> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Float32());
|
| BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0)));
|
|
|
| FOR_FLOAT32_INPUTS(i) {
|
| @@ -827,7 +859,7 @@
|
| }
|
|
|
| WASM_EXEC_TEST_WITH_TRAP(I64SConvertF64a) {
|
| - WasmRunner<int64_t, double> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Float64());
|
| BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0)));
|
|
|
| FOR_FLOAT64_INPUTS(i) {
|
| @@ -841,7 +873,7 @@
|
| }
|
|
|
| WASM_EXEC_TEST_WITH_TRAP(I64UConvertF32a) {
|
| - WasmRunner<uint64_t, float> r(execution_mode);
|
| + WasmRunner<uint64_t> r(execution_mode, MachineType::Float32());
|
| BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0)));
|
|
|
| FOR_FLOAT32_INPUTS(i) {
|
| @@ -855,7 +887,7 @@
|
| }
|
|
|
| WASM_EXEC_TEST_WITH_TRAP(I64UConvertF64a) {
|
| - WasmRunner<uint64_t, double> r(execution_mode);
|
| + WasmRunner<uint64_t> r(execution_mode, MachineType::Float64());
|
| BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0)));
|
|
|
| FOR_FLOAT64_INPUTS(i) {
|
| @@ -869,23 +901,28 @@
|
| }
|
|
|
| WASM_EXEC_TEST(CallI64Parameter) {
|
| + // Build the target function.
|
| LocalType param_types[20];
|
| for (int i = 0; i < 20; i++) param_types[i] = kAstI64;
|
| param_types[3] = kAstI32;
|
| param_types[4] = kAstI32;
|
| FunctionSig sig(1, 19, param_types);
|
| for (int i = 0; i < 19; i++) {
|
| - if (i == 2 || i == 3) continue;
|
| - WasmRunner<int32_t> r(execution_mode);
|
| - // Build the target function.
|
| - WasmFunctionCompiler& t = r.NewFunction(&sig);
|
| - BUILD(t, WASM_GET_LOCAL(i));
|
| + TestingModule module(execution_mode);
|
| + WasmFunctionCompiler t(&sig, &module);
|
| + if (i == 2 || i == 3) {
|
| + continue;
|
| + } else {
|
| + BUILD(t, WASM_GET_LOCAL(i));
|
| + }
|
| + uint32_t index = t.CompileAndAdd();
|
|
|
| // Build the calling function.
|
| + WasmRunner<int32_t> r(&module);
|
| BUILD(
|
| r,
|
| WASM_I32_CONVERT_I64(WASM_CALL_FUNCTION(
|
| - t.function_index(), WASM_I64V_9(0xbcd12340000000b),
|
| + index, WASM_I64V_9(0xbcd12340000000b),
|
| WASM_I64V_9(0xbcd12340000000c), WASM_I32V_1(0xd),
|
| WASM_I32_CONVERT_I64(WASM_I64V_9(0xbcd12340000000e)),
|
| WASM_I64V_9(0xbcd12340000000f), WASM_I64V_10(0xbcd1234000000010),
|
| @@ -910,7 +947,8 @@
|
| CHECK_EQ(expected, r.Call());
|
| }
|
| {
|
| - WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| // return a op b
|
| BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| CHECK_EQ(expected, r.Call(a, b));
|
| @@ -926,7 +964,8 @@
|
| CHECK_EQ(expected, r.Call());
|
| }
|
| {
|
| - WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| // return a op b
|
| BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| CHECK_EQ(expected, r.Call(a, b));
|
| @@ -1029,7 +1068,7 @@
|
| {62, 0x0000000000000002}, {63, 0x0000000000000001},
|
| {64, 0x0000000000000000}};
|
|
|
| - WasmRunner<int64_t, uint64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Uint64());
|
| BUILD(r, WASM_I64_CLZ(WASM_GET_LOCAL(0)));
|
| for (size_t i = 0; i < arraysize(values); i++) {
|
| CHECK_EQ(values[i].expected, r.Call(values[i].input));
|
| @@ -1075,7 +1114,7 @@
|
| {2, 0x000000009afdbc84}, {1, 0x000000009afdbc82},
|
| {0, 0x000000009afdbc81}};
|
|
|
| - WasmRunner<int64_t, uint64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Uint64());
|
| BUILD(r, WASM_I64_CTZ(WASM_GET_LOCAL(0)));
|
| for (size_t i = 0; i < arraysize(values); i++) {
|
| CHECK_EQ(values[i].expected, r.Call(values[i].input));
|
| @@ -1093,7 +1132,7 @@
|
| {26, 0x1123456782345678},
|
| {38, 0xffedcba09edcba09}};
|
|
|
| - WasmRunner<int64_t, uint64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Uint64());
|
| BUILD(r, WASM_I64_POPCNT(WASM_GET_LOCAL(0)));
|
| for (size_t i = 0; i < arraysize(values); i++) {
|
| CHECK_EQ(values[i].expected, r.Call(values[i].input));
|
| @@ -1111,19 +1150,21 @@
|
| }
|
| }
|
| {
|
| - WasmRunner<int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64());
|
| BUILD(r, WASM_GET_LOCAL(0));
|
| FOR_INT64_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
|
| }
|
| {
|
| - WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| FOR_INT64_INPUTS(i) {
|
| FOR_INT64_INPUTS(j) { CHECK_EQ(*i ^ *j, r.Call(*i, *j)); }
|
| }
|
| }
|
| {
|
| - WasmRunner<int64_t, int64_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64(), MachineType::Int64());
|
| BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0),
|
| WASM_I64_XOR(WASM_GET_LOCAL(1), WASM_GET_LOCAL(2))));
|
| FOR_INT64_INPUTS(i) {
|
| @@ -1135,7 +1176,9 @@
|
| }
|
| }
|
| {
|
| - WasmRunner<int64_t, int64_t, int64_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64(), MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0),
|
| WASM_I64_XOR(WASM_GET_LOCAL(1),
|
| WASM_I64_XOR(WASM_GET_LOCAL(2),
|
| @@ -1153,15 +1196,16 @@
|
|
|
| WASM_EXEC_TEST(Call_Int64Sub) {
|
| REQUIRE(I64Sub);
|
| - WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
|
| // Build the target function.
|
| TestSignatures sigs;
|
| - WasmFunctionCompiler& t = r.NewFunction(sigs.l_ll());
|
| + TestingModule module(execution_mode);
|
| + WasmFunctionCompiler t(sigs.l_ll(), &module);
|
| BUILD(t, WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
| + uint32_t index = t.CompileAndAdd();
|
|
|
| // Build the caller function.
|
| - BUILD(r, WASM_CALL_FUNCTION(t.function_index(), WASM_GET_LOCAL(0),
|
| - WASM_GET_LOCAL(1)));
|
| + WasmRunner<int64_t> r(&module, MachineType::Int64(), MachineType::Int64());
|
| + BUILD(r, WASM_CALL_FUNCTION(index, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
|
|
| FOR_INT32_INPUTS(i) {
|
| FOR_INT32_INPUTS(j) {
|
| @@ -1184,8 +1228,9 @@
|
| kExprI64LoadMem};
|
|
|
| for (size_t m = 0; m < arraysize(loads); m++) {
|
| - WasmRunner<int64_t> r(execution_mode);
|
| - byte* memory = r.module().AddMemoryElems<byte>(16);
|
| + TestingModule module(execution_mode);
|
| + byte* memory = module.AddMemoryElems<byte>(16);
|
| + WasmRunner<int64_t> r(&module);
|
|
|
| byte code[] = {
|
| kExprI8Const, 8, // --
|
| @@ -1207,7 +1252,7 @@
|
| // Try a bunch of different negative values.
|
| for (int i = -1; i >= -128; i -= 11) {
|
| int size = 1 << m;
|
| - r.module().BlankMemory();
|
| + module.BlankMemory();
|
| memory[size - 1] = static_cast<byte>(i); // set the high order byte.
|
|
|
| int64_t expected = static_cast<int64_t>(i) << ((size - 1) * 8);
|
| @@ -1223,7 +1268,7 @@
|
|
|
| WASM_EXEC_TEST_WITH_TRAP(I64SConvertF32b) {
|
| REQUIRE(I64SConvertF32);
|
| - WasmRunner<int64_t, float> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Float32());
|
| BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0)));
|
|
|
| FOR_FLOAT32_INPUTS(i) {
|
| @@ -1238,7 +1283,7 @@
|
|
|
| WASM_EXEC_TEST_WITH_TRAP(I64SConvertF64b) {
|
| REQUIRE(I64SConvertF64);
|
| - WasmRunner<int64_t, double> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Float64());
|
| BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0)));
|
|
|
| FOR_FLOAT64_INPUTS(i) {
|
| @@ -1253,7 +1298,7 @@
|
|
|
| WASM_EXEC_TEST_WITH_TRAP(I64UConvertF32b) {
|
| REQUIRE(I64UConvertF32);
|
| - WasmRunner<uint64_t, float> r(execution_mode);
|
| + WasmRunner<uint64_t> r(execution_mode, MachineType::Float32());
|
| BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0)));
|
|
|
| FOR_FLOAT32_INPUTS(i) {
|
| @@ -1267,7 +1312,7 @@
|
|
|
| WASM_EXEC_TEST_WITH_TRAP(I64UConvertF64b) {
|
| REQUIRE(I64UConvertF64);
|
| - WasmRunner<uint64_t, double> r(execution_mode);
|
| + WasmRunner<uint64_t> r(execution_mode, MachineType::Float64());
|
| BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0)));
|
|
|
| FOR_FLOAT64_INPUTS(i) {
|
| @@ -1281,23 +1326,25 @@
|
|
|
| WASM_EXEC_TEST(I64ReinterpretF64) {
|
| REQUIRE(I64ReinterpretF64);
|
| - WasmRunner<int64_t> r(execution_mode);
|
| - int64_t* memory = r.module().AddMemoryElems<int64_t>(8);
|
| + TestingModule module(execution_mode);
|
| + int64_t* memory = module.AddMemoryElems<int64_t>(8);
|
| + WasmRunner<int64_t> r(&module);
|
|
|
| BUILD(r, WASM_I64_REINTERPRET_F64(
|
| WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO)));
|
|
|
| FOR_INT32_INPUTS(i) {
|
| int64_t expected = static_cast<int64_t>(*i) * 0x300010001;
|
| - r.module().WriteMemory(&memory[0], expected);
|
| + module.WriteMemory(&memory[0], expected);
|
| CHECK_EQ(expected, r.Call());
|
| }
|
| }
|
|
|
| WASM_EXEC_TEST(F64ReinterpretI64) {
|
| REQUIRE(F64ReinterpretI64);
|
| - WasmRunner<int64_t, int64_t> r(execution_mode);
|
| - int64_t* memory = r.module().AddMemoryElems<int64_t>(8);
|
| + TestingModule module(execution_mode);
|
| + int64_t* memory = module.AddMemoryElems<int64_t>(8);
|
| + WasmRunner<int64_t> r(&module, MachineType::Int64());
|
|
|
| BUILD(r, WASM_STORE_MEM(MachineType::Float64(), WASM_ZERO,
|
| WASM_F64_REINTERPRET_I64(WASM_GET_LOCAL(0))),
|
| @@ -1306,45 +1353,47 @@
|
| FOR_INT32_INPUTS(i) {
|
| int64_t expected = static_cast<int64_t>(*i) * 0x300010001;
|
| CHECK_EQ(expected, r.Call(expected));
|
| - CHECK_EQ(expected, r.module().ReadMemory<int64_t>(&memory[0]));
|
| + CHECK_EQ(expected, module.ReadMemory<int64_t>(&memory[0]));
|
| }
|
| }
|
|
|
| WASM_EXEC_TEST(LoadMemI64) {
|
| REQUIRE(I64LoadStore);
|
| - WasmRunner<int64_t> r(execution_mode);
|
| - int64_t* memory = r.module().AddMemoryElems<int64_t>(8);
|
| - r.module().RandomizeMemory(1111);
|
| + TestingModule module(execution_mode);
|
| + int64_t* memory = module.AddMemoryElems<int64_t>(8);
|
| + module.RandomizeMemory(1111);
|
| + WasmRunner<int64_t> r(&module);
|
|
|
| BUILD(r, WASM_LOAD_MEM(MachineType::Int64(), WASM_I8(0)));
|
|
|
| - r.module().WriteMemory<int64_t>(&memory[0], 0x1abbccdd00112233LL);
|
| + module.WriteMemory<int64_t>(&memory[0], 0x1abbccdd00112233LL);
|
| CHECK_EQ(0x1abbccdd00112233LL, r.Call());
|
|
|
| - r.module().WriteMemory<int64_t>(&memory[0], 0x33aabbccdd001122LL);
|
| + module.WriteMemory<int64_t>(&memory[0], 0x33aabbccdd001122LL);
|
| CHECK_EQ(0x33aabbccdd001122LL, r.Call());
|
|
|
| - r.module().WriteMemory<int64_t>(&memory[0], 77777777);
|
| + module.WriteMemory<int64_t>(&memory[0], 77777777);
|
| CHECK_EQ(77777777, r.Call());
|
| }
|
|
|
| WASM_EXEC_TEST(LoadMemI64_alignment) {
|
| REQUIRE(I64LoadStore);
|
| + TestingModule module(execution_mode);
|
| + int64_t* memory = module.AddMemoryElems<int64_t>(8);
|
| for (byte alignment = 0; alignment <= 3; alignment++) {
|
| - WasmRunner<int64_t> r(execution_mode);
|
| - int64_t* memory = r.module().AddMemoryElems<int64_t>(8);
|
| - r.module().RandomizeMemory(1111);
|
| + module.RandomizeMemory(1111);
|
| + WasmRunner<int64_t> r(&module);
|
|
|
| BUILD(r,
|
| WASM_LOAD_MEM_ALIGNMENT(MachineType::Int64(), WASM_I8(0), alignment));
|
|
|
| - r.module().WriteMemory<int64_t>(&memory[0], 0x1abbccdd00112233LL);
|
| + module.WriteMemory<int64_t>(&memory[0], 0x1abbccdd00112233LL);
|
| CHECK_EQ(0x1abbccdd00112233LL, r.Call());
|
|
|
| - r.module().WriteMemory<int64_t>(&memory[0], 0x33aabbccdd001122LL);
|
| + module.WriteMemory<int64_t>(&memory[0], 0x33aabbccdd001122LL);
|
| CHECK_EQ(0x33aabbccdd001122LL, r.Call());
|
|
|
| - r.module().WriteMemory<int64_t>(&memory[0], 77777777);
|
| + module.WriteMemory<int64_t>(&memory[0], 77777777);
|
| CHECK_EQ(77777777, r.Call());
|
| }
|
| }
|
| @@ -1355,8 +1404,9 @@
|
| REQUIRE(I64Sub);
|
| REQUIRE(I64Phi);
|
| const int kNumElems = 20;
|
| - WasmRunner<uint64_t, int32_t> r(execution_mode);
|
| - uint64_t* memory = r.module().AddMemoryElems<uint64_t>(kNumElems);
|
| + TestingModule module(execution_mode);
|
| + uint64_t* memory = module.AddMemoryElems<uint64_t>(kNumElems);
|
| + WasmRunner<uint64_t> r(&module, MachineType::Int32());
|
| const byte kSum = r.AllocateLocal(kAstI64);
|
|
|
| BUILD(
|
| @@ -1373,10 +1423,10 @@
|
|
|
| // Run 4 trials.
|
| for (int i = 0; i < 3; i++) {
|
| - r.module().RandomizeMemory(i * 33);
|
| + module.RandomizeMemory(i * 33);
|
| uint64_t expected = 0;
|
| for (size_t j = kNumElems - 1; j > 0; j--) {
|
| - expected += r.module().ReadMemory(&memory[j]);
|
| + expected += module.ReadMemory(&memory[j]);
|
| }
|
| uint64_t result = r.Call(8 * (kNumElems - 1));
|
| CHECK_EQ(expected, result);
|
| @@ -1384,19 +1434,20 @@
|
| }
|
|
|
| WASM_EXEC_TEST(StoreMemI64_alignment) {
|
| + TestingModule module(execution_mode);
|
| + int64_t* memory = module.AddMemoryElems<int64_t>(4);
|
| const int64_t kWritten = 0x12345678abcd0011ll;
|
|
|
| for (byte i = 0; i <= 3; i++) {
|
| - WasmRunner<int64_t, int64_t> r(execution_mode);
|
| - int64_t* memory = r.module().AddMemoryElems<int64_t>(4);
|
| + WasmRunner<int64_t> r(&module, MachineType::Int64());
|
| BUILD(r, WASM_STORE_MEM_ALIGNMENT(MachineType::Int64(), WASM_ZERO, i,
|
| WASM_GET_LOCAL(0)),
|
| WASM_GET_LOCAL(0));
|
| - r.module().RandomizeMemory(1111);
|
| - r.module().WriteMemory<int64_t>(&memory[0], 0);
|
| + module.RandomizeMemory(1111);
|
| + module.WriteMemory<int64_t>(&memory[0], 0);
|
|
|
| CHECK_EQ(kWritten, r.Call(kWritten));
|
| - CHECK_EQ(kWritten, r.module().ReadMemory(&memory[0]));
|
| + CHECK_EQ(kWritten, module.ReadMemory(&memory[0]));
|
| }
|
| }
|
|
|
| @@ -1405,15 +1456,16 @@
|
| REQUIRE(I64SConvertI32);
|
| REQUIRE(I64And);
|
| REQUIRE(DepthFirst);
|
| - WasmRunner<int32_t, int32_t> r(execution_mode);
|
| - int64_t* global = r.module().AddGlobal<int64_t>();
|
| + TestingModule module(execution_mode);
|
| + int64_t* global = module.AddGlobal<int64_t>(kAstI64);
|
| + WasmRunner<int32_t> r(&module, MachineType::Int32());
|
| // global = global + p0
|
| BUILD(r, WASM_SET_GLOBAL(
|
| 0, WASM_I64_AND(WASM_GET_GLOBAL(0),
|
| WASM_I64_SCONVERT_I32(WASM_GET_LOCAL(0)))),
|
| WASM_ZERO);
|
|
|
| - r.module().WriteMemory<int64_t>(global, 0xFFFFFFFFFFFFFFFFLL);
|
| + module.WriteMemory<int64_t>(global, 0xFFFFFFFFFFFFFFFFLL);
|
| for (int i = 9; i < 444444; i += 111111) {
|
| int64_t expected = *global & i;
|
| r.Call(i);
|
| @@ -1424,7 +1476,7 @@
|
| WASM_EXEC_TEST(I64Eqz) {
|
| REQUIRE(I64Eq);
|
|
|
| - WasmRunner<int32_t, int64_t> r(execution_mode);
|
| + WasmRunner<int32_t> r(execution_mode, MachineType::Int64());
|
| BUILD(r, WASM_I64_EQZ(WASM_GET_LOCAL(0)));
|
|
|
| FOR_INT64_INPUTS(i) {
|
| @@ -1435,7 +1487,8 @@
|
|
|
| WASM_EXEC_TEST(I64Ror) {
|
| REQUIRE(I64Ror);
|
| - WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_ROR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
|
|
| FOR_UINT64_INPUTS(i) {
|
| @@ -1448,7 +1501,8 @@
|
|
|
| WASM_EXEC_TEST(I64Rol) {
|
| REQUIRE(I64Rol);
|
| - WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
|
| + WasmRunner<int64_t> r(execution_mode, MachineType::Int64(),
|
| + MachineType::Int64());
|
| BUILD(r, WASM_I64_ROL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
|
|
|
| FOR_UINT64_INPUTS(i) {
|
| @@ -1460,6 +1514,9 @@
|
| }
|
|
|
| WASM_EXEC_TEST_WITH_TRAP(StoreMem_offset_oob_i64) {
|
| + TestingModule module(execution_mode);
|
| + byte* memory = module.AddMemoryElems<byte>(32);
|
| +
|
| static const MachineType machineTypes[] = {
|
| MachineType::Int8(), MachineType::Uint8(), MachineType::Int16(),
|
| MachineType::Uint16(), MachineType::Int32(), MachineType::Uint32(),
|
| @@ -1467,9 +1524,8 @@
|
| MachineType::Float64()};
|
|
|
| for (size_t m = 0; m < arraysize(machineTypes); m++) {
|
| - WasmRunner<int32_t, uint32_t> r(execution_mode);
|
| - byte* memory = r.module().AddMemoryElems<byte>(32);
|
| - r.module().RandomizeMemory(1119 + static_cast<int>(m));
|
| + module.RandomizeMemory(1119 + static_cast<int>(m));
|
| + WasmRunner<int32_t> r(&module, MachineType::Uint32());
|
|
|
| BUILD(r, WASM_STORE_MEM_OFFSET(machineTypes[m], 8, WASM_GET_LOCAL(0),
|
| WASM_LOAD_MEM(machineTypes[m], WASM_ZERO)),
|
| @@ -1497,14 +1553,17 @@
|
| // with many many parameters.
|
| TestSignatures sigs;
|
| for (byte num_params = 0; num_params < 40; num_params++) {
|
| - WasmRunner<void> r(kExecuteCompiled);
|
| - FunctionSig* sig = sigs.many(r.zone(), kAstStmt, param, num_params);
|
| -
|
| - r.module().AddSignature(sig);
|
| - r.module().AddSignature(sig);
|
| - r.module().AddIndirectFunctionTable(nullptr, 0);
|
| -
|
| - WasmFunctionCompiler& t = r.NewFunction(sig);
|
| + v8::internal::AccountingAllocator allocator;
|
| + Zone zone(&allocator, ZONE_NAME);
|
| + HandleScope scope(CcTest::InitIsolateOnce());
|
| + TestingModule module(kExecuteCompiled);
|
| + FunctionSig* sig = sigs.many(&zone, kAstStmt, param, num_params);
|
| +
|
| + module.AddSignature(sig);
|
| + module.AddSignature(sig);
|
| + module.AddIndirectFunctionTable(nullptr, 0);
|
| +
|
| + WasmFunctionCompiler t(sig, &module);
|
|
|
| std::vector<byte> code;
|
| for (byte p = 0; p < num_params; p++) {
|
| @@ -1514,6 +1573,7 @@
|
| ADD_CODE(code, kExprCallIndirect, 1, TABLE_ZERO);
|
|
|
| t.Build(&code[0], &code[0] + code.size());
|
| + t.Compile();
|
| }
|
| }
|
|
|
| @@ -1535,25 +1595,28 @@
|
| for (int which = 0; which < num_params; which++) {
|
| v8::internal::AccountingAllocator allocator;
|
| Zone zone(&allocator, ZONE_NAME);
|
| - WasmRunner<int32_t> r(execution_mode);
|
| - r.module().AddMemory(1024);
|
| + TestingModule module(execution_mode);
|
| + module.AddMemory(1024);
|
| MachineType* memtypes = &mixed[start];
|
| MachineType result = memtypes[which];
|
|
|
| // =========================================================================
|
| // Build the selector function.
|
| // =========================================================================
|
| + uint32_t index;
|
| FunctionSig::Builder b(&zone, 1, num_params);
|
| b.AddReturn(WasmOpcodes::LocalTypeFor(result));
|
| for (int i = 0; i < num_params; i++) {
|
| b.AddParam(WasmOpcodes::LocalTypeFor(memtypes[i]));
|
| }
|
| - WasmFunctionCompiler& t = r.NewFunction(b.Build());
|
| + WasmFunctionCompiler t(b.Build(), &module);
|
| BUILD(t, WASM_GET_LOCAL(which));
|
| + index = t.CompileAndAdd();
|
|
|
| // =========================================================================
|
| // Build the calling function.
|
| // =========================================================================
|
| + WasmRunner<int32_t> r(&module);
|
| std::vector<byte> code;
|
|
|
| // Load the offset for the store.
|
| @@ -1566,7 +1629,7 @@
|
| }
|
|
|
| // Call the selector function.
|
| - ADD_CODE(code, WASM_CALL_FUNCTION0(t.function_index()));
|
| + ADD_CODE(code, kExprCallFunction, static_cast<byte>(index));
|
|
|
| // Store the result in memory.
|
| ADD_CODE(code,
|
| @@ -1580,14 +1643,14 @@
|
|
|
| // Run the code.
|
| for (int t = 0; t < 10; t++) {
|
| - r.module().RandomizeMemory();
|
| + module.RandomizeMemory();
|
| CHECK_EQ(kExpected, r.Call());
|
|
|
| int size = WasmOpcodes::MemSize(result);
|
| for (int i = 0; i < size; i++) {
|
| int base = (which + 1) * kElemSize;
|
| - byte expected = r.module().raw_mem_at<byte>(base + i);
|
| - byte result = r.module().raw_mem_at<byte>(i);
|
| + byte expected = module.raw_mem_at<byte>(base + i);
|
| + byte result = module.raw_mem_at<byte>(i);
|
| CHECK_EQ(expected, result);
|
| }
|
| }
|
|
|