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

Side by Side Diff: src/compiler/js-typed-lowering.cc

Issue 2722483003: [turbofan] Introduce dedicated ObjectIsNaN operator. (Closed)
Patch Set: Created 3 years, 9 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/js-typed-lowering.h" 5 #include "src/compiler/js-typed-lowering.h"
6 6
7 #include "src/ast/modules.h" 7 #include "src/ast/modules.h"
8 #include "src/builtins/builtins-utils.h" 8 #include "src/builtins/builtins-utils.h"
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/compilation-dependencies.h" 10 #include "src/compilation-dependencies.h"
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 r.CheckInputsToString(); 981 r.CheckInputsToString();
982 return r.ChangeToPureOperator(simplified()->StringEqual(), invert); 982 return r.ChangeToPureOperator(simplified()->StringEqual(), invert);
983 } 983 }
984 return NoChange(); 984 return NoChange();
985 } 985 }
986 986
987 Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) { 987 Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) {
988 JSBinopReduction r(this, node); 988 JSBinopReduction r(this, node);
989 if (r.left() == r.right()) { 989 if (r.left() == r.right()) {
990 // x === x is always true if x != NaN 990 // x === x is always true if x != NaN
991 if (!r.left_type()->Maybe(Type::NaN())) { 991 Node* replacement = graph()->NewNode(simplified()->ObjectIsNaN(), r.left());
992 Node* replacement = jsgraph()->BooleanConstant(!invert); 992 if (!invert) {
993 ReplaceWithValue(node, replacement); 993 replacement = graph()->NewNode(simplified()->BooleanNot(), replacement);
994 return Replace(replacement);
995 } 994 }
995 ReplaceWithValue(node, replacement);
996 return Replace(replacement);
996 } 997 }
997 if (r.OneInputCannotBe(Type::NumberOrString())) { 998 if (r.OneInputCannotBe(Type::NumberOrString())) {
998 // For values with canonical representation (i.e. neither String, nor 999 // For values with canonical representation (i.e. neither String, nor
999 // Number) an empty type intersection means the values cannot be strictly 1000 // Number) an empty type intersection means the values cannot be strictly
1000 // equal. 1001 // equal.
1001 if (!r.left_type()->Maybe(r.right_type())) { 1002 if (!r.left_type()->Maybe(r.right_type())) {
1002 Node* replacement = jsgraph()->BooleanConstant(invert); 1003 Node* replacement = jsgraph()->BooleanConstant(invert);
1003 ReplaceWithValue(node, replacement); 1004 ReplaceWithValue(node, replacement);
1004 return Replace(replacement); 1005 return Replace(replacement);
1005 } 1006 }
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
2482 } 2483 }
2483 2484
2484 2485
2485 CompilationDependencies* JSTypedLowering::dependencies() const { 2486 CompilationDependencies* JSTypedLowering::dependencies() const {
2486 return dependencies_; 2487 return dependencies_;
2487 } 2488 }
2488 2489
2489 } // namespace compiler 2490 } // namespace compiler
2490 } // namespace internal 2491 } // namespace internal
2491 } // namespace v8 2492 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698