| 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/base/adapters.h" | 5 #include "src/base/adapters.h" |
| 6 #include "src/base/bits.h" | 6 #include "src/base/bits.h" |
| 7 #include "src/compiler/instruction-selector-impl.h" | 7 #include "src/compiler/instruction-selector-impl.h" |
| 8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
| 9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
| 10 | 10 |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, | 768 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, |
| 769 InstructionOperand left, InstructionOperand right, | 769 InstructionOperand left, InstructionOperand right, |
| 770 FlagsContinuation* cont) { | 770 FlagsContinuation* cont) { |
| 771 MipsOperandGenerator g(selector); | 771 MipsOperandGenerator g(selector); |
| 772 opcode = cont->Encode(opcode); | 772 opcode = cont->Encode(opcode); |
| 773 if (cont->IsBranch()) { | 773 if (cont->IsBranch()) { |
| 774 selector->Emit(opcode, g.NoOutput(), left, right, | 774 selector->Emit(opcode, g.NoOutput(), left, right, |
| 775 g.Label(cont->true_block()), g.Label(cont->false_block())); | 775 g.Label(cont->true_block()), g.Label(cont->false_block())); |
| 776 } else { | 776 } else { |
| 777 DCHECK(cont->IsSet()); | 777 DCHECK(cont->IsSet()); |
| 778 // TODO(plind): Revisit and test this path. | |
| 779 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); | 778 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); |
| 780 } | 779 } |
| 781 } | 780 } |
| 782 | 781 |
| 783 | 782 |
| 784 // Shared routine for multiple float32 compare operations. | 783 // Shared routine for multiple float32 compare operations. |
| 785 void VisitFloat32Compare(InstructionSelector* selector, Node* node, | 784 void VisitFloat32Compare(InstructionSelector* selector, Node* node, |
| 786 FlagsContinuation* cont) { | 785 FlagsContinuation* cont) { |
| 787 MipsOperandGenerator g(selector); | 786 MipsOperandGenerator g(selector); |
| 788 Node* left = node->InputAt(0); | 787 Node* left = node->InputAt(0); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 806 // Shared routine for multiple word compare operations. | 805 // Shared routine for multiple word compare operations. |
| 807 void VisitWordCompare(InstructionSelector* selector, Node* node, | 806 void VisitWordCompare(InstructionSelector* selector, Node* node, |
| 808 InstructionCode opcode, FlagsContinuation* cont, | 807 InstructionCode opcode, FlagsContinuation* cont, |
| 809 bool commutative) { | 808 bool commutative) { |
| 810 MipsOperandGenerator g(selector); | 809 MipsOperandGenerator g(selector); |
| 811 Node* left = node->InputAt(0); | 810 Node* left = node->InputAt(0); |
| 812 Node* right = node->InputAt(1); | 811 Node* right = node->InputAt(1); |
| 813 | 812 |
| 814 // Match immediates on left or right side of comparison. | 813 // Match immediates on left or right side of comparison. |
| 815 if (g.CanBeImmediate(right, opcode)) { | 814 if (g.CanBeImmediate(right, opcode)) { |
| 816 VisitCompare(selector, opcode, g.UseRegister(left), g.UseImmediate(right), | 815 switch (cont->condition()) { |
| 817 cont); | 816 case kSignedLessThan: |
| 817 case kSignedGreaterThanOrEqual: |
| 818 case kUnsignedLessThan: |
| 819 case kUnsignedGreaterThanOrEqual: |
| 820 VisitCompare(selector, opcode, g.UseRegister(left), |
| 821 g.UseImmediate(right), cont); |
| 822 break; |
| 823 default: |
| 824 VisitCompare(selector, opcode, g.UseRegister(left), |
| 825 g.UseRegister(right), cont); |
| 826 } |
| 818 } else if (g.CanBeImmediate(left, opcode)) { | 827 } else if (g.CanBeImmediate(left, opcode)) { |
| 819 if (!commutative) cont->Commute(); | 828 if (!commutative) cont->Commute(); |
| 820 VisitCompare(selector, opcode, g.UseRegister(right), g.UseImmediate(left), | 829 switch (cont->condition()) { |
| 821 cont); | 830 case kSignedLessThan: |
| 831 case kSignedGreaterThanOrEqual: |
| 832 case kUnsignedLessThan: |
| 833 case kUnsignedGreaterThanOrEqual: |
| 834 VisitCompare(selector, opcode, g.UseRegister(right), |
| 835 g.UseImmediate(left), cont); |
| 836 break; |
| 837 default: |
| 838 VisitCompare(selector, opcode, g.UseRegister(right), |
| 839 g.UseRegister(left), cont); |
| 840 } |
| 822 } else { | 841 } else { |
| 823 VisitCompare(selector, opcode, g.UseRegister(left), g.UseRegister(right), | 842 VisitCompare(selector, opcode, g.UseRegister(left), g.UseRegister(right), |
| 824 cont); | 843 cont); |
| 825 } | 844 } |
| 826 } | 845 } |
| 827 | 846 |
| 828 | 847 |
| 829 void VisitWordCompare(InstructionSelector* selector, Node* node, | 848 void VisitWordCompare(InstructionSelector* selector, Node* node, |
| 830 FlagsContinuation* cont) { | 849 FlagsContinuation* cont) { |
| 831 VisitWordCompare(selector, node, kMipsCmp, cont, false); | 850 VisitWordCompare(selector, node, kMipsCmp, cont, false); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 IsFp64Mode()) { | 1113 IsFp64Mode()) { |
| 1095 flags |= MachineOperatorBuilder::kFloat64RoundDown | | 1114 flags |= MachineOperatorBuilder::kFloat64RoundDown | |
| 1096 MachineOperatorBuilder::kFloat64RoundTruncate; | 1115 MachineOperatorBuilder::kFloat64RoundTruncate; |
| 1097 } | 1116 } |
| 1098 return flags; | 1117 return flags; |
| 1099 } | 1118 } |
| 1100 | 1119 |
| 1101 } // namespace compiler | 1120 } // namespace compiler |
| 1102 } // namespace internal | 1121 } // namespace internal |
| 1103 } // namespace v8 | 1122 } // namespace v8 |
| OLD | NEW |