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

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

Issue 2751513006: [turbofan] Fix typing for NumberMin and NumberMax to handle uninhabited types. (Closed)
Patch Set: 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 | test/mjsunit/compiler/regress-700883.js » ('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 75a73e1bb5a7210aae1a5b779d4500977343405e..73768dae733e70c9e4f2b5a81f698cb034edd62c 100644
--- a/src/compiler/operation-typer.cc
+++ b/src/compiler/operation-typer.cc
@@ -912,6 +912,9 @@ Type* OperationTyper::NumberImul(Type* lhs, Type* rhs) {
Type* OperationTyper::NumberMax(Type* lhs, Type* rhs) {
DCHECK(lhs->Is(Type::Number()));
DCHECK(rhs->Is(Type::Number()));
+ if (!lhs->IsInhabited() || !rhs->IsInhabited()) {
+ return Type::None();
+ }
if (lhs->Is(Type::NaN()) || rhs->Is(Type::NaN())) {
return Type::NaN();
}
@@ -935,6 +938,9 @@ Type* OperationTyper::NumberMax(Type* lhs, Type* rhs) {
Type* OperationTyper::NumberMin(Type* lhs, Type* rhs) {
DCHECK(lhs->Is(Type::Number()));
DCHECK(rhs->Is(Type::Number()));
+ if (!lhs->IsInhabited() || !rhs->IsInhabited()) {
+ return Type::None();
+ }
if (lhs->Is(Type::NaN()) || rhs->Is(Type::NaN())) {
return Type::NaN();
}
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-700883.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698