Index: src/compiler/typer.cc |
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc |
index 2ac137641d54cab8605cb1ef47b713c46acc4257..946c6064a0979dbacb89b8f663eb140a969ba30a 100644 |
--- a/src/compiler/typer.cc |
+++ b/src/compiler/typer.cc |
@@ -247,6 +247,7 @@ class Typer::Visitor : public Reducer { |
static Type* NumberToInt32(Type*, Typer*); |
static Type* NumberToUint32(Type*, Typer*); |
+ static Type* ObjectIsCallable(Type*, Typer*); |
static Type* ObjectIsNumber(Type*, Typer*); |
static Type* ObjectIsReceiver(Type*, Typer*); |
static Type* ObjectIsSmi(Type*, Typer*); |
@@ -557,6 +558,11 @@ Type* Typer::Visitor::NumberToUint32(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_; |
+ return Type::Boolean(); |
+} |
Type* Typer::Visitor::ObjectIsNumber(Type* type, Typer* t) { |
if (type->Is(Type::Number())) return t->singleton_true_; |
@@ -1988,6 +1994,9 @@ Type* Typer::Visitor::TypeStoreElement(Node* node) { |
return nullptr; |
} |
+Type* Typer::Visitor::TypeObjectIsCallable(Node* node) { |
+ return TypeUnaryOp(node, ObjectIsCallable); |
+} |
Type* Typer::Visitor::TypeObjectIsNumber(Node* node) { |
return TypeUnaryOp(node, ObjectIsNumber); |