Commit 9d96ebbb authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

Revert "[asm] Reject import calls with too many parameters"

This reverts commit a664aef0.

Reason for revert: Times out on CFI: https://cr-buildbucket.appspot.com/build/8820170241901030897

Original change's description:
> [asm] Reject import calls with too many parameters
>
> The asm parser was missing a check for too many parameters for calls to
> imported functions. For regular functions this check implicitly existed
> because the limit was checked at the function declaration, and the call
> site needs to match the declared parameter count.
>
> R=​mslekova@chromium.org
>
> Bug: chromium:1302596
> Change-Id: I0d35e70a66d682ee8fdecf5c8ea4d2b1419ce684
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3509393
> Reviewed-by: Maya Lekova <mslekova@chromium.org>
> Commit-Queue: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#79415}

Bug: chromium:1302596
Change-Id: I743647f739e0cc93b2e99145086dbbb7d2660c79
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3512853
Auto-Submit: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#79417}
parent 19357096
......@@ -760,7 +760,7 @@ void AsmJsParser::ValidateFunction() {
ValidateFunctionParams(&params);
// Check against limit on number of parameters.
if (params.size() > kV8MaxWasmFunctionParams) {
if (params.size() >= kV8MaxWasmFunctionParams) {
FAIL("Number of parameters exceeds internal limit");
}
......@@ -2246,9 +2246,6 @@ AsmType* AsmJsParser::ValidateCall() {
// also determined the complete function type and can perform checking against
// the expected type or update the expected type in case of first occurrence.
if (function_info->kind == VarKind::kImportedFunction) {
if (param_types.size() > kV8MaxWasmFunctionParams) {
FAILn("Number of parameters exceeds internal limit");
}
for (auto t : param_specific_types) {
if (!t->IsA(AsmType::Extern())) {
FAILn("Imported function args must be type extern");
......
......@@ -8,7 +8,7 @@
// valid asm.js and then break them with invalid instantiation arguments. If
// this script is run more than once (e.g. --stress-opt) then modules remain
// broken in the second run and assertions would fail. We prevent re-runs.
// Flags: --no-stress-opt
// Flags: --nostress-opt
function assertValidAsm(func) {
assertTrue(%IsAsmWasmCode(func));
......@@ -533,29 +533,3 @@ function assertValidAsm(func) {
/Uint8Array is not a constructor/);
assertFalse(%IsAsmWasmCode(regress1068355));
})();
(function TestTooManyParametersToImport() {
function MakeModule(num_arguments) {
let template = `
'use asm';
var imported = foreign.imported;
function main() {
imported(ARGS);
}
return main;
`;
let args = new Array(num_arguments).fill('0.0').join(', ');
return new Function('stdlib', 'foreign', template.replace('ARGS', args));
}
// V8 has an internal limit of 1000 parameters (see wasm-limits.h).
let Module1000Params = MakeModule(1000);
let Module1001Params = MakeModule(1001);
Module1000Params({}, {imported: i => i});
Module1001Params({}, {imported: i => i});
assertTrue(%IsAsmWasmCode(Module1000Params));
assertFalse(%IsAsmWasmCode(Module1001Params));
})();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment