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 4d39dd6ff7c2b4608958254c398afaddb6167371..d02bc847ace09ff218af27a5411e927f7ddef719 100644 |
--- a/test/cctest/wasm/test-run-wasm-asmjs.cc |
+++ b/test/cctest/wasm/test-run-wasm-asmjs.cc |
@@ -38,8 +38,9 @@ uint32_t GetMatchingRelocInfoCount(Handle<Code> code, RelocInfo::Mode rmode) { |
} |
WASM_EXEC_TEST(Int32AsmjsDivS) { |
- WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), |
- MachineType::Int32()); |
+ TestingModule module(execution_mode); |
+ module.origin = kAsmJsOrigin; |
+ WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); |
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)); |
@@ -50,8 +51,9 @@ WASM_EXEC_TEST(Int32AsmjsDivS) { |
} |
WASM_EXEC_TEST(Int32AsmjsRemS) { |
- WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), |
- MachineType::Int32()); |
+ TestingModule module(execution_mode); |
+ module.origin = kAsmJsOrigin; |
+ WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); |
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)); |
@@ -62,8 +64,9 @@ WASM_EXEC_TEST(Int32AsmjsRemS) { |
} |
WASM_EXEC_TEST(Int32AsmjsDivU) { |
- WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), |
- MachineType::Int32()); |
+ TestingModule module(execution_mode); |
+ module.origin = kAsmJsOrigin; |
+ WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); |
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)); |
@@ -74,8 +77,9 @@ WASM_EXEC_TEST(Int32AsmjsDivU) { |
} |
WASM_EXEC_TEST(Int32AsmjsRemU) { |
- WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), |
- MachineType::Int32()); |
+ TestingModule module(execution_mode); |
+ module.origin = kAsmJsOrigin; |
+ WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); |
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)); |
@@ -86,7 +90,9 @@ WASM_EXEC_TEST(Int32AsmjsRemU) { |
} |
WASM_EXEC_TEST(I32AsmjsSConvertF32) { |
- WasmRunner<int32_t> r(execution_mode, MachineType::Float32()); |
+ TestingModule module(execution_mode); |
+ module.origin = kAsmJsOrigin; |
+ WasmRunner<int32_t> r(&module, MachineType::Float32()); |
BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF32, WASM_GET_LOCAL(0))); |
FOR_FLOAT32_INPUTS(i) { |
@@ -96,7 +102,9 @@ WASM_EXEC_TEST(I32AsmjsSConvertF32) { |
} |
WASM_EXEC_TEST(I32AsmjsSConvertF64) { |
- WasmRunner<int32_t> r(execution_mode, MachineType::Float64()); |
+ TestingModule module(execution_mode); |
+ module.origin = kAsmJsOrigin; |
+ WasmRunner<int32_t> r(&module, MachineType::Float64()); |
BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF64, WASM_GET_LOCAL(0))); |
FOR_FLOAT64_INPUTS(i) { |
@@ -106,7 +114,9 @@ WASM_EXEC_TEST(I32AsmjsSConvertF64) { |
} |
WASM_EXEC_TEST(I32AsmjsUConvertF32) { |
- WasmRunner<uint32_t> r(execution_mode, MachineType::Float32()); |
+ TestingModule module(execution_mode); |
+ module.origin = kAsmJsOrigin; |
+ WasmRunner<uint32_t> r(&module, MachineType::Float32()); |
BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF32, WASM_GET_LOCAL(0))); |
FOR_FLOAT32_INPUTS(i) { |
@@ -116,7 +126,9 @@ WASM_EXEC_TEST(I32AsmjsUConvertF32) { |
} |
WASM_EXEC_TEST(I32AsmjsUConvertF64) { |
- WasmRunner<uint32_t> r(execution_mode, MachineType::Float64()); |
+ TestingModule module(execution_mode); |
+ module.origin = kAsmJsOrigin; |
+ WasmRunner<uint32_t> r(&module, MachineType::Float64()); |
BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF64, WASM_GET_LOCAL(0))); |
FOR_FLOAT64_INPUTS(i) { |
@@ -127,6 +139,7 @@ WASM_EXEC_TEST(I32AsmjsUConvertF64) { |
WASM_EXEC_TEST(LoadMemI32_oob_asm) { |
TestingModule module(execution_mode); |
+ module.origin = kAsmJsOrigin; |
int32_t* memory = module.AddMemoryElems<int32_t>(8); |
WasmRunner<int32_t> r(&module, MachineType::Uint32()); |
module.RandomizeMemory(1112); |
@@ -147,6 +160,7 @@ WASM_EXEC_TEST(LoadMemI32_oob_asm) { |
WASM_EXEC_TEST(LoadMemF32_oob_asm) { |
TestingModule module(execution_mode); |
+ module.origin = kAsmJsOrigin; |
float* memory = module.AddMemoryElems<float>(8); |
WasmRunner<float> r(&module, MachineType::Uint32()); |
module.RandomizeMemory(1112); |
@@ -167,6 +181,7 @@ WASM_EXEC_TEST(LoadMemF32_oob_asm) { |
WASM_EXEC_TEST(LoadMemF64_oob_asm) { |
TestingModule module(execution_mode); |
+ module.origin = kAsmJsOrigin; |
double* memory = module.AddMemoryElems<double>(8); |
WasmRunner<double> r(&module, MachineType::Uint32()); |
module.RandomizeMemory(1112); |
@@ -189,6 +204,7 @@ WASM_EXEC_TEST(LoadMemF64_oob_asm) { |
WASM_EXEC_TEST(StoreMemI32_oob_asm) { |
TestingModule module(execution_mode); |
+ module.origin = kAsmJsOrigin; |
int32_t* memory = module.AddMemoryElems<int32_t>(8); |
WasmRunner<int32_t> r(&module, MachineType::Uint32(), MachineType::Uint32()); |
module.RandomizeMemory(1112); |
@@ -224,6 +240,7 @@ WASM_EXEC_TEST(StoreMemI32_oob_asm) { |
#define INT_LOAD_TEST(OP_TYPE) \ |
TEST(RunWasm_AsmCheckedRelocInfo##OP_TYPE) { \ |
TestingModule module(kExecuteCompiled); \ |
+ module.origin = kAsmJsOrigin; \ |
WasmRunner<int32_t> r(&module, MachineType::Uint32()); \ |
BUILD(r, WASM_UNOP(OP_TYPE, WASM_GET_LOCAL(0))); \ |
CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], \ |
@@ -238,6 +255,7 @@ FOREACH_INT_CHECKED_LOAD_OP(INT_LOAD_TEST) |
#define INT_STORE_TEST(OP_TYPE) \ |
TEST(RunWasm_AsmCheckedRelocInfo##OP_TYPE) { \ |
TestingModule module(kExecuteCompiled); \ |
+ module.origin = kAsmJsOrigin; \ |
WasmRunner<int32_t> r(&module, MachineType::Uint32(), \ |
MachineType::Uint32()); \ |
BUILD(r, WASM_BINOP(OP_TYPE, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); \ |
@@ -252,6 +270,7 @@ FOREACH_INT_CHECKED_STORE_OP(INT_STORE_TEST) |
TEST(RunWasm_AsmCheckedLoadFloat32RelocInfo) { |
TestingModule module(kExecuteCompiled); |
+ module.origin = kAsmJsOrigin; |
WasmRunner<float> r(&module, MachineType::Uint32()); |
BUILD(r, WASM_UNOP(kExprF32AsmjsLoadMem, WASM_GET_LOCAL(0))); |
@@ -263,6 +282,7 @@ TEST(RunWasm_AsmCheckedLoadFloat32RelocInfo) { |
TEST(RunWasm_AsmCheckedStoreFloat32RelocInfo) { |
TestingModule module(kExecuteCompiled); |
+ module.origin = kAsmJsOrigin; |
WasmRunner<float> r(&module, MachineType::Uint32(), MachineType::Float32()); |
BUILD(r, WASM_BINOP(kExprF32AsmjsStoreMem, WASM_GET_LOCAL(0), |
WASM_GET_LOCAL(1))); |
@@ -275,6 +295,7 @@ TEST(RunWasm_AsmCheckedStoreFloat32RelocInfo) { |
TEST(RunWasm_AsmCheckedLoadFloat64RelocInfo) { |
TestingModule module(kExecuteCompiled); |
+ module.origin = kAsmJsOrigin; |
WasmRunner<double> r(&module, MachineType::Uint32()); |
BUILD(r, WASM_UNOP(kExprF64AsmjsLoadMem, WASM_GET_LOCAL(0))); |
@@ -286,6 +307,7 @@ TEST(RunWasm_AsmCheckedLoadFloat64RelocInfo) { |
TEST(RunWasm_AsmCheckedStoreFloat64RelocInfo) { |
TestingModule module(kExecuteCompiled); |
+ module.origin = kAsmJsOrigin; |
WasmRunner<double> r(&module, MachineType::Uint32(), MachineType::Float64()); |
BUILD(r, WASM_BINOP(kExprF64AsmjsStoreMem, WASM_GET_LOCAL(0), |
WASM_GET_LOCAL(1))); |