Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Unified Diff: src/compiler/js-typed-lowering.cc

Issue 722223003: Extend typed lowering to cover JSStrictEqual on differing types. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments and added unit test. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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())) {
« no previous file with comments | « no previous file | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698