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/simplified-lowering.h" | 5 #include "src/compiler/simplified-lowering.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/address-map.h" | 9 #include "src/address-map.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 void ResetOutput(Node* node, MachineRepresentation representation, | 665 void ResetOutput(Node* node, MachineRepresentation representation, |
666 TypeCheckKind type_check = TypeCheckKind::kNone) { | 666 TypeCheckKind type_check = TypeCheckKind::kNone) { |
667 NodeInfo* info = GetInfo(node); | 667 NodeInfo* info = GetInfo(node); |
668 info->set_output(representation); | 668 info->set_output(representation); |
669 info->set_type_check(type_check); | 669 info->set_type_check(type_check); |
670 } | 670 } |
671 | 671 |
672 Type* GetUpperBound(Node* node) { return NodeProperties::GetType(node); } | 672 Type* GetUpperBound(Node* node) { return NodeProperties::GetType(node); } |
673 | 673 |
674 bool InputIs(Node* node, Type* type) { | 674 bool InputIs(Node* node, Type* type) { |
675 DCHECK_EQ(1, node->InputCount()); | 675 DCHECK_EQ(1, node->op()->ValueInputCount()); |
676 return GetUpperBound(node->InputAt(0))->Is(type); | 676 return GetUpperBound(node->InputAt(0))->Is(type); |
677 } | 677 } |
678 | 678 |
679 bool BothInputsAreSigned32(Node* node) { | 679 bool BothInputsAreSigned32(Node* node) { |
680 return BothInputsAre(node, Type::Signed32()); | 680 return BothInputsAre(node, Type::Signed32()); |
681 } | 681 } |
682 | 682 |
683 bool BothInputsAreUnsigned32(Node* node) { | 683 bool BothInputsAreUnsigned32(Node* node) { |
684 return BothInputsAre(node, Type::Unsigned32()); | 684 return BothInputsAre(node, Type::Unsigned32()); |
685 } | 685 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 } | 765 } |
766 | 766 |
767 // Helper for binops of the I x I -> O variety. | 767 // Helper for binops of the I x I -> O variety. |
768 void VisitBinop(Node* node, UseInfo input_use, MachineRepresentation output, | 768 void VisitBinop(Node* node, UseInfo input_use, MachineRepresentation output, |
769 TypeCheckKind type_check = TypeCheckKind::kNone) { | 769 TypeCheckKind type_check = TypeCheckKind::kNone) { |
770 VisitBinop(node, input_use, input_use, output, type_check); | 770 VisitBinop(node, input_use, input_use, output, type_check); |
771 } | 771 } |
772 | 772 |
773 // Helper for unops of the I -> O variety. | 773 // Helper for unops of the I -> O variety. |
774 void VisitUnop(Node* node, UseInfo input_use, MachineRepresentation output) { | 774 void VisitUnop(Node* node, UseInfo input_use, MachineRepresentation output) { |
775 DCHECK_EQ(1, node->InputCount()); | 775 DCHECK_EQ(1, node->op()->ValueInputCount()); |
776 ProcessInput(node, 0, input_use); | 776 ProcessInput(node, 0, input_use); |
| 777 ProcessRemainingInputs(node, 1); |
777 SetOutput(node, output); | 778 SetOutput(node, output); |
778 } | 779 } |
779 | 780 |
780 // Helper for leaf nodes. | 781 // Helper for leaf nodes. |
781 void VisitLeaf(Node* node, MachineRepresentation output) { | 782 void VisitLeaf(Node* node, MachineRepresentation output) { |
782 DCHECK_EQ(0, node->InputCount()); | 783 DCHECK_EQ(0, node->InputCount()); |
783 SetOutput(node, output); | 784 SetOutput(node, output); |
784 } | 785 } |
785 | 786 |
786 // Helpers for specific types of binops. | 787 // Helpers for specific types of binops. |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1662 NodeProperties::ChangeOp(node, jsgraph_->common()->Call(desc)); | 1663 NodeProperties::ChangeOp(node, jsgraph_->common()->Call(desc)); |
1663 } | 1664 } |
1664 return; | 1665 return; |
1665 } | 1666 } |
1666 | 1667 |
1667 case IrOpcode::kCheckBounds: { | 1668 case IrOpcode::kCheckBounds: { |
1668 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(), | 1669 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(), |
1669 UseInfo::TruncatingWord32(), MachineRepresentation::kWord32); | 1670 UseInfo::TruncatingWord32(), MachineRepresentation::kWord32); |
1670 return; | 1671 return; |
1671 } | 1672 } |
| 1673 case IrOpcode::kCheckTaggedPointer: { |
| 1674 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged); |
| 1675 if (lower()) { |
| 1676 if (InputIs(node, Type::TaggedPointer())) { |
| 1677 DeferReplacement(node, node->InputAt(0)); |
| 1678 } |
| 1679 } |
| 1680 return; |
| 1681 } |
| 1682 case IrOpcode::kCheckTaggedSigned: { |
| 1683 if (SmiValuesAre32Bits() && truncation.TruncatesToWord32()) { |
| 1684 // TODO(jarin,bmeurer): Add CheckedSignedSmallAsWord32? |
| 1685 VisitUnop(node, UseInfo::CheckedSigned32AsWord32(), |
| 1686 MachineRepresentation::kWord32); |
| 1687 DeferReplacement(node, node->InputAt(0)); |
| 1688 } else { |
| 1689 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged); |
| 1690 if (lower()) { |
| 1691 if (InputIs(node, Type::TaggedSigned())) { |
| 1692 DeferReplacement(node, node->InputAt(0)); |
| 1693 } |
| 1694 } |
| 1695 } |
| 1696 return; |
| 1697 } |
1672 | 1698 |
1673 case IrOpcode::kAllocate: { | 1699 case IrOpcode::kAllocate: { |
1674 ProcessInput(node, 0, UseInfo::TruncatingWord32()); | 1700 ProcessInput(node, 0, UseInfo::TruncatingWord32()); |
1675 ProcessRemainingInputs(node, 1); | 1701 ProcessRemainingInputs(node, 1); |
1676 SetOutput(node, MachineRepresentation::kTagged); | 1702 SetOutput(node, MachineRepresentation::kTagged); |
1677 return; | 1703 return; |
1678 } | 1704 } |
1679 case IrOpcode::kLoadField: { | 1705 case IrOpcode::kLoadField: { |
1680 FieldAccess access = FieldAccessOf(node->op()); | 1706 FieldAccess access = FieldAccessOf(node->op()); |
1681 ProcessInput(node, 0, UseInfoForBasePointer(access)); | 1707 ProcessInput(node, 0, UseInfoForBasePointer(access)); |
(...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3028 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3054 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
3029 Operator::kNoProperties); | 3055 Operator::kNoProperties); |
3030 to_number_operator_.set(common()->Call(desc)); | 3056 to_number_operator_.set(common()->Call(desc)); |
3031 } | 3057 } |
3032 return to_number_operator_.get(); | 3058 return to_number_operator_.get(); |
3033 } | 3059 } |
3034 | 3060 |
3035 } // namespace compiler | 3061 } // namespace compiler |
3036 } // namespace internal | 3062 } // namespace internal |
3037 } // namespace v8 | 3063 } // namespace v8 |
OLD | NEW |