From 6565eb09c8c7277586a16c0cdb9204b84c3f23cd Mon Sep 17 00:00:00 2001 From: Andreas Haas Date: Tue, 8 Sep 2020 08:28:58 +0200 Subject: [PATCH] [wasm] Increase cost of return-call in the interpreter The wasm interpreter is slow on an arm simulator build with asan when it comes to return calls. An infinite return-call recursion therefore caused a timeout on ClusterFuzz. With this CL we increase the costs of return calls, and thereby avoid the timeout. R=clemensb@chromium.org Bug: chromium:1124899 Change-Id: If88e060779fbe2569e289e60170cf487dd31d7db Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2397615 Reviewed-by: Thibaud Michaud Commit-Queue: Andreas Haas Cr-Commit-Position: refs/heads/master@{#69740} --- test/common/wasm/wasm-interpreter.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/common/wasm/wasm-interpreter.cc b/test/common/wasm/wasm-interpreter.cc index cc89577cae..860723b69b 100644 --- a/test/common/wasm/wasm-interpreter.cc +++ b/test/common/wasm/wasm-interpreter.cc @@ -3268,6 +3268,9 @@ class WasmInterpreterInternals { } break; case kExprReturnCall: { + // Make return calls more expensive, so that return call recursions + // don't cause a timeout. + if (max > 0) max = std::max(0, max - 100); CallFunctionImmediate imm(&decoder, code->at(pc + 1)); InterpreterCode* target = codemap_.GetCode(imm.index); @@ -3280,6 +3283,9 @@ class WasmInterpreterInternals { } break; case kExprReturnCallIndirect: { + // Make return calls more expensive, so that return call recursions + // don't cause a timeout. + if (max > 0) max = std::max(0, max - 100); CallIndirectImmediate imm( WasmFeatures::All(), &decoder, code->at(pc + 1)); uint32_t entry_index = Pop().to();