Index: src/compiler/typer.cc |
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc |
index 515622e1b80645fbd55905e5c5895f8e284708bd..2ac137641d54cab8605cb1ef47b713c46acc4257 100644 |
--- a/src/compiler/typer.cc |
+++ b/src/compiler/typer.cc |
@@ -250,6 +250,7 @@ class Typer::Visitor : public Reducer { |
static Type* ObjectIsNumber(Type*, Typer*); |
static Type* ObjectIsReceiver(Type*, Typer*); |
static Type* ObjectIsSmi(Type*, Typer*); |
+ static Type* ObjectIsString(Type*, Typer*); |
static Type* ObjectIsUndetectable(Type*, Typer*); |
static Type* JSAddRanger(RangeType*, RangeType*, Typer*); |
@@ -577,6 +578,11 @@ Type* Typer::Visitor::ObjectIsSmi(Type* type, Typer* t) { |
return Type::Boolean(); |
} |
+Type* Typer::Visitor::ObjectIsString(Type* type, Typer* t) { |
+ if (type->Is(Type::String())) return t->singleton_true_; |
+ if (!type->Maybe(Type::String())) return t->singleton_false_; |
+ return Type::Boolean(); |
+} |
Type* Typer::Visitor::ObjectIsUndetectable(Type* type, Typer* t) { |
if (type->Is(Type::Undetectable())) return t->singleton_true_; |
@@ -1997,6 +2003,9 @@ Type* Typer::Visitor::TypeObjectIsSmi(Node* node) { |
return TypeUnaryOp(node, ObjectIsSmi); |
} |
+Type* Typer::Visitor::TypeObjectIsString(Node* node) { |
+ return TypeUnaryOp(node, ObjectIsString); |
+} |
Type* Typer::Visitor::TypeObjectIsUndetectable(Node* node) { |
return TypeUnaryOp(node, ObjectIsUndetectable); |