Index: test/cctest/wasm/test-run-wasm-asmjs.cc |
diff --git a/test/cctest/wasm/test-run-wasm-asmjs.cc b/test/cctest/wasm/test-run-wasm-asmjs.cc |
index 41871a1ab244ad7078bf0050de66040312aeeda0..38430f292c59059aae750d17b91b5314a436323b 100644 |
--- a/test/cctest/wasm/test-run-wasm-asmjs.cc |
+++ b/test/cctest/wasm/test-run-wasm-asmjs.cc |
@@ -38,9 +38,8 @@ uint32_t GetMatchingRelocInfoCount(Handle<Code> code, RelocInfo::Mode rmode) { |
} |
WASM_EXEC_TEST(Int32AsmjsDivS) { |
- TestingModule module(execution_mode); |
- module.ChangeOriginToAsmjs(); |
- WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); |
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); |
+ r.module().ChangeOriginToAsmjs(); |
BUILD(r, WASM_BINOP(kExprI32AsmjsDivS, 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)); |
@@ -51,9 +50,8 @@ WASM_EXEC_TEST(Int32AsmjsDivS) { |
} |
WASM_EXEC_TEST(Int32AsmjsRemS) { |
- TestingModule module(execution_mode); |
- module.ChangeOriginToAsmjs(); |
- WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); |
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); |
+ r.module().ChangeOriginToAsmjs(); |
BUILD(r, WASM_BINOP(kExprI32AsmjsRemS, 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)); |
@@ -64,9 +62,8 @@ WASM_EXEC_TEST(Int32AsmjsRemS) { |
} |
WASM_EXEC_TEST(Int32AsmjsDivU) { |
- TestingModule module(execution_mode); |
- module.ChangeOriginToAsmjs(); |
- WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); |
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); |
+ r.module().ChangeOriginToAsmjs(); |
BUILD(r, WASM_BINOP(kExprI32AsmjsDivU, 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)); |
@@ -77,9 +74,8 @@ WASM_EXEC_TEST(Int32AsmjsDivU) { |
} |
WASM_EXEC_TEST(Int32AsmjsRemU) { |
- TestingModule module(execution_mode); |
- module.ChangeOriginToAsmjs(); |
- WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); |
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_mode); |
+ r.module().ChangeOriginToAsmjs(); |
BUILD(r, WASM_BINOP(kExprI32AsmjsRemU, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
const int32_t kMin = std::numeric_limits<int32_t>::min(); |
CHECK_EQ(17, r.Call(217, 100)); |
@@ -90,9 +86,8 @@ WASM_EXEC_TEST(Int32AsmjsRemU) { |
} |
WASM_EXEC_TEST(I32AsmjsSConvertF32) { |
- TestingModule module(execution_mode); |
- module.ChangeOriginToAsmjs(); |
- WasmRunner<int32_t> r(&module, MachineType::Float32()); |
+ WasmRunner<int32_t, float> r(execution_mode); |
+ r.module().ChangeOriginToAsmjs(); |
BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF32, WASM_GET_LOCAL(0))); |
FOR_FLOAT32_INPUTS(i) { |
@@ -102,9 +97,8 @@ WASM_EXEC_TEST(I32AsmjsSConvertF32) { |
} |
WASM_EXEC_TEST(I32AsmjsSConvertF64) { |
- TestingModule module(execution_mode); |
- module.ChangeOriginToAsmjs(); |
- WasmRunner<int32_t> r(&module, MachineType::Float64()); |
+ WasmRunner<int32_t, double> r(execution_mode); |
+ r.module().ChangeOriginToAsmjs(); |
BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF64, WASM_GET_LOCAL(0))); |
FOR_FLOAT64_INPUTS(i) { |
@@ -114,9 +108,8 @@ WASM_EXEC_TEST(I32AsmjsSConvertF64) { |
} |
WASM_EXEC_TEST(I32AsmjsUConvertF32) { |
- TestingModule module(execution_mode); |
- module.ChangeOriginToAsmjs(); |
- WasmRunner<uint32_t> r(&module, MachineType::Float32()); |
+ WasmRunner<uint32_t, float> r(execution_mode); |
+ r.module().ChangeOriginToAsmjs(); |
BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF32, WASM_GET_LOCAL(0))); |
FOR_FLOAT32_INPUTS(i) { |
@@ -126,9 +119,8 @@ WASM_EXEC_TEST(I32AsmjsUConvertF32) { |
} |
WASM_EXEC_TEST(I32AsmjsUConvertF64) { |
- TestingModule module(execution_mode); |
- module.ChangeOriginToAsmjs(); |
- WasmRunner<uint32_t> r(&module, MachineType::Float64()); |
+ WasmRunner<uint32_t, double> r(execution_mode); |
+ r.module().ChangeOriginToAsmjs(); |
BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF64, WASM_GET_LOCAL(0))); |
FOR_FLOAT64_INPUTS(i) { |
@@ -138,11 +130,10 @@ WASM_EXEC_TEST(I32AsmjsUConvertF64) { |
} |
WASM_EXEC_TEST(LoadMemI32_oob_asm) { |
- TestingModule module(execution_mode); |
- module.ChangeOriginToAsmjs(); |
- int32_t* memory = module.AddMemoryElems<int32_t>(8); |
- WasmRunner<int32_t> r(&module, MachineType::Uint32()); |
- module.RandomizeMemory(1112); |
+ WasmRunner<int32_t, uint32_t> r(execution_mode); |
+ r.module().ChangeOriginToAsmjs(); |
+ int32_t* memory = r.module().AddMemoryElems<int32_t>(8); |
+ r.module().RandomizeMemory(1112); |
BUILD(r, WASM_UNOP(kExprI32AsmjsLoadMem, WASM_GET_LOCAL(0))); |
@@ -159,11 +150,10 @@ WASM_EXEC_TEST(LoadMemI32_oob_asm) { |
} |
WASM_EXEC_TEST(LoadMemF32_oob_asm) { |
- TestingModule module(execution_mode); |
- module.ChangeOriginToAsmjs(); |
- float* memory = module.AddMemoryElems<float>(8); |
- WasmRunner<float> r(&module, MachineType::Uint32()); |
- module.RandomizeMemory(1112); |
+ WasmRunner<float, uint32_t> r(execution_mode); |
+ r.module().ChangeOriginToAsmjs(); |
+ float* memory = r.module().AddMemoryElems<float>(8); |
+ r.module().RandomizeMemory(1112); |
BUILD(r, WASM_UNOP(kExprF32AsmjsLoadMem, WASM_GET_LOCAL(0))); |
@@ -180,11 +170,10 @@ WASM_EXEC_TEST(LoadMemF32_oob_asm) { |
} |
WASM_EXEC_TEST(LoadMemF64_oob_asm) { |
- TestingModule module(execution_mode); |
- module.ChangeOriginToAsmjs(); |
- double* memory = module.AddMemoryElems<double>(8); |
- WasmRunner<double> r(&module, MachineType::Uint32()); |
- module.RandomizeMemory(1112); |
+ WasmRunner<double, uint32_t> r(execution_mode); |
+ r.module().ChangeOriginToAsmjs(); |
+ double* memory = r.module().AddMemoryElems<double>(8); |
+ r.module().RandomizeMemory(1112); |
BUILD(r, WASM_UNOP(kExprF64AsmjsLoadMem, WASM_GET_LOCAL(0))); |
@@ -203,11 +192,10 @@ WASM_EXEC_TEST(LoadMemF64_oob_asm) { |
} |
WASM_EXEC_TEST(StoreMemI32_oob_asm) { |
- TestingModule module(execution_mode); |
- module.ChangeOriginToAsmjs(); |
- int32_t* memory = module.AddMemoryElems<int32_t>(8); |
- WasmRunner<int32_t> r(&module, MachineType::Uint32(), MachineType::Uint32()); |
- module.RandomizeMemory(1112); |
+ WasmRunner<int32_t, uint32_t, uint32_t> r(execution_mode); |
+ r.module().ChangeOriginToAsmjs(); |
+ int32_t* memory = r.module().AddMemoryElems<int32_t>(8); |
+ r.module().RandomizeMemory(1112); |
BUILD(r, WASM_BINOP(kExprI32AsmjsStoreMem, WASM_GET_LOCAL(0), |
WASM_GET_LOCAL(1))); |
@@ -237,87 +225,78 @@ WASM_EXEC_TEST(StoreMemI32_oob_asm) { |
TEST_BODY(kExprI32AsmjsStoreMem16) \ |
TEST_BODY(kExprI32AsmjsStoreMem) |
-#define INT_LOAD_TEST(OP_TYPE) \ |
- TEST(RunWasm_AsmCheckedRelocInfo##OP_TYPE) { \ |
- TestingModule module(kExecuteCompiled); \ |
- module.ChangeOriginToAsmjs(); \ |
- WasmRunner<int32_t> r(&module, MachineType::Uint32()); \ |
- BUILD(r, WASM_UNOP(OP_TYPE, WASM_GET_LOCAL(0))); \ |
- CHECK_EQ(1u, GetMatchingRelocInfoCount(module.instance->function_code[0], \ |
- RelocInfo::WASM_MEMORY_REFERENCE)); \ |
- CHECK_NE( \ |
- 0u, GetMatchingRelocInfoCount(module.instance->function_code[0], \ |
- RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); \ |
+#define INT_LOAD_TEST(OP_TYPE) \ |
+ TEST(RunWasm_AsmCheckedRelocInfo##OP_TYPE) { \ |
+ WasmRunner<int32_t, uint32_t> r(kExecuteCompiled); \ |
+ r.module().ChangeOriginToAsmjs(); \ |
+ BUILD(r, WASM_UNOP(OP_TYPE, WASM_GET_LOCAL(0))); \ |
+ CHECK_EQ(1, \ |
+ GetMatchingRelocInfoCount(r.module().instance->function_code[0], \ |
+ RelocInfo::WASM_MEMORY_REFERENCE)); \ |
+ CHECK_NE( \ |
+ 0, GetMatchingRelocInfoCount(r.module().instance->function_code[0], \ |
+ RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); \ |
} |
FOREACH_INT_CHECKED_LOAD_OP(INT_LOAD_TEST) |
-#define INT_STORE_TEST(OP_TYPE) \ |
- TEST(RunWasm_AsmCheckedRelocInfo##OP_TYPE) { \ |
- TestingModule module(kExecuteCompiled); \ |
- module.ChangeOriginToAsmjs(); \ |
- WasmRunner<int32_t> r(&module, MachineType::Uint32(), \ |
- MachineType::Uint32()); \ |
- BUILD(r, WASM_BINOP(OP_TYPE, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); \ |
- CHECK_EQ(1u, GetMatchingRelocInfoCount(module.instance->function_code[0], \ |
- RelocInfo::WASM_MEMORY_REFERENCE)); \ |
- CHECK_NE( \ |
- 0u, GetMatchingRelocInfoCount(module.instance->function_code[0], \ |
- RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); \ |
+#define INT_STORE_TEST(OP_TYPE) \ |
+ TEST(RunWasm_AsmCheckedRelocInfo##OP_TYPE) { \ |
+ WasmRunner<int32_t, uint32_t, uint32_t> r(kExecuteCompiled); \ |
+ r.module().ChangeOriginToAsmjs(); \ |
+ BUILD(r, WASM_BINOP(OP_TYPE, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); \ |
+ CHECK_EQ(1, \ |
+ GetMatchingRelocInfoCount(r.module().instance->function_code[0], \ |
+ RelocInfo::WASM_MEMORY_REFERENCE)); \ |
+ CHECK_NE( \ |
+ 0, GetMatchingRelocInfoCount(r.module().instance->function_code[0], \ |
+ RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); \ |
} |
FOREACH_INT_CHECKED_STORE_OP(INT_STORE_TEST) |
TEST(RunWasm_AsmCheckedLoadFloat32RelocInfo) { |
- TestingModule module(kExecuteCompiled); |
- module.ChangeOriginToAsmjs(); |
- WasmRunner<float> r(&module, MachineType::Uint32()); |
+ WasmRunner<float, uint32_t> r(kExecuteCompiled); |
+ r.module().ChangeOriginToAsmjs(); |
BUILD(r, WASM_UNOP(kExprF32AsmjsLoadMem, WASM_GET_LOCAL(0))); |
- CHECK_EQ(1u, GetMatchingRelocInfoCount(module.instance->function_code[0], |
- RelocInfo::WASM_MEMORY_REFERENCE)); |
- CHECK_NE(0u, |
- GetMatchingRelocInfoCount(module.instance->function_code[0], |
- RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); |
+ CHECK_EQ(1, GetMatchingRelocInfoCount(r.module().instance->function_code[0], |
+ RelocInfo::WASM_MEMORY_REFERENCE)); |
+ CHECK_NE(0, GetMatchingRelocInfoCount(r.module().instance->function_code[0], |
+ RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); |
} |
TEST(RunWasm_AsmCheckedStoreFloat32RelocInfo) { |
- TestingModule module(kExecuteCompiled); |
- module.ChangeOriginToAsmjs(); |
- WasmRunner<float> r(&module, MachineType::Uint32(), MachineType::Float32()); |
+ WasmRunner<float, uint32_t, float> r(kExecuteCompiled); |
+ r.module().ChangeOriginToAsmjs(); |
BUILD(r, WASM_BINOP(kExprF32AsmjsStoreMem, WASM_GET_LOCAL(0), |
WASM_GET_LOCAL(1))); |
- CHECK_EQ(1u, GetMatchingRelocInfoCount(module.instance->function_code[0], |
- RelocInfo::WASM_MEMORY_REFERENCE)); |
- CHECK_NE(0u, |
- GetMatchingRelocInfoCount(module.instance->function_code[0], |
- RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); |
+ CHECK_EQ(1, GetMatchingRelocInfoCount(r.module().instance->function_code[0], |
+ RelocInfo::WASM_MEMORY_REFERENCE)); |
+ CHECK_NE(0, GetMatchingRelocInfoCount(r.module().instance->function_code[0], |
+ RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); |
} |
TEST(RunWasm_AsmCheckedLoadFloat64RelocInfo) { |
- TestingModule module(kExecuteCompiled); |
- module.ChangeOriginToAsmjs(); |
- WasmRunner<double> r(&module, MachineType::Uint32()); |
+ WasmRunner<double, uint32_t> r(kExecuteCompiled); |
+ r.module().ChangeOriginToAsmjs(); |
BUILD(r, WASM_UNOP(kExprF64AsmjsLoadMem, WASM_GET_LOCAL(0))); |
- CHECK_EQ(1u, GetMatchingRelocInfoCount(module.instance->function_code[0], |
- RelocInfo::WASM_MEMORY_REFERENCE)); |
- CHECK_NE(0u, |
- GetMatchingRelocInfoCount(module.instance->function_code[0], |
- RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); |
+ CHECK_EQ(1, GetMatchingRelocInfoCount(r.module().instance->function_code[0], |
+ RelocInfo::WASM_MEMORY_REFERENCE)); |
+ CHECK_NE(0, GetMatchingRelocInfoCount(r.module().instance->function_code[0], |
+ RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); |
} |
TEST(RunWasm_AsmCheckedStoreFloat64RelocInfo) { |
- TestingModule module(kExecuteCompiled); |
- module.ChangeOriginToAsmjs(); |
- WasmRunner<double> r(&module, MachineType::Uint32(), MachineType::Float64()); |
+ WasmRunner<double, uint32_t, double> r(kExecuteCompiled); |
+ r.module().ChangeOriginToAsmjs(); |
BUILD(r, WASM_BINOP(kExprF64AsmjsStoreMem, WASM_GET_LOCAL(0), |
WASM_GET_LOCAL(1))); |
- CHECK_EQ(1u, GetMatchingRelocInfoCount(module.instance->function_code[0], |
- RelocInfo::WASM_MEMORY_REFERENCE)); |
- CHECK_NE(0u, |
- GetMatchingRelocInfoCount(module.instance->function_code[0], |
- RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); |
+ CHECK_EQ(1, GetMatchingRelocInfoCount(r.module().instance->function_code[0], |
+ RelocInfo::WASM_MEMORY_REFERENCE)); |
+ CHECK_NE(0, GetMatchingRelocInfoCount(r.module().instance->function_code[0], |
+ RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); |
} |