Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Unified Diff: src/compiler/operation-typer.cc

Issue 2739573004: [turbofan] Extend optimization of flooring integer division. (Closed)
Patch Set: Address offline feedback. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler/typed-optimization.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « no previous file | src/compiler/typed-optimization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698