Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Unified Diff: test/cctest/wasm/test-run-wasm-64.cc

Issue 1972153002: [wasm] Implement an interpreter for WASM. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/wasm/test-run-wasm.cc ('k') | test/cctest/wasm/test-run-wasm-asmjs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 578698783177a9e1de40ac724cdc3a2e844fc3cd..1a5b341b744c8b3a3410b27158d84d1691cfe90e 100644
--- a/test/cctest/wasm/test-run-wasm-64.cc
+++ b/test/cctest/wasm/test-run-wasm-64.cc
@@ -92,7 +92,7 @@ FOREACH_I64_OPERATOR(DECLARE_CONST)
WASM_EXEC_TEST(I64Const) {
REQUIRE(I64Const);
- WasmRunner<int64_t> r;
+ WasmRunner<int64_t> r(execution_mode);
const int64_t kExpectedValue = 0x1122334455667788LL;
// return(kExpectedValue)
BUILD(r, WASM_I64V_9(kExpectedValue));
@@ -103,7 +103,7 @@ WASM_EXEC_TEST(I64Const_many) {
REQUIRE(I64Const);
int cntr = 0;
FOR_INT32_INPUTS(i) {
- WasmRunner<int64_t> r;
+ WasmRunner<int64_t> r(execution_mode);
const int64_t kExpectedValue = (static_cast<int64_t>(*i) << 32) | cntr;
// return(kExpectedValue)
BUILD(r, WASM_I64V(kExpectedValue));
@@ -114,7 +114,7 @@ WASM_EXEC_TEST(I64Const_many) {
WASM_EXEC_TEST(Return_I64) {
REQUIRE(I64Return);
- WasmRunner<int64_t> r(MachineType::Int64());
+ WasmRunner<int64_t> r(execution_mode, MachineType::Int64());
BUILD(r, WASM_RETURN1(WASM_GET_LOCAL(0)));
@@ -123,7 +123,8 @@ WASM_EXEC_TEST(Return_I64) {
WASM_EXEC_TEST(I64Add) {
REQUIRE(I64Add);
- WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
+ 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)); }
@@ -132,7 +133,8 @@ WASM_EXEC_TEST(I64Add) {
WASM_EXEC_TEST(I64Sub) {
REQUIRE(I64Sub);
- WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
+ 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)); }
@@ -141,7 +143,8 @@ WASM_EXEC_TEST(I64Sub) {
WASM_EXEC_TEST(I64DivS) {
REQUIRE(I64DivS);
- WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
+ 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) {
@@ -158,7 +161,8 @@ WASM_EXEC_TEST(I64DivS) {
WASM_EXEC_TEST(I64DivS_Trap) {
REQUIRE(I64DivS);
- WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
+ 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)));
@@ -170,7 +174,7 @@ WASM_EXEC_TEST(I64DivS_Trap) {
WASM_EXEC_TEST(I64DivS_Byzero_Const) {
REQUIRE(I64DivS);
for (int8_t denom = -2; denom < 8; denom++) {
- WasmRunner<int64_t> r(MachineType::Int64());
+ 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) {
@@ -184,7 +188,8 @@ WASM_EXEC_TEST(I64DivS_Byzero_Const) {
WASM_EXEC_TEST(I64DivU) {
REQUIRE(I64DivU);
- WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64());
+ 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) {
@@ -199,7 +204,8 @@ WASM_EXEC_TEST(I64DivU) {
WASM_EXEC_TEST(I64DivU_Trap) {
REQUIRE(I64DivU);
- WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64());
+ 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_TRAP64(r.Call(asu64(100), asu64(0)));
@@ -210,7 +216,7 @@ WASM_EXEC_TEST(I64DivU_Trap) {
WASM_EXEC_TEST(I64DivU_Byzero_Const) {
REQUIRE(I64DivU);
for (uint64_t denom = 0xfffffffffffffffe; denom < 8; denom++) {
- WasmRunner<uint64_t> r(MachineType::Uint64());
+ 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++) {
@@ -225,7 +231,8 @@ WASM_EXEC_TEST(I64DivU_Byzero_Const) {
WASM_EXEC_TEST(I64RemS) {
REQUIRE(I64RemS);
- WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
+ 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) {
@@ -240,7 +247,8 @@ WASM_EXEC_TEST(I64RemS) {
WASM_EXEC_TEST(I64RemS_Trap) {
REQUIRE(I64RemS);
- WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
+ 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)));
@@ -251,7 +259,8 @@ WASM_EXEC_TEST(I64RemS_Trap) {
WASM_EXEC_TEST(I64RemU) {
REQUIRE(I64RemU);
- WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64());
+ 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) {
@@ -266,7 +275,8 @@ WASM_EXEC_TEST(I64RemU) {
WASM_EXEC_TEST(I64RemU_Trap) {
REQUIRE(I64RemU);
- WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64());
+ 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_TRAP64(r.Call(asu64(100), asu64(0)));
@@ -276,7 +286,8 @@ WASM_EXEC_TEST(I64RemU_Trap) {
WASM_EXEC_TEST(I64And) {
REQUIRE(I64And);
- WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
+ 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)); }
@@ -285,7 +296,8 @@ WASM_EXEC_TEST(I64And) {
WASM_EXEC_TEST(I64Ior) {
REQUIRE(I64Ior);
- WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
+ 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)); }
@@ -294,7 +306,8 @@ WASM_EXEC_TEST(I64Ior) {
WASM_EXEC_TEST(I64Xor) {
REQUIRE(I64Xor);
- WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
+ 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)); }
@@ -304,7 +317,8 @@ WASM_EXEC_TEST(I64Xor) {
WASM_EXEC_TEST(I64Shl) {
REQUIRE(I64Shl);
{
- WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64());
+ 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) {
@@ -315,22 +329,22 @@ WASM_EXEC_TEST(I64Shl) {
}
}
{
- WasmRunner<int64_t> r(MachineType::Int64());
+ WasmRunner<int64_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<int64_t> r(MachineType::Int64());
+ WasmRunner<int64_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<int64_t> r(MachineType::Int64());
+ WasmRunner<int64_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<int64_t> r(MachineType::Int64());
+ WasmRunner<int64_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)); }
}
@@ -339,7 +353,8 @@ WASM_EXEC_TEST(I64Shl) {
WASM_EXEC_TEST(I64ShrU) {
REQUIRE(I64ShrU);
{
- WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64());
+ 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) {
@@ -350,22 +365,22 @@ WASM_EXEC_TEST(I64ShrU) {
}
}
{
- WasmRunner<int64_t> r(MachineType::Int64());
+ WasmRunner<int64_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<int64_t> r(MachineType::Int64());
+ WasmRunner<int64_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<int64_t> r(MachineType::Int64());
+ WasmRunner<int64_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<int64_t> r(MachineType::Int64());
+ WasmRunner<int64_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)); }
}
@@ -374,7 +389,8 @@ WASM_EXEC_TEST(I64ShrU) {
WASM_EXEC_TEST(I64ShrS) {
REQUIRE(I64ShrS);
{
- WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
+ 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) {
@@ -385,22 +401,22 @@ WASM_EXEC_TEST(I64ShrS) {
}
}
{
- WasmRunner<int64_t> r(MachineType::Int64());
+ 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> r(MachineType::Int64());
+ 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> r(MachineType::Int64());
+ 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> r(MachineType::Int64());
+ 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)); }
}
@@ -408,7 +424,8 @@ WASM_EXEC_TEST(I64ShrS) {
WASM_EXEC_TEST(I64Eq) {
REQUIRE(I64Eq);
- WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
+ 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)); }
@@ -417,7 +434,8 @@ WASM_EXEC_TEST(I64Eq) {
WASM_EXEC_TEST(I64Ne) {
REQUIRE(I64Ne);
- WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
+ 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)); }
@@ -426,7 +444,8 @@ WASM_EXEC_TEST(I64Ne) {
WASM_EXEC_TEST(I64LtS) {
REQUIRE(I64LtS);
- WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
+ 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)); }
@@ -435,7 +454,8 @@ WASM_EXEC_TEST(I64LtS) {
WASM_EXEC_TEST(I64LeS) {
REQUIRE(I64LeS);
- WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
+ 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)); }
@@ -444,7 +464,8 @@ WASM_EXEC_TEST(I64LeS) {
WASM_EXEC_TEST(I64LtU) {
REQUIRE(I64LtU);
- WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
+ 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)); }
@@ -453,7 +474,8 @@ WASM_EXEC_TEST(I64LtU) {
WASM_EXEC_TEST(I64LeU) {
REQUIRE(I64LeU);
- WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
+ 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)); }
@@ -462,7 +484,8 @@ WASM_EXEC_TEST(I64LeU) {
WASM_EXEC_TEST(I64GtS) {
REQUIRE(I64GtS);
- WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
+ 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)); }
@@ -471,7 +494,8 @@ WASM_EXEC_TEST(I64GtS) {
WASM_EXEC_TEST(I64GeS) {
REQUIRE(I64GeS);
- WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
+ 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)); }
@@ -480,7 +504,8 @@ WASM_EXEC_TEST(I64GeS) {
WASM_EXEC_TEST(I64GtU) {
REQUIRE(I64GtU);
- WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
+ 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)); }
@@ -489,7 +514,8 @@ WASM_EXEC_TEST(I64GtU) {
WASM_EXEC_TEST(I64GeU) {
REQUIRE(I64GeU);
- WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
+ 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)); }
@@ -499,7 +525,7 @@ WASM_EXEC_TEST(I64GeU) {
WASM_EXEC_TEST(I32ConvertI64) {
REQUIRE(I32ConvertI64);
FOR_INT64_INPUTS(i) {
- WasmRunner<int32_t> r;
+ WasmRunner<int32_t> r(execution_mode);
BUILD(r, WASM_I32_CONVERT_I64(WASM_I64V(*i)));
CHECK_EQ(static_cast<int32_t>(*i), r.Call());
}
@@ -507,14 +533,14 @@ WASM_EXEC_TEST(I32ConvertI64) {
WASM_EXEC_TEST(I64SConvertI32) {
REQUIRE(I64SConvertI32);
- WasmRunner<int64_t> r(MachineType::Int32());
+ 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> r(MachineType::Uint32());
+ 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<uint64_t>(*i), r.Call(*i)); }
}
@@ -529,7 +555,7 @@ WASM_EXEC_TEST(I64Popcnt) {
{26, 0x1123456782345678},
{38, 0xffedcba09edcba09}};
- WasmRunner<int64_t> r(MachineType::Uint64());
+ 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));
@@ -538,7 +564,7 @@ WASM_EXEC_TEST(I64Popcnt) {
WASM_EXEC_TEST(F32SConvertI64) {
REQUIRE(F32SConvertI64);
- WasmRunner<float> r(MachineType::Int64());
+ 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)); }
}
@@ -624,7 +650,7 @@ WASM_EXEC_TEST(F32UConvertI64) {
{0x8000008000000001, 0x5f000001},
{0x8000000000000400, 0x5f000000},
{0x8000000000000401, 0x5f000000}};
- WasmRunner<float> r(MachineType::Uint64());
+ 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));
@@ -633,7 +659,7 @@ WASM_EXEC_TEST(F32UConvertI64) {
WASM_EXEC_TEST(F64SConvertI64) {
REQUIRE(F64SConvertI64);
- WasmRunner<double> r(MachineType::Int64());
+ 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)); }
}
@@ -718,7 +744,7 @@ WASM_EXEC_TEST(F64UConvertI64) {
{0x8000008000000001, 0x43e0000010000000},
{0x8000000000000400, 0x43e0000000000000},
{0x8000000000000401, 0x43e0000000000001}};
- WasmRunner<double> r(MachineType::Uint64());
+ 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));
@@ -726,7 +752,7 @@ WASM_EXEC_TEST(F64UConvertI64) {
}
WASM_EXEC_TEST(I64SConvertF32a) {
- WasmRunner<int64_t> r(MachineType::Float32());
+ WasmRunner<int64_t> r(execution_mode, MachineType::Float32());
BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
@@ -740,7 +766,7 @@ WASM_EXEC_TEST(I64SConvertF32a) {
}
WASM_EXEC_TEST(I64SConvertF64a) {
- WasmRunner<int64_t> r(MachineType::Float64());
+ WasmRunner<int64_t> r(execution_mode, MachineType::Float64());
BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
@@ -754,7 +780,7 @@ WASM_EXEC_TEST(I64SConvertF64a) {
}
WASM_EXEC_TEST(I64UConvertF32a) {
- WasmRunner<uint64_t> r(MachineType::Float32());
+ WasmRunner<uint64_t> r(execution_mode, MachineType::Float32());
BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
@@ -768,7 +794,7 @@ WASM_EXEC_TEST(I64UConvertF32a) {
}
WASM_EXEC_TEST(I64UConvertF64a) {
- WasmRunner<uint64_t> r(MachineType::Float64());
+ WasmRunner<uint64_t> r(execution_mode, MachineType::Float64());
BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
@@ -789,7 +815,7 @@ WASM_EXEC_TEST(CallI64Parameter) {
param_types[4] = kAstI32;
FunctionSig sig(1, 19, param_types);
for (int i = 0; i < 19; i++) {
- TestingModule module;
+ TestingModule module(execution_mode);
WasmFunctionCompiler t(&sig, &module);
if (i == 2 || i == 3) {
continue;
@@ -819,40 +845,44 @@ WASM_EXEC_TEST(CallI64Parameter) {
}
}
-void TestI64Binop(WasmOpcode opcode, int64_t expected, int64_t a, int64_t b) {
+void TestI64Binop(WasmExecutionMode execution_mode, WasmOpcode opcode,
+ int64_t expected, int64_t a, int64_t b) {
{
- WasmRunner<int64_t> r;
+ WasmRunner<int64_t> r(execution_mode);
// return K op K
BUILD(r, WASM_BINOP(opcode, WASM_I64V(a), WASM_I64V(b)));
CHECK_EQ(expected, r.Call());
}
{
- WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
+ 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));
}
}
-void TestI64Cmp(WasmOpcode opcode, int64_t expected, int64_t a, int64_t b) {
+void TestI64Cmp(WasmExecutionMode execution_mode, WasmOpcode opcode,
+ int64_t expected, int64_t a, int64_t b) {
{
- WasmRunner<int32_t> r;
+ WasmRunner<int32_t> r(execution_mode);
// return K op K
BUILD(r, WASM_BINOP(opcode, WASM_I64V(a), WASM_I64V(b)));
CHECK_EQ(expected, r.Call());
}
{
- WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
+ 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));
}
}
-#define TEST_I64_BINOP(name, expected, a, b) \
- do { \
- if (WASM_64 || kSupported_##name) \
- TestI64Binop(kExpr##name, expected, a, b); \
+#define TEST_I64_BINOP(name, expected, a, b) \
+ do { \
+ if (WASM_64 || kSupported_##name) \
+ TestI64Binop(execution_mode, kExpr##name, expected, a, b); \
} while (false)
WASM_EXEC_TEST(I64Binops) {
@@ -887,9 +917,10 @@ WASM_EXEC_TEST(I64Binops) {
TEST_I64_BINOP(I64Rol, 8728493013947314237, 0xe07af243ac4d219d, 15);
}
-#define TEST_I64_CMP(name, expected, a, b) \
- do { \
- if (WASM_64 || kSupported_##name) TestI64Cmp(kExpr##name, expected, a, b); \
+#define TEST_I64_CMP(name, expected, a, b) \
+ do { \
+ if (WASM_64 || kSupported_##name) \
+ TestI64Cmp(execution_mode, kExpr##name, expected, a, b); \
} while (false)
WASM_EXEC_TEST(I64Compare) {
@@ -944,7 +975,7 @@ WASM_EXEC_TEST(I64Clz) {
{62, 0x0000000000000002}, {63, 0x0000000000000001},
{64, 0x0000000000000000}};
- WasmRunner<int64_t> r(MachineType::Uint64());
+ 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));
@@ -990,7 +1021,7 @@ WASM_EXEC_TEST(I64Ctz) {
{2, 0x000000009afdbc84}, {1, 0x000000009afdbc82},
{0, 0x000000009afdbc81}};
- WasmRunner<int64_t> r(MachineType::Uint64());
+ 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));
@@ -1008,7 +1039,7 @@ WASM_EXEC_TEST(I64Popcnt2) {
{26, 0x1123456782345678},
{38, 0xffedcba09edcba09}};
- WasmRunner<int64_t> r(MachineType::Uint64());
+ 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));
@@ -1017,29 +1048,30 @@ WASM_EXEC_TEST(I64Popcnt2) {
// Test the WasmRunner with an Int64 return value and different numbers of
// Int64 parameters.
-TEST(Run_TestI64WasmRunner) {
+WASM_EXEC_TEST(I64WasmRunner) {
REQUIRE(I64Param);
REQUIRE(I64Xor);
- {FOR_INT64_INPUTS(i){WasmRunner<int64_t> r;
+ {FOR_INT64_INPUTS(i){WasmRunner<int64_t> r(execution_mode);
BUILD(r, WASM_I64V(*i));
CHECK_EQ(*i, r.Call());
}
}
{
- WasmRunner<int64_t> r(MachineType::Int64());
+ 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> r(MachineType::Int64(), MachineType::Int64());
+ 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> r(MachineType::Int64(), MachineType::Int64(),
- MachineType::Int64());
+ 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) {
@@ -1051,8 +1083,9 @@ TEST(Run_TestI64WasmRunner) {
}
}
{
- WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64(),
- MachineType::Int64(), MachineType::Int64());
+ 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),
@@ -1072,7 +1105,7 @@ WASM_EXEC_TEST(Call_Int64Sub) {
REQUIRE(I64Sub);
// Build the target function.
TestSignatures sigs;
- TestingModule module;
+ 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();
@@ -1102,7 +1135,7 @@ WASM_EXEC_TEST(LoadStoreI64_sx) {
kExprI64LoadMem};
for (size_t m = 0; m < arraysize(loads); m++) {
- TestingModule module;
+ TestingModule module(execution_mode);
byte* memory = module.AddMemoryElems<byte>(16);
WasmRunner<int64_t> r(&module);
@@ -1138,7 +1171,7 @@ WASM_EXEC_TEST(LoadStoreI64_sx) {
WASM_EXEC_TEST(I64SConvertF32b) {
REQUIRE(I64SConvertF32);
- WasmRunner<int64_t> r(MachineType::Float32());
+ WasmRunner<int64_t> r(execution_mode, MachineType::Float32());
BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
@@ -1153,7 +1186,7 @@ WASM_EXEC_TEST(I64SConvertF32b) {
WASM_EXEC_TEST(I64SConvertF64b) {
REQUIRE(I64SConvertF64);
- WasmRunner<int64_t> r(MachineType::Float64());
+ WasmRunner<int64_t> r(execution_mode, MachineType::Float64());
BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
@@ -1168,7 +1201,7 @@ WASM_EXEC_TEST(I64SConvertF64b) {
WASM_EXEC_TEST(I64UConvertF32b) {
REQUIRE(I64UConvertF32);
- WasmRunner<uint64_t> r(MachineType::Float32());
+ WasmRunner<uint64_t> r(execution_mode, MachineType::Float32());
BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
@@ -1182,7 +1215,7 @@ WASM_EXEC_TEST(I64UConvertF32b) {
WASM_EXEC_TEST(I64UConvertF64b) {
REQUIRE(I64UConvertF64);
- WasmRunner<uint64_t> r(MachineType::Float64());
+ WasmRunner<uint64_t> r(execution_mode, MachineType::Float64());
BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
@@ -1196,7 +1229,7 @@ WASM_EXEC_TEST(I64UConvertF64b) {
WASM_EXEC_TEST(I64ReinterpretF64) {
REQUIRE(I64ReinterpretF64);
- TestingModule module;
+ TestingModule module(execution_mode);
int64_t* memory = module.AddMemoryElems<int64_t>(8);
WasmRunner<int64_t> r(&module);
@@ -1212,7 +1245,7 @@ WASM_EXEC_TEST(I64ReinterpretF64) {
WASM_EXEC_TEST(F64ReinterpretI64) {
REQUIRE(F64ReinterpretI64);
- TestingModule module;
+ TestingModule module(execution_mode);
int64_t* memory = module.AddMemoryElems<int64_t>(8);
WasmRunner<int64_t> r(&module, MachineType::Int64());
@@ -1230,7 +1263,7 @@ WASM_EXEC_TEST(F64ReinterpretI64) {
WASM_EXEC_TEST(LoadMemI64) {
REQUIRE(I64LoadStore);
- TestingModule module;
+ TestingModule module(execution_mode);
int64_t* memory = module.AddMemoryElems<int64_t>(8);
module.RandomizeMemory(1111);
WasmRunner<int64_t> r(&module);
@@ -1247,9 +1280,9 @@ WASM_EXEC_TEST(LoadMemI64) {
CHECK_EQ(77777777, r.Call());
}
-WASM_EXEC_TEST(Run_Wasm_LoadMemI64_alignment) {
+WASM_EXEC_TEST(LoadMemI64_alignment) {
REQUIRE(I64LoadStore);
- TestingModule module;
+ TestingModule module(execution_mode);
int64_t* memory = module.AddMemoryElems<int64_t>(8);
for (byte alignment = 0; alignment <= 3; alignment++) {
module.RandomizeMemory(1111);
@@ -1269,13 +1302,13 @@ WASM_EXEC_TEST(Run_Wasm_LoadMemI64_alignment) {
}
}
-WASM_EXEC_TEST(Run_Wasm_MemI64_Sum) {
+WASM_EXEC_TEST(MemI64_Sum) {
REQUIRE(I64LoadStore);
REQUIRE(I64Add);
REQUIRE(I64Sub);
REQUIRE(I64Phi);
const int kNumElems = 20;
- TestingModule module;
+ 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);
@@ -1305,8 +1338,8 @@ WASM_EXEC_TEST(Run_Wasm_MemI64_Sum) {
}
}
-WASM_EXEC_TEST(Run_Wasm_StoreMemI64_alignment) {
- TestingModule module;
+WASM_EXEC_TEST(StoreMemI64_alignment) {
+ TestingModule module(execution_mode);
int64_t* memory = module.AddMemoryElems<int64_t>(4);
const int64_t kWritten = 0x12345678abcd0011ll;
@@ -1322,12 +1355,12 @@ WASM_EXEC_TEST(Run_Wasm_StoreMemI64_alignment) {
}
}
-WASM_EXEC_TEST(Run_Wasm_I64Global) {
+WASM_EXEC_TEST(I64Global) {
REQUIRE(I64LoadStore);
REQUIRE(I64SConvertI32);
REQUIRE(I64And);
REQUIRE(DepthFirst);
- TestingModule module;
+ TestingModule module(execution_mode);
int64_t* global = module.AddGlobal<int64_t>(MachineType::Int64());
WasmRunner<int32_t> r(&module, MachineType::Int32());
// global = global + p0
@@ -1347,7 +1380,7 @@ WASM_EXEC_TEST(Run_Wasm_I64Global) {
WASM_EXEC_TEST(I64Eqz) {
REQUIRE(I64Eq);
- WasmRunner<int32_t> r(MachineType::Int64());
+ WasmRunner<int32_t> r(execution_mode, MachineType::Int64());
BUILD(r, WASM_I64_EQZ(WASM_GET_LOCAL(0)));
FOR_INT64_INPUTS(i) {
@@ -1358,7 +1391,8 @@ WASM_EXEC_TEST(I64Eqz) {
WASM_EXEC_TEST(I64Ror) {
REQUIRE(I64Ror);
- WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
+ 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) {
@@ -1371,7 +1405,8 @@ WASM_EXEC_TEST(I64Ror) {
WASM_EXEC_TEST(I64Rol) {
REQUIRE(I64Rol);
- WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
+ 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) {
« no previous file with comments | « test/cctest/wasm/test-run-wasm.cc ('k') | test/cctest/wasm/test-run-wasm-asmjs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698