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/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/compiler/access-builder.h" | 6 #include "src/compiler/access-builder.h" |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/js-typed-lowering.h" | 8 #include "src/compiler/js-typed-lowering.h" |
9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 Reduction JSTypedLowering::ReduceJSEqual(Node* node, bool invert) { | 589 Reduction JSTypedLowering::ReduceJSEqual(Node* node, bool invert) { |
590 JSBinopReduction r(this, node); | 590 JSBinopReduction r(this, node); |
591 | 591 |
592 if (r.BothInputsAre(Type::Number())) { | 592 if (r.BothInputsAre(Type::Number())) { |
593 return r.ChangeToPureOperator(simplified()->NumberEqual(), invert); | 593 return r.ChangeToPureOperator(simplified()->NumberEqual(), invert); |
594 } | 594 } |
595 if (r.BothInputsAre(Type::String())) { | 595 if (r.BothInputsAre(Type::String())) { |
596 return r.ChangeToStringComparisonOperator(simplified()->StringEqual(), | 596 return r.ChangeToStringComparisonOperator(simplified()->StringEqual(), |
597 invert); | 597 invert); |
598 } | 598 } |
| 599 if (r.BothInputsAre(Type::Boolean())) { |
| 600 return r.ChangeToPureOperator(simplified()->ReferenceEqual(Type::Boolean()), |
| 601 invert); |
| 602 } |
599 if (r.BothInputsAre(Type::Receiver())) { | 603 if (r.BothInputsAre(Type::Receiver())) { |
600 return r.ChangeToPureOperator( | 604 return r.ChangeToPureOperator( |
601 simplified()->ReferenceEqual(Type::Receiver()), invert); | 605 simplified()->ReferenceEqual(Type::Receiver()), invert); |
602 } | 606 } |
603 // TODO(turbofan): js-typed-lowering of Equal(undefined) | 607 // TODO(turbofan): js-typed-lowering of Equal(undefined) |
604 // TODO(turbofan): js-typed-lowering of Equal(null) | 608 // TODO(turbofan): js-typed-lowering of Equal(null) |
605 // TODO(turbofan): js-typed-lowering of Equal(boolean) | |
606 return NoChange(); | 609 return NoChange(); |
607 } | 610 } |
608 | 611 |
609 | 612 |
610 Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) { | 613 Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) { |
611 JSBinopReduction r(this, node); | 614 JSBinopReduction r(this, node); |
612 if (r.left() == r.right()) { | 615 if (r.left() == r.right()) { |
613 // x === x is always true if x != NaN | 616 // x === x is always true if x != NaN |
614 if (!r.left_type()->Maybe(Type::NaN())) { | 617 if (!r.left_type()->Maybe(Type::NaN())) { |
615 Node* replacement = jsgraph()->BooleanConstant(!invert); | 618 Node* replacement = jsgraph()->BooleanConstant(!invert); |
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1917 } | 1920 } |
1918 | 1921 |
1919 | 1922 |
1920 MachineOperatorBuilder* JSTypedLowering::machine() const { | 1923 MachineOperatorBuilder* JSTypedLowering::machine() const { |
1921 return jsgraph()->machine(); | 1924 return jsgraph()->machine(); |
1922 } | 1925 } |
1923 | 1926 |
1924 } // namespace compiler | 1927 } // namespace compiler |
1925 } // namespace internal | 1928 } // namespace internal |
1926 } // namespace v8 | 1929 } // namespace v8 |
OLD | NEW |