Index: src/compiler/typer.cc |
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc |
index 04e0b5af62e5271624e52d06cbd238b9277d57f1..47b5fe412c93bfc488767898860d9520f25576c0 100644 |
--- a/src/compiler/typer.cc |
+++ b/src/compiler/typer.cc |
@@ -827,6 +827,25 @@ Type* Typer::Visitor::JSStrictEqualTyper(Type* lhs, Type* rhs, Typer* t) { |
return Type::Boolean(); |
} |
+Type* Typer::Visitor::JSSameValueZeroTyper(Type* lhs, Type* rhs, Typer* t) { |
+ if (!JSType(lhs)->Maybe(JSType(rhs))) return t->singleton_false_; |
+ if (lhs->Is(Type::NaN()) || rhs->Is(Type::NaN())) return t->singleton_true_; |
+ if (lhs->Is(Type::Number()) && rhs->Is(Type::Number()) && |
+ (lhs->Max() < rhs->Min() || lhs->Min() > rhs->Max())) { |
+ return t->singleton_false_; |
+ } |
+ if ((lhs->Is(t->singleton_the_hole_) || rhs->Is(t->singleton_the_hole_)) && |
+ !lhs->Maybe(rhs)) { |
+ return t->singleton_false_; |
+ } |
+ if (lhs->IsConstant() && rhs->Is(lhs)) { |
+ // Types are equal and are inhabited only by a single semantic value, |
+ // which is not nan due to the earlier check. |
+ return t->singleton_true_; |
+ } |
+ return Type::Boolean(); |
+} |
+ |
Type* Typer::Visitor::JSStrictNotEqualTyper(Type* lhs, Type* rhs, Typer* t) { |
return Invert(JSStrictEqualTyper(lhs, rhs, t), t); |