[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}
This commit is contained in:
titzer 2016-01-12 05:45:35 -08:00 committed by Commit bot
parent d672ee30c9
commit ed6fea15a9
2 changed files with 5 additions and 6 deletions

View File

@ -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;
}

View File

@ -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;
}