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..aa8cc89520faae8ee1f79d09f6c110d13001fab7 100644 |
--- a/src/compiler/js-typed-lowering.cc |
+++ b/src/compiler/js-typed-lowering.cc |
@@ -459,8 +459,15 @@ 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)); |
+ } |
+ } |
+ 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. |
+ if (!r.left_type()->Maybe(r.right_type())) { |
+ return ReplaceEagerly(node, jsgraph()->BooleanConstant(invert)); |
} |
} |
if (r.OneInputIs(Type::Undefined())) { |