[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 <thibaudm@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69740}
This commit is contained in:
Andreas Haas 2020-09-08 08:28:58 +02:00 committed by Commit Bot
parent 64b5926497
commit 6565eb09c8

View File

@ -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<Decoder::kNoValidate> 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<Decoder::kNoValidate> imm(
WasmFeatures::All(), &decoder, code->at(pc + 1));
uint32_t entry_index = Pop().to<uint32_t>();