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