Index: src/compiler/js-typed-lowering.cc |
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc |
index 178a0628f3bb8b567fcd4bcf9821aeb4ebbabb68..8864582590a190c734e9369f485a139842b15301 100644 |
--- a/src/compiler/js-typed-lowering.cc |
+++ b/src/compiler/js-typed-lowering.cc |
@@ -459,8 +459,7 @@ Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) { |
if (r.left() == r.right()) { |
// x === x is always true if x != NaN |
if (!r.left_type()->Maybe(Type::NaN())) { |
- return ReplaceEagerly(node, invert ? jsgraph()->FalseConstant() |
- : jsgraph()->TrueConstant()); |
+ return ReplaceEagerly(node, jsgraph()->BooleanConstant(!invert)); |
} |
} |
if (r.OneInputIs(Type::Undefined())) { |
@@ -489,6 +488,15 @@ Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) { |
if (r.BothInputsAre(Type::Number())) { |
return r.ChangeToPureOperator(simplified()->NumberEqual(), invert); |
} |
+ Type* string_or_number = Type::Union(Type::String(), Type::Number(), zone()); |
+ if (r.OneInputCannotBe(string_or_number)) { |
+ // For values with canonical representation (i.e. not string nor number) an |
+ // empty type intersection means the values cannot be strictly equal. |
+ Type* intersect = Type::Intersect(r.left_type(), r.right_type(), zone()); |
rossberg
2014/11/14 13:41:42
That's what left_type->Maybe(right_type) is for. ;
titzer
2014/11/14 13:43:24
I like Maybe, I just want it to be reliable....
/u
Michael Starzinger
2014/11/14 14:03:06
Done.
|
+ if (!intersect->IsInhabited()) { |
+ return ReplaceEagerly(node, jsgraph()->BooleanConstant(invert)); |
+ } |
+ } |
// TODO(turbofan): js-typed-lowering of StrictEqual(mixed types) |
return NoChange(); |
} |