v8/test/mjsunit/regress/regress-8377.js
Michael Starzinger 9195ca990c [asm.js] Fix fall-back case in MultiplicativeExpression.
This fixes the fall-back case when parsing a multiplicative expression
where the lookahead found a '-' token followed by an unsigned token, but
no '*' token is following. We cannot rewind both tokens, but still need
to make sure that a full multiplicative expression is parsed.

R=clemensh@chromium.org
TEST=mjsunit/regress/regress-8377
BUG=v8:8377

Change-Id: I20ce6267445b32bdaf03f41f11d9ef4be66cb636
Reviewed-on: https://chromium-review.googlesource.com/c/1304317
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57084}
2018-10-29 12:59:01 +00:00

25 lines
587 B
JavaScript

// Copyright 2018 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(global, env, buffer) {
"use asm";
function test1() {
var x = 0;
x = -1 / 1 | 0;
return x | 0;
}
function test2() {
var x = 0;
x = (-1 / 1) | 0;
return x | 0;
}
return { test1: test1, test2: test2 };
};
let module = Module(this);
assertEquals(-1, module.test1());
assertEquals(-1, module.test2());
assertTrue(%IsAsmWasmCode(Module));