Commit 0e22baac authored by aseemgarg's avatar aseemgarg Committed by Commit bot

fix int type coercion in asm to wasm

R=bradnelson@chromium.org
BUG=https://bugs.chromium.org/p/v8/issues/detail?id=4203
TEST=asm-wasm.js
LOG=N

Review URL: https://codereview.chromium.org/1675903002

Cr-Commit-Position: refs/heads/master@{#33793}
parent 69941bca
......@@ -782,9 +782,11 @@ class AsmWasmBuilderImpl : public AstVisitor {
enum ConvertOperation { kNone, kAsIs, kToInt, kToDouble };
ConvertOperation MatchOr(BinaryOperation* expr) {
if (MatchIntBinaryOperation(expr, Token::BIT_OR, 0)) {
return (TypeOf(expr->left()) == kAstI32) ? kAsIs : kToInt;
if (MatchIntBinaryOperation(expr, Token::BIT_OR, 0) &&
(TypeOf(expr->left()) == kAstI32)) {
return kAsIs;
} else {
UNREACHABLE();
return kNone;
}
}
......
......@@ -26,7 +26,7 @@ function IntTest() {
b = b|0;
var c = (b + 1)|0
var d = 3.0;
var e = d | 0; // double conversion
var e = ~~d; // double conversion
return (a + c + 1)|0;
}
......
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