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

Unified Diff: src/compiler/typer.cc

Issue 2722483003: [turbofan] Introduce dedicated ObjectIsNaN operator. (Closed)
Patch Set: Created 3 years, 10 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
Index: src/compiler/typer.cc
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc
index b585336a3f52cb1ea04b552b6e08711f657afdf3..e50712762db210aa1e7f04e004f0a9df21bda576 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -285,6 +285,7 @@ class Typer::Visitor : public Reducer {
#undef DECLARE_METHOD
static Type* ObjectIsDetectableCallable(Type*, Typer*);
+ static Type* ObjectIsNaN(Type*, Typer*);
static Type* ObjectIsNonCallable(Type*, Typer*);
static Type* ObjectIsNumber(Type*, Typer*);
static Type* ObjectIsReceiver(Type*, Typer*);
@@ -512,6 +513,12 @@ Type* Typer::Visitor::ObjectIsDetectableCallable(Type* type, Typer* t) {
return Type::Boolean();
}
+Type* Typer::Visitor::ObjectIsNaN(Type* type, Typer* t) {
+ if (type->Is(Type::NaN())) return t->singleton_true_;
+ if (!type->Maybe(Type::NaN())) return t->singleton_false_;
+ return Type::Boolean();
+}
+
Type* Typer::Visitor::ObjectIsNonCallable(Type* type, Typer* t) {
if (type->Is(Type::NonCallable())) return t->singleton_true_;
if (!type->Maybe(Type::NonCallable())) return t->singleton_false_;
@@ -1926,6 +1933,10 @@ Type* Typer::Visitor::TypeObjectIsDetectableCallable(Node* node) {
return TypeUnaryOp(node, ObjectIsDetectableCallable);
}
+Type* Typer::Visitor::TypeObjectIsNaN(Node* node) {
+ return TypeUnaryOp(node, ObjectIsNaN);
+}
+
Type* Typer::Visitor::TypeObjectIsNonCallable(Node* node) {
return TypeUnaryOp(node, ObjectIsNonCallable);
}

Powered by Google App Engine
This is Rietveld 408576698