[asm.js] Fix checking of "fround" in parameter annotation.

R=clemensh@chromium.org
TEST=mjsunit/asm/regress-718745
BUG=chromium:718745

Change-Id: I4d31e90d7a2bbb1d07ce946682a95582f63c7e27
Reviewed-on: https://chromium-review.googlesource.com/497469
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45134}
This commit is contained in:
Michael Starzinger 2017-05-05 13:02:06 +02:00 committed by Commit Bot
parent 642478bb42
commit 2ed278f04a
2 changed files with 15 additions and 1 deletions

View File

@ -833,7 +833,8 @@ void AsmJsParser::ValidateFunctionParams(std::vector<AsmType*>* params) {
info->index = static_cast<uint32_t>(params->size());
params->push_back(AsmType::Double());
} else {
if (!GetVarInfo(Consume())->type->IsA(stdlib_fround_)) {
if (!scanner_.IsGlobal() ||
!GetVarInfo(Consume())->type->IsA(stdlib_fround_)) {
FAIL("Expected fround");
}
EXPECT_TOKEN('(');

View File

@ -0,0 +1,13 @@
// Copyright 2017 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.
function Module(stdlib) {
"use asm";
var fround = stdlib.Math.fround;
function f(a) {
a = (fround(a));
}
return { f:f };
}
Module(this).f();