| Index: test/cctest/wasm/test-run-wasm.cc
|
| diff --git a/test/cctest/wasm/test-run-wasm.cc b/test/cctest/wasm/test-run-wasm.cc
|
| index f48e44d4eb5c258f67fd3452510affe2c47eeb79..fd743df1a0536879182776d6f046764253011a31 100644
|
| --- a/test/cctest/wasm/test-run-wasm.cc
|
| +++ b/test/cctest/wasm/test-run-wasm.cc
|
| @@ -930,7 +930,7 @@ WASM_EXEC_TEST(BrTable4) {
|
| WASM_I8(75)};
|
|
|
| WasmRunner<int32_t> r(execution_mode, MachineType::Int32());
|
| - r.Build(code, code + arraysize(code));
|
| + r.Build(code, code + arraysize(code), false);
|
|
|
| for (int x = -3; x < 50; ++x) {
|
| int index = (x > 3 || x < 0) ? 3 : x;
|
| @@ -960,7 +960,7 @@ WASM_EXEC_TEST(BrTable4x4) {
|
| WASM_I8(55)};
|
|
|
| WasmRunner<int32_t> r(execution_mode, MachineType::Int32());
|
| - r.Build(code, code + arraysize(code));
|
| + r.Build(code, code + arraysize(code), false);
|
|
|
| for (int x = -6; x < 47; ++x) {
|
| int index = (x > 3 || x < 0) ? 3 : x;
|
| @@ -986,7 +986,7 @@ WASM_EXEC_TEST(BrTable4_fallthru) {
|
|
|
| WasmRunner<int32_t> r(execution_mode, MachineType::Int32(),
|
| MachineType::Int32());
|
| - r.Build(code, code + arraysize(code));
|
| + r.Build(code, code + arraysize(code), false);
|
|
|
| CHECK_EQ(15, r.Call(0, 0));
|
| CHECK_EQ(14, r.Call(1, 0));
|
| @@ -1778,13 +1778,13 @@ static void TestBuildGraphForSimpleExpression(WasmOpcode opcode) {
|
| if (sig->parameter_count() == 1) {
|
| byte code[] = {WASM_NO_LOCALS, kExprGetLocal, 0, static_cast<byte>(opcode)};
|
| TestBuildingGraph(&zone, &jsgraph, nullptr, sig, nullptr, code,
|
| - code + arraysize(code));
|
| + code + arraysize(code), false);
|
| } else {
|
| CHECK_EQ(2, sig->parameter_count());
|
| byte code[] = {WASM_NO_LOCALS, kExprGetLocal, 0, kExprGetLocal, 1,
|
| static_cast<byte>(opcode)};
|
| TestBuildingGraph(&zone, &jsgraph, nullptr, sig, nullptr, code,
|
| - code + arraysize(code));
|
| + code + arraysize(code), false);
|
| }
|
| }
|
|
|
| @@ -2200,7 +2200,7 @@ static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) {
|
| // Return the expected value.
|
| ADD_CODE(code, WASM_I32V_2(kExpected));
|
|
|
| - r.Build(&code[0], &code[0] + code.size());
|
| + r.Build(&code[0], &code[0] + code.size(), false);
|
|
|
| // Run the code.
|
| for (int t = 0; t < 10; ++t) {
|
| @@ -2401,18 +2401,19 @@ WASM_EXEC_TEST(SimpleCallIndirect) {
|
|
|
| // Signature table.
|
| module.AddSignature(sigs.f_ff());
|
| - module.AddSignature(sigs.i_ii());
|
| + byte index = module.AddSignature(sigs.i_ii());
|
| module.AddSignature(sigs.d_dd());
|
|
|
| // Function table.
|
| uint16_t indirect_function_table[] = {0, 1};
|
| - module.AddIndirectFunctionTable(indirect_function_table,
|
| + module.AddIndirectFunctionTable(sigs.i_ii(), index, indirect_function_table,
|
| arraysize(indirect_function_table));
|
| module.PopulateIndirectFunctionTable();
|
|
|
| // Builder the caller function.
|
| WasmRunner<int32_t> r(&module, MachineType::Int32());
|
| - BUILD(r, WASM_CALL_INDIRECT2(1, WASM_GET_LOCAL(0), WASM_I8(66), WASM_I8(22)));
|
| + BUILD(r,
|
| + WASM_CALL_INDIRECT2(1, 0, WASM_GET_LOCAL(0), WASM_I8(66), WASM_I8(22)));
|
|
|
| CHECK_EQ(88, r.Call(0));
|
| CHECK_EQ(44, r.Call(1));
|
| @@ -2433,12 +2434,12 @@ WASM_EXEC_TEST(MultipleCallIndirect) {
|
|
|
| // Signature table.
|
| module.AddSignature(sigs.f_ff());
|
| - module.AddSignature(sigs.i_ii());
|
| + byte index = module.AddSignature(sigs.i_ii());
|
| module.AddSignature(sigs.d_dd());
|
|
|
| // Function table.
|
| uint16_t indirect_function_table[] = {0, 1};
|
| - module.AddIndirectFunctionTable(indirect_function_table,
|
| + module.AddIndirectFunctionTable(sigs.i_ii(), index, indirect_function_table,
|
| arraysize(indirect_function_table));
|
| module.PopulateIndirectFunctionTable();
|
|
|
| @@ -2446,9 +2447,9 @@ WASM_EXEC_TEST(MultipleCallIndirect) {
|
| WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32(),
|
| MachineType::Int32());
|
| BUILD(r, WASM_I32_ADD(
|
| - WASM_CALL_INDIRECT2(1, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
|
| + WASM_CALL_INDIRECT2(1, 0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
|
| WASM_GET_LOCAL(2)),
|
| - WASM_CALL_INDIRECT2(1, WASM_GET_LOCAL(1), WASM_GET_LOCAL(2),
|
| + WASM_CALL_INDIRECT2(1, 0, WASM_GET_LOCAL(1), WASM_GET_LOCAL(2),
|
| WASM_GET_LOCAL(0))));
|
|
|
| CHECK_EQ(5, r.Call(0, 1, 2));
|
| @@ -2477,11 +2478,8 @@ WASM_EXEC_TEST(CallIndirect_NoTable) {
|
|
|
| // Builder the caller function.
|
| WasmRunner<int32_t> r(&module, MachineType::Int32());
|
| - BUILD(r, WASM_CALL_INDIRECT2(1, WASM_GET_LOCAL(0), WASM_I8(66), WASM_I8(22)));
|
| -
|
| - CHECK_TRAP(r.Call(0));
|
| - CHECK_TRAP(r.Call(1));
|
| - CHECK_TRAP(r.Call(2));
|
| + BUILD_FAIL(r, WASM_CALL_INDIRECT2(1, 0, WASM_GET_LOCAL(0), WASM_I8(66),
|
| + WASM_I8(22)));
|
| }
|
|
|
| WASM_EXEC_TEST(F32Floor) {
|
| @@ -2740,9 +2738,8 @@ static void CompileCallIndirectMany(LocalType param) {
|
| TestingModule module(kExecuteCompiled);
|
| FunctionSig* sig = sigs.many(&zone, kAstStmt, param, num_params);
|
|
|
| - module.AddSignature(sig);
|
| - module.AddSignature(sig);
|
| - module.AddIndirectFunctionTable(nullptr, 0);
|
| + byte index = module.AddSignature(sig);
|
| + module.AddIndirectFunctionTable(sig, index, nullptr, 0);
|
|
|
| WasmFunctionCompiler t(sig, &module);
|
|
|
| @@ -2751,9 +2748,9 @@ static void CompileCallIndirectMany(LocalType param) {
|
| for (byte p = 0; p < num_params; ++p) {
|
| ADD_CODE(code, kExprGetLocal, p);
|
| }
|
| - ADD_CODE(code, kExprCallIndirect, static_cast<byte>(num_params), 1);
|
| + ADD_CODE(code, kExprCallIndirect, static_cast<byte>(num_params), index, 0);
|
|
|
| - t.Build(&code[0], &code[0] + code.size());
|
| + t.Build(&code[0], &code[0] + code.size(), false);
|
| t.Compile();
|
| }
|
| }
|
|
|