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