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 4873f570b72eecb66b367cebca7e68c7670a0d8d..14636bb5f007a2f0fecfd5ec90fd04ae4b04c380 100644 |
--- a/test/cctest/wasm/test-run-wasm.cc |
+++ b/test/cctest/wasm/test-run-wasm.cc |
@@ -3275,4 +3275,49 @@ TEST(Run_Wasm_F32CopySign) { |
} |
} |
+ |
+#endif |
+ |
+ |
+void CompileCallIndirectMany(LocalType param) { |
+ // Make sure we don't run out of registers when compiling indirect calls |
+ // with many many parameters. |
+ TestSignatures sigs; |
+ for (byte num_params = 0; num_params < 40; num_params++) { |
+ Zone zone; |
+ HandleScope scope(CcTest::InitIsolateOnce()); |
+ TestingModule module; |
+ FunctionSig* sig = sigs.many(&zone, kAstStmt, param, num_params); |
+ |
+ module.AddSignature(sig); |
+ module.AddSignature(sig); |
+ module.AddIndirectFunctionTable(nullptr, 0); |
+ |
+ WasmFunctionCompiler t(sig); |
+ t.env.module = &module; |
+ |
+ std::vector<byte> code; |
+ ADD_CODE(code, kExprCallIndirect, 1); |
+ ADD_CODE(code, kExprI8Const, 0); |
+ for (byte p = 0; p < num_params; p++) { |
+ ADD_CODE(code, kExprGetLocal, p); |
+ } |
+ |
+ t.Build(&code[0], &code[0] + code.size()); |
+ t.Compile(&module); |
+ } |
+} |
+ |
+ |
+TEST(Compile_Wasm_CallIndirect_Many_i32) { CompileCallIndirectMany(kAstI32); } |
+ |
+ |
+#if WASM_64 |
+TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } |
#endif |
+ |
+ |
+TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } |
+ |
+ |
+TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } |