[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:
parent
d672ee30c9
commit
ed6fea15a9
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user