Commit ed6fea15 authored by titzer's avatar titzer Committed by Commit bot

[wasm] Fix double to int conversions.

R=ahaas@chromium.org
LOG=Y
BUG=chromium:576560

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

Cr-Commit-Position: refs/heads/master@{#33239}
parent d672ee30
...@@ -622,9 +622,7 @@ class AsmWasmBuilderImpl : public AstVisitor { ...@@ -622,9 +622,7 @@ class AsmWasmBuilderImpl : public AstVisitor {
ConvertOperation MatchOr(BinaryOperation* expr) { ConvertOperation MatchOr(BinaryOperation* expr) {
if (MatchIntBinaryOperation(expr, Token::BIT_OR, 0)) { if (MatchIntBinaryOperation(expr, Token::BIT_OR, 0)) {
DCHECK(TypeOf(expr->left()) == kAstI32); return (TypeOf(expr->left()) == kAstI32) ? kAsIs : kToInt;
DCHECK(TypeOf(expr->right()) == kAstI32);
return kAsIs;
} else { } else {
return kNone; return kNone;
} }
...@@ -632,9 +630,8 @@ class AsmWasmBuilderImpl : public AstVisitor { ...@@ -632,9 +630,8 @@ class AsmWasmBuilderImpl : public AstVisitor {
ConvertOperation MatchShr(BinaryOperation* expr) { ConvertOperation MatchShr(BinaryOperation* expr) {
if (MatchIntBinaryOperation(expr, Token::SHR, 0)) { if (MatchIntBinaryOperation(expr, Token::SHR, 0)) {
DCHECK(TypeOf(expr->left()) == kAstI32); // TODO(titzer): this probably needs to be kToUint
DCHECK(TypeOf(expr->right()) == kAstI32); return (TypeOf(expr->left()) == kAstI32) ? kAsIs : kToInt;
return kAsIs;
} else { } else {
return kNone; return kNone;
} }
......
...@@ -23,6 +23,8 @@ function IntTest() { ...@@ -23,6 +23,8 @@ function IntTest() {
a = a|0; a = a|0;
b = b|0; b = b|0;
var c = (b + 1)|0 var c = (b + 1)|0
var d = 3.0;
var e = d | 0; // double conversion
return (a + c + 1)|0; 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