OLD | NEW |
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 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 r.CheckInputsToString(); | 986 r.CheckInputsToString(); |
987 return r.ChangeToPureOperator(simplified()->StringEqual(), invert); | 987 return r.ChangeToPureOperator(simplified()->StringEqual(), invert); |
988 } | 988 } |
989 return NoChange(); | 989 return NoChange(); |
990 } | 990 } |
991 | 991 |
992 Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) { | 992 Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) { |
993 JSBinopReduction r(this, node); | 993 JSBinopReduction r(this, node); |
994 if (r.left() == r.right()) { | 994 if (r.left() == r.right()) { |
995 // x === x is always true if x != NaN | 995 // x === x is always true if x != NaN |
996 if (!r.left_type()->Maybe(Type::NaN())) { | 996 Node* replacement = graph()->NewNode(simplified()->ObjectIsNaN(), r.left()); |
997 Node* replacement = jsgraph()->BooleanConstant(!invert); | 997 if (!invert) { |
998 ReplaceWithValue(node, replacement); | 998 replacement = graph()->NewNode(simplified()->BooleanNot(), replacement); |
999 return Replace(replacement); | |
1000 } | 999 } |
| 1000 ReplaceWithValue(node, replacement); |
| 1001 return Replace(replacement); |
1001 } | 1002 } |
1002 if (r.OneInputCannotBe(Type::NumberOrString())) { | 1003 if (r.OneInputCannotBe(Type::NumberOrString())) { |
1003 // For values with canonical representation (i.e. neither String, nor | 1004 // For values with canonical representation (i.e. neither String, nor |
1004 // Number) an empty type intersection means the values cannot be strictly | 1005 // Number) an empty type intersection means the values cannot be strictly |
1005 // equal. | 1006 // equal. |
1006 if (!r.left_type()->Maybe(r.right_type())) { | 1007 if (!r.left_type()->Maybe(r.right_type())) { |
1007 Node* replacement = jsgraph()->BooleanConstant(invert); | 1008 Node* replacement = jsgraph()->BooleanConstant(invert); |
1008 ReplaceWithValue(node, replacement); | 1009 ReplaceWithValue(node, replacement); |
1009 return Replace(replacement); | 1010 return Replace(replacement); |
1010 } | 1011 } |
(...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2490 } | 2491 } |
2491 | 2492 |
2492 | 2493 |
2493 CompilationDependencies* JSTypedLowering::dependencies() const { | 2494 CompilationDependencies* JSTypedLowering::dependencies() const { |
2494 return dependencies_; | 2495 return dependencies_; |
2495 } | 2496 } |
2496 | 2497 |
2497 } // namespace compiler | 2498 } // namespace compiler |
2498 } // namespace internal | 2499 } // namespace internal |
2499 } // namespace v8 | 2500 } // namespace v8 |
OLD | NEW |