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/bits.h" | 5 #include "src/base/bits.h" |
6 #include "src/compiler/instruction-selector-impl.h" | 6 #include "src/compiler/instruction-selector-impl.h" |
7 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 outputs[output_count++] = g.DefineAsRegister(node); | 139 outputs[output_count++] = g.DefineAsRegister(node); |
140 if (cont->IsSet()) { | 140 if (cont->IsSet()) { |
141 outputs[output_count++] = g.DefineAsRegister(cont->result()); | 141 outputs[output_count++] = g.DefineAsRegister(cont->result()); |
142 } | 142 } |
143 | 143 |
144 DCHECK_NE(0, input_count); | 144 DCHECK_NE(0, input_count); |
145 DCHECK_NE(0, output_count); | 145 DCHECK_NE(0, output_count); |
146 DCHECK_GE(arraysize(inputs), input_count); | 146 DCHECK_GE(arraysize(inputs), input_count); |
147 DCHECK_GE(arraysize(outputs), output_count); | 147 DCHECK_GE(arraysize(outputs), output_count); |
148 | 148 |
149 Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, | 149 selector->Emit(cont->Encode(opcode), output_count, outputs, input_count, |
150 outputs, input_count, inputs); | 150 inputs); |
151 if (cont->IsBranch()) instr->MarkAsControl(); | |
152 } | 151 } |
153 | 152 |
154 | 153 |
155 static void VisitBinop(InstructionSelector* selector, Node* node, | 154 static void VisitBinop(InstructionSelector* selector, Node* node, |
156 InstructionCode opcode) { | 155 InstructionCode opcode) { |
157 FlagsContinuation cont; | 156 FlagsContinuation cont; |
158 VisitBinop(selector, node, opcode, &cont); | 157 VisitBinop(selector, node, opcode, &cont); |
159 } | 158 } |
160 | 159 |
161 | 160 |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 namespace { | 769 namespace { |
771 | 770 |
772 // Shared routine for multiple compare operations. | 771 // Shared routine for multiple compare operations. |
773 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, | 772 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, |
774 InstructionOperand* left, InstructionOperand* right, | 773 InstructionOperand* left, InstructionOperand* right, |
775 FlagsContinuation* cont) { | 774 FlagsContinuation* cont) { |
776 Mips64OperandGenerator g(selector); | 775 Mips64OperandGenerator g(selector); |
777 opcode = cont->Encode(opcode); | 776 opcode = cont->Encode(opcode); |
778 if (cont->IsBranch()) { | 777 if (cont->IsBranch()) { |
779 selector->Emit(opcode, NULL, left, right, g.Label(cont->true_block()), | 778 selector->Emit(opcode, NULL, left, right, g.Label(cont->true_block()), |
780 g.Label(cont->false_block()))->MarkAsControl(); | 779 g.Label(cont->false_block())); |
781 } else { | 780 } else { |
782 DCHECK(cont->IsSet()); | 781 DCHECK(cont->IsSet()); |
783 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); | 782 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); |
784 } | 783 } |
785 } | 784 } |
786 | 785 |
787 | 786 |
788 // Shared routine for multiple float compare operations. | 787 // Shared routine for multiple float compare operations. |
789 void VisitFloat64Compare(InstructionSelector* selector, Node* node, | 788 void VisitFloat64Compare(InstructionSelector* selector, Node* node, |
790 FlagsContinuation* cont) { | 789 FlagsContinuation* cont) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 } // namespace | 832 } // namespace |
834 | 833 |
835 | 834 |
836 void EmitWordCompareZero(InstructionSelector* selector, InstructionCode opcode, | 835 void EmitWordCompareZero(InstructionSelector* selector, InstructionCode opcode, |
837 Node* value, FlagsContinuation* cont) { | 836 Node* value, FlagsContinuation* cont) { |
838 Mips64OperandGenerator g(selector); | 837 Mips64OperandGenerator g(selector); |
839 opcode = cont->Encode(opcode); | 838 opcode = cont->Encode(opcode); |
840 InstructionOperand* const value_operand = g.UseRegister(value); | 839 InstructionOperand* const value_operand = g.UseRegister(value); |
841 if (cont->IsBranch()) { | 840 if (cont->IsBranch()) { |
842 selector->Emit(opcode, nullptr, value_operand, g.TempImmediate(0), | 841 selector->Emit(opcode, nullptr, value_operand, g.TempImmediate(0), |
843 g.Label(cont->true_block()), | 842 g.Label(cont->true_block()), g.Label(cont->false_block())); |
844 g.Label(cont->false_block()))->MarkAsControl(); | |
845 } else { | 843 } else { |
846 selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, | 844 selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, |
847 g.TempImmediate(0)); | 845 g.TempImmediate(0)); |
848 } | 846 } |
849 } | 847 } |
850 | 848 |
851 | 849 |
852 // Shared routine for word comparisons against zero. | 850 // Shared routine for word comparisons against zero. |
853 void VisitWordCompareZero(InstructionSelector* selector, Node* user, | 851 void VisitWordCompareZero(InstructionSelector* selector, Node* user, |
854 Node* value, FlagsContinuation* cont) { | 852 Node* value, FlagsContinuation* cont) { |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 | 1066 |
1069 // static | 1067 // static |
1070 MachineOperatorBuilder::Flags | 1068 MachineOperatorBuilder::Flags |
1071 InstructionSelector::SupportedMachineOperatorFlags() { | 1069 InstructionSelector::SupportedMachineOperatorFlags() { |
1072 return MachineOperatorBuilder::kNoFlags; | 1070 return MachineOperatorBuilder::kNoFlags; |
1073 } | 1071 } |
1074 | 1072 |
1075 } // namespace compiler | 1073 } // namespace compiler |
1076 } // namespace internal | 1074 } // namespace internal |
1077 } // namespace v8 | 1075 } // namespace v8 |
OLD | NEW |