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/instruction-selector-impl.h" | 5 #include "src/compiler/instruction-selector-impl.h" |
6 #include "src/compiler/node-matchers.h" | 6 #include "src/compiler/node-matchers.h" |
7 #include "src/compiler/node-properties-inl.h" | 7 #include "src/compiler/node-properties-inl.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 frame_state_descriptor = | 727 frame_state_descriptor = |
728 GetFrameStateDescriptor(node->InputAt(descriptor->InputCount())); | 728 GetFrameStateDescriptor(node->InputAt(descriptor->InputCount())); |
729 } | 729 } |
730 | 730 |
731 CallBuffer buffer(zone(), descriptor, frame_state_descriptor); | 731 CallBuffer buffer(zone(), descriptor, frame_state_descriptor); |
732 | 732 |
733 // Compute InstructionOperands for inputs and outputs. | 733 // Compute InstructionOperands for inputs and outputs. |
734 InitializeCallBuffer(node, &buffer, true, true); | 734 InitializeCallBuffer(node, &buffer, true, true); |
735 | 735 |
736 // Push any stack arguments. | 736 // Push any stack arguments. |
737 for (NodeVectorRIter input = buffer.pushed_nodes.rbegin(); | 737 for (auto i = buffer.pushed_nodes.rbegin(); i != buffer.pushed_nodes.rend(); |
738 input != buffer.pushed_nodes.rend(); input++) { | 738 ++i) { |
739 // TODO(titzer): handle pushing double parameters. | 739 // TODO(titzer): handle pushing double parameters. |
740 Emit(kIA32Push, NULL, | 740 Emit(kIA32Push, nullptr, |
741 g.CanBeImmediate(*input) ? g.UseImmediate(*input) : g.Use(*input)); | 741 g.CanBeImmediate(*i) ? g.UseImmediate(*i) : g.Use(*i)); |
742 } | 742 } |
743 | 743 |
744 // Select the appropriate opcode based on the call type. | 744 // Select the appropriate opcode based on the call type. |
745 InstructionCode opcode; | 745 InstructionCode opcode; |
746 switch (descriptor->kind()) { | 746 switch (descriptor->kind()) { |
747 case CallDescriptor::kCallCodeObject: { | 747 case CallDescriptor::kCallCodeObject: { |
748 opcode = kArchCallCodeObject; | 748 opcode = kArchCallCodeObject; |
749 break; | 749 break; |
750 } | 750 } |
751 case CallDescriptor::kCallJSFunction: | 751 case CallDescriptor::kCallJSFunction: |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 return VisitFloat64Compare(selector, value, cont); | 870 return VisitFloat64Compare(selector, value, cont); |
871 case IrOpcode::kFloat64LessThan: | 871 case IrOpcode::kFloat64LessThan: |
872 cont->OverwriteAndNegateIfEqual(kUnsignedGreaterThan); | 872 cont->OverwriteAndNegateIfEqual(kUnsignedGreaterThan); |
873 return VisitFloat64Compare(selector, value, cont); | 873 return VisitFloat64Compare(selector, value, cont); |
874 case IrOpcode::kFloat64LessThanOrEqual: | 874 case IrOpcode::kFloat64LessThanOrEqual: |
875 cont->OverwriteAndNegateIfEqual(kUnsignedGreaterThanOrEqual); | 875 cont->OverwriteAndNegateIfEqual(kUnsignedGreaterThanOrEqual); |
876 return VisitFloat64Compare(selector, value, cont); | 876 return VisitFloat64Compare(selector, value, cont); |
877 case IrOpcode::kProjection: | 877 case IrOpcode::kProjection: |
878 // Check if this is the overflow output projection of an | 878 // Check if this is the overflow output projection of an |
879 // <Operation>WithOverflow node. | 879 // <Operation>WithOverflow node. |
880 if (OpParameter<size_t>(value) == 1u) { | 880 if (ProjectionIndexOf(value->op()) == 1u) { |
881 // We cannot combine the <Operation>WithOverflow with this branch | 881 // We cannot combine the <Operation>WithOverflow with this branch |
882 // unless the 0th projection (the use of the actual value of the | 882 // unless the 0th projection (the use of the actual value of the |
883 // <Operation> is either NULL, which means there's no use of the | 883 // <Operation> is either NULL, which means there's no use of the |
884 // actual value, or was already defined, which means it is scheduled | 884 // actual value, or was already defined, which means it is scheduled |
885 // *AFTER* this branch). | 885 // *AFTER* this branch). |
886 Node* node = value->InputAt(0); | 886 Node* const node = value->InputAt(0); |
887 Node* result = node->FindProjection(0); | 887 Node* const result = NodeProperties::FindProjection(node, 0); |
888 if (result == NULL || selector->IsDefined(result)) { | 888 if (result == NULL || selector->IsDefined(result)) { |
889 switch (node->opcode()) { | 889 switch (node->opcode()) { |
890 case IrOpcode::kInt32AddWithOverflow: | 890 case IrOpcode::kInt32AddWithOverflow: |
891 cont->OverwriteAndNegateIfEqual(kOverflow); | 891 cont->OverwriteAndNegateIfEqual(kOverflow); |
892 return VisitBinop(selector, node, kIA32Add, cont); | 892 return VisitBinop(selector, node, kIA32Add, cont); |
893 case IrOpcode::kInt32SubWithOverflow: | 893 case IrOpcode::kInt32SubWithOverflow: |
894 cont->OverwriteAndNegateIfEqual(kOverflow); | 894 cont->OverwriteAndNegateIfEqual(kOverflow); |
895 return VisitBinop(selector, node, kIA32Sub, cont); | 895 return VisitBinop(selector, node, kIA32Sub, cont); |
896 default: | 896 default: |
897 break; | 897 break; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 } | 952 } |
953 | 953 |
954 | 954 |
955 void InstructionSelector::VisitUint32LessThanOrEqual(Node* node) { | 955 void InstructionSelector::VisitUint32LessThanOrEqual(Node* node) { |
956 FlagsContinuation cont(kUnsignedLessThanOrEqual, node); | 956 FlagsContinuation cont(kUnsignedLessThanOrEqual, node); |
957 VisitWordCompare(this, node, &cont); | 957 VisitWordCompare(this, node, &cont); |
958 } | 958 } |
959 | 959 |
960 | 960 |
961 void InstructionSelector::VisitInt32AddWithOverflow(Node* node) { | 961 void InstructionSelector::VisitInt32AddWithOverflow(Node* node) { |
962 if (Node* ovf = node->FindProjection(1)) { | 962 if (Node* ovf = NodeProperties::FindProjection(node, 1)) { |
963 FlagsContinuation cont(kOverflow, ovf); | 963 FlagsContinuation cont(kOverflow, ovf); |
964 return VisitBinop(this, node, kIA32Add, &cont); | 964 return VisitBinop(this, node, kIA32Add, &cont); |
965 } | 965 } |
966 FlagsContinuation cont; | 966 FlagsContinuation cont; |
967 VisitBinop(this, node, kIA32Add, &cont); | 967 VisitBinop(this, node, kIA32Add, &cont); |
968 } | 968 } |
969 | 969 |
970 | 970 |
971 void InstructionSelector::VisitInt32SubWithOverflow(Node* node) { | 971 void InstructionSelector::VisitInt32SubWithOverflow(Node* node) { |
972 if (Node* ovf = node->FindProjection(1)) { | 972 if (Node* ovf = NodeProperties::FindProjection(node, 1)) { |
973 FlagsContinuation cont(kOverflow, ovf); | 973 FlagsContinuation cont(kOverflow, ovf); |
974 return VisitBinop(this, node, kIA32Sub, &cont); | 974 return VisitBinop(this, node, kIA32Sub, &cont); |
975 } | 975 } |
976 FlagsContinuation cont; | 976 FlagsContinuation cont; |
977 VisitBinop(this, node, kIA32Sub, &cont); | 977 VisitBinop(this, node, kIA32Sub, &cont); |
978 } | 978 } |
979 | 979 |
980 | 980 |
981 void InstructionSelector::VisitFloat64Equal(Node* node) { | 981 void InstructionSelector::VisitFloat64Equal(Node* node) { |
982 FlagsContinuation cont(kUnorderedEqual, node); | 982 FlagsContinuation cont(kUnorderedEqual, node); |
(...skipping 21 matching lines...) Expand all Loading... |
1004 MachineOperatorBuilder::kFloat64Ceil | | 1004 MachineOperatorBuilder::kFloat64Ceil | |
1005 MachineOperatorBuilder::kFloat64RoundTruncate | | 1005 MachineOperatorBuilder::kFloat64RoundTruncate | |
1006 MachineOperatorBuilder::kWord32ShiftIsSafe; | 1006 MachineOperatorBuilder::kWord32ShiftIsSafe; |
1007 } | 1007 } |
1008 return MachineOperatorBuilder::Flag::kNoFlags; | 1008 return MachineOperatorBuilder::Flag::kNoFlags; |
1009 } | 1009 } |
1010 | 1010 |
1011 } // namespace compiler | 1011 } // namespace compiler |
1012 } // namespace internal | 1012 } // namespace internal |
1013 } // namespace v8 | 1013 } // namespace v8 |
OLD | NEW |