Commit d1e9b884 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[asm.js] Fix parsing of float coercion arguments.

This fixes how arguments of a call to {fround} are being parsed. It now
accepts a single "AssignmentExpression" only instead of an "Expression"
which could potentially be a whole comma-separated list of expressions.

R=clemensh@chromium.org
TEST=mjsunit/regress/regress-crbug-1006592
BUG=chromium:1006592

Change-Id: Ifaf0c2b048e4ec18429cc6039c0e7dcdecc1d0bb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1815255Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63926}
parent 500f4ba2
......@@ -2489,7 +2489,7 @@ void AsmJsParser::ValidateFloatCoercion() {
// because imported functions are not allowed to have float return type.
call_coercion_position_ = scanner_.Position();
AsmType* ret;
RECURSE(ret = ValidateExpression());
RECURSE(ret = AssignmentExpression());
if (ret->IsA(AsmType::Floatish())) {
// Do nothing, as already a float.
} else if (ret->IsA(AsmType::DoubleQ())) {
......
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
function Module(stdlib) {
"use asm";
var fround = stdlib.Math.fround;
function f(a, b) {
a = +a;
b = +b;
return fround(a, b);
}
return { f: f };
}
var m = Module(this);
assertEquals(23, m.f(23));
assertEquals(42, m.f(42, 65));
assertFalse(%IsAsmWasmCode(Module));
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