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

[asm.js] Fix associativity of multiplicative expressions.

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

Change-Id: I6cc9f222769aa036275654286c9c6271ef2d1334
Reviewed-on: https://chromium-review.googlesource.com/520945Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45660}
parent c588bf85
......@@ -1677,7 +1677,7 @@ AsmType* AsmJsParser::MultiplicativeExpression() {
}
} else if (Check('/')) {
AsmType* b;
RECURSEn(b = MultiplicativeExpression());
RECURSEn(b = UnaryExpression());
if (a->IsA(AsmType::DoubleQ()) && b->IsA(AsmType::DoubleQ())) {
current_function_builder_->Emit(kExprF64Div);
a = AsmType::Double();
......@@ -1695,7 +1695,7 @@ AsmType* AsmJsParser::MultiplicativeExpression() {
}
} else if (Check('%')) {
AsmType* b;
RECURSEn(b = MultiplicativeExpression());
RECURSEn(b = UnaryExpression());
if (a->IsA(AsmType::DoubleQ()) && b->IsA(AsmType::DoubleQ())) {
current_function_builder_->Emit(kExprF64Mod);
a = AsmType::Double();
......
// 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";
function f(a,b,c) {
a = +a;
b = +b;
c = +c;
var r = 0.0;
r = a / b * c;
return +r;
}
return { f:f }
}
var m = Module(this);
assertEquals(16, m.f(32, 4, 2));
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