Index: test/cctest/wasm/test-run-wasm-interpreter.cc |
diff --git a/test/cctest/wasm/test-run-wasm-interpreter.cc b/test/cctest/wasm/test-run-wasm-interpreter.cc |
index 95b6d754cd1570677089e42cd4c7c79d36a38f7f..47d97f4e48717b7592843520902293e97359b1c0 100644 |
--- a/test/cctest/wasm/test-run-wasm-interpreter.cc |
+++ b/test/cctest/wasm/test-run-wasm-interpreter.cc |
@@ -35,14 +35,14 @@ |
} |
TEST(Run_WasmIfElse) { |
- WasmRunner<int32_t, int32_t> r(kExecuteInterpreted); |
+ WasmRunner<int32_t> r(kExecuteInterpreted, MachineType::Int32()); |
BUILD(r, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_I8(9), WASM_I8(10))); |
CHECK_EQ(10, r.Call(0)); |
CHECK_EQ(9, r.Call(1)); |
} |
TEST(Run_WasmIfReturn) { |
- WasmRunner<int32_t, int32_t> r(kExecuteInterpreted); |
+ WasmRunner<int32_t> r(kExecuteInterpreted, MachineType::Int32()); |
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_RETURN1(WASM_I8(77))), WASM_I8(65)); |
CHECK_EQ(65, r.Call(0)); |
CHECK_EQ(77, r.Call(1)); |
@@ -131,7 +131,8 @@ |
} |
TEST(Run_Wasm_nested_ifs_i) { |
- WasmRunner<int32_t, int32_t, int32_t> r(kExecuteInterpreted); |
+ WasmRunner<int32_t> r(kExecuteInterpreted, MachineType::Int32(), |
+ MachineType::Int32()); |
BUILD(r, WASM_IF_ELSE_I( |
WASM_GET_LOCAL(0), |
@@ -179,7 +180,8 @@ |
Find(code, sizeof(code), kNumBreakpoints, kExprGetLocal, kExprGetLocal, |
kExprI32Add); |
- WasmRunner<int32_t, uint32_t, uint32_t> r(kExecuteInterpreted); |
+ WasmRunner<int32_t> r(kExecuteInterpreted, MachineType::Uint32(), |
+ MachineType::Uint32()); |
r.Build(code, code + arraysize(code)); |
@@ -218,7 +220,8 @@ |
static const int kTraceLength = 4; |
byte code[] = {WASM_I32_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}; |
- WasmRunner<int32_t, uint32_t, uint32_t> r(kExecuteInterpreted); |
+ WasmRunner<int32_t> r(kExecuteInterpreted, MachineType::Uint32(), |
+ MachineType::Uint32()); |
r.Build(code, code + arraysize(code)); |
@@ -256,7 +259,8 @@ |
std::unique_ptr<int[]> offsets = |
Find(code, sizeof(code), kNumBreakpoints, kExprI32And); |
- WasmRunner<int32_t, uint32_t, uint32_t> r(kExecuteInterpreted); |
+ WasmRunner<int32_t> r(kExecuteInterpreted, MachineType::Uint32(), |
+ MachineType::Uint32()); |
r.Build(code, code + arraysize(code)); |
@@ -293,8 +297,9 @@ |
} |
TEST(GrowMemory) { |
- WasmRunner<int32_t, uint32_t> r(kExecuteInterpreted); |
- r.module().AddMemory(WasmModule::kPageSize); |
+ TestingModule module(kExecuteInterpreted); |
+ WasmRunner<int32_t> r(&module, MachineType::Uint32()); |
+ module.AddMemory(WasmModule::kPageSize); |
BUILD(r, WASM_GROW_MEMORY(WASM_GET_LOCAL(0))); |
CHECK_EQ(1, r.Call(1)); |
} |
@@ -302,8 +307,9 @@ |
TEST(GrowMemoryPreservesData) { |
int32_t index = 16; |
int32_t value = 2335; |
- WasmRunner<int32_t, uint32_t> r(kExecuteInterpreted); |
- r.module().AddMemory(WasmModule::kPageSize); |
+ TestingModule module(kExecuteInterpreted); |
+ WasmRunner<int32_t> r(&module, MachineType::Uint32()); |
+ module.AddMemory(WasmModule::kPageSize); |
BUILD(r, WASM_STORE_MEM(MachineType::Int32(), WASM_I32V(index), |
WASM_I32V(value)), |
WASM_GROW_MEMORY(WASM_GET_LOCAL(0)), WASM_DROP, |
@@ -314,14 +320,16 @@ |
TEST(GrowMemoryInvalidSize) { |
{ |
// Grow memory by an invalid amount without initial memory. |
- WasmRunner<int32_t, uint32_t> r(kExecuteInterpreted); |
+ TestingModule module(kExecuteInterpreted); |
+ WasmRunner<int32_t> r(&module, MachineType::Uint32()); |
BUILD(r, WASM_GROW_MEMORY(WASM_GET_LOCAL(0))); |
CHECK_EQ(-1, r.Call(1048575)); |
} |
{ |
// Grow memory by an invalid amount without initial memory. |
- WasmRunner<int32_t, uint32_t> r(kExecuteInterpreted); |
- r.module().AddMemory(WasmModule::kPageSize); |
+ TestingModule module(kExecuteInterpreted); |
+ WasmRunner<int32_t> r(&module, MachineType::Uint32()); |
+ module.AddMemory(WasmModule::kPageSize); |
BUILD(r, WASM_GROW_MEMORY(WASM_GET_LOCAL(0))); |
CHECK_EQ(-1, r.Call(1048575)); |
} |
@@ -330,7 +338,9 @@ |
TEST(TestPossibleNondeterminism) { |
{ |
// F32Div may produced NaN |
- WasmRunner<float, float, float> r(kExecuteInterpreted); |
+ TestingModule module(kExecuteInterpreted); |
+ WasmRunner<float> r(&module, MachineType::Float32(), |
+ MachineType::Float32()); |
BUILD(r, WASM_F32_DIV(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
r.Call(1048575.5f, 2.5f); |
CHECK(!r.possible_nondeterminism()); |
@@ -339,7 +349,8 @@ |
} |
{ |
// F32Sqrt may produced NaN |
- WasmRunner<float, float> r(kExecuteInterpreted); |
+ TestingModule module(kExecuteInterpreted); |
+ WasmRunner<float> r(&module, MachineType::Float32()); |
BUILD(r, WASM_F32_SQRT(WASM_GET_LOCAL(0))); |
r.Call(16.0f); |
CHECK(!r.possible_nondeterminism()); |
@@ -348,7 +359,9 @@ |
} |
{ |
// F32Mul may produced NaN |
- WasmRunner<float, float, float> r(kExecuteInterpreted); |
+ TestingModule module(kExecuteInterpreted); |
+ WasmRunner<float> r(&module, MachineType::Float32(), |
+ MachineType::Float32()); |
BUILD(r, WASM_F32_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
r.Call(1048575.5f, 2.5f); |
CHECK(!r.possible_nondeterminism()); |
@@ -357,7 +370,9 @@ |
} |
{ |
// F64Div may produced NaN |
- WasmRunner<double, double, double> r(kExecuteInterpreted); |
+ TestingModule module(kExecuteInterpreted); |
+ WasmRunner<double> r(&module, MachineType::Float64(), |
+ MachineType::Float64()); |
BUILD(r, WASM_F64_DIV(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
r.Call(1048575.5, 2.5); |
CHECK(!r.possible_nondeterminism()); |
@@ -366,7 +381,8 @@ |
} |
{ |
// F64Sqrt may produced NaN |
- WasmRunner<double, double> r(kExecuteInterpreted); |
+ TestingModule module(kExecuteInterpreted); |
+ WasmRunner<double> r(&module, MachineType::Float64()); |
BUILD(r, WASM_F64_SQRT(WASM_GET_LOCAL(0))); |
r.Call(1048575.5); |
CHECK(!r.possible_nondeterminism()); |
@@ -375,7 +391,9 @@ |
} |
{ |
// F64Mul may produced NaN |
- WasmRunner<double, double, double> r(kExecuteInterpreted); |
+ TestingModule module(kExecuteInterpreted); |
+ WasmRunner<double> r(&module, MachineType::Float64(), |
+ MachineType::Float64()); |
BUILD(r, WASM_F64_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
r.Call(1048575.5, 2.5); |
CHECK(!r.possible_nondeterminism()); |