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

Unified Diff: src/compiler/typer.cc

Issue 2646763003: [turbofan] Optimize typeof o === "object" checks. (Closed)
Patch Set: Address comment. Created 3 years, 11 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 | « src/compiler/simplified-operator.cc ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/typer.cc
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc
index c08e62cd3ac4e765b41aae0880c627dc1067ac4e..0802c3aebacf587f14bf33758316f5347b4bf933 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -284,6 +284,7 @@ class Typer::Visitor : public Reducer {
#undef DECLARE_METHOD
static Type* ObjectIsCallable(Type*, Typer*);
+ static Type* ObjectIsNonCallable(Type*, Typer*);
static Type* ObjectIsNumber(Type*, Typer*);
static Type* ObjectIsReceiver(Type*, Typer*);
static Type* ObjectIsSmi(Type*, Typer*);
@@ -502,8 +503,14 @@ Type* Typer::Visitor::ToString(Type* type, Typer* t) {
// Type checks.
Type* Typer::Visitor::ObjectIsCallable(Type* type, Typer* t) {
- if (type->Is(Type::Function())) return t->singleton_true_;
- if (type->Is(Type::Primitive())) return t->singleton_false_;
+ if (type->Is(Type::Callable())) return t->singleton_true_;
bakkot1 2017/01/23 19:26:16 Drive-by comment: document.all is "callable", in t
Benedikt Meurer 2017/02/14 10:18:24 Aye, sorry for the delay, just discovered this com
+ if (!type->Maybe(Type::Callable())) 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_;
return Type::Boolean();
}
@@ -1828,6 +1835,10 @@ Type* Typer::Visitor::TypeObjectIsCallable(Node* node) {
return TypeUnaryOp(node, ObjectIsCallable);
}
+Type* Typer::Visitor::TypeObjectIsNonCallable(Node* node) {
+ return TypeUnaryOp(node, ObjectIsNonCallable);
+}
+
Type* Typer::Visitor::TypeObjectIsNumber(Node* node) {
return TypeUnaryOp(node, ObjectIsNumber);
}
« no previous file with comments | « src/compiler/simplified-operator.cc ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698