Index: src/compiler/operation-typer.cc |
diff --git a/src/compiler/operation-typer.cc b/src/compiler/operation-typer.cc |
index dfd4c4b60477cad6b154fcbaeb123d472cc85235..75a73e1bb5a7210aae1a5b779d4500977343405e 100644 |
--- a/src/compiler/operation-typer.cc |
+++ b/src/compiler/operation-typer.cc |
@@ -625,13 +625,20 @@ Type* OperationTyper::NumberDivide(Type* lhs, Type* rhs) { |
} |
if (lhs->Is(Type::NaN()) || rhs->Is(Type::NaN())) return Type::NaN(); |
+ |
// Division is tricky, so all we do is try ruling out -0 and NaN. |
- bool maybe_minuszero = !lhs->Is(cache_.kPositiveIntegerOrNaN) || |
- !rhs->Is(cache_.kPositiveIntegerOrNaN); |
bool maybe_nan = |
lhs->Maybe(Type::NaN()) || rhs->Maybe(cache_.kZeroish) || |
((lhs->Min() == -V8_INFINITY || lhs->Max() == +V8_INFINITY) && |
(rhs->Min() == -V8_INFINITY || rhs->Max() == +V8_INFINITY)); |
+ lhs = Type::Intersect(lhs, Type::OrderedNumber(), zone()); |
+ rhs = Type::Intersect(rhs, Type::OrderedNumber(), zone()); |
+ |
+ // Try to rule out -0. |
+ bool maybe_minuszero = |
+ !lhs->Is(cache_.kInteger) || |
+ (lhs->Maybe(cache_.kZeroish) && rhs->Min() < 0.0) || |
+ (rhs->Min() == -V8_INFINITY || rhs->Max() == +V8_INFINITY); |
// Take into account the -0 and NaN information computed earlier. |
Type* type = Type::PlainNumber(); |