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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 if (cont->IsSet()) { | 231 if (cont->IsSet()) { |
232 outputs[output_count++] = g.DefineAsRegister(cont->result()); | 232 outputs[output_count++] = g.DefineAsRegister(cont->result()); |
233 } | 233 } |
234 | 234 |
235 DCHECK_NE(0, input_count); | 235 DCHECK_NE(0, input_count); |
236 DCHECK_NE(0, output_count); | 236 DCHECK_NE(0, output_count); |
237 DCHECK_GE(arraysize(inputs), input_count); | 237 DCHECK_GE(arraysize(inputs), input_count); |
238 DCHECK_GE(arraysize(outputs), output_count); | 238 DCHECK_GE(arraysize(outputs), output_count); |
239 DCHECK_NE(kMode_None, AddressingModeField::decode(opcode)); | 239 DCHECK_NE(kMode_None, AddressingModeField::decode(opcode)); |
240 | 240 |
241 selector->Emit(cont->Encode(opcode), output_count, outputs, input_count, | 241 Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, |
242 inputs); | 242 outputs, input_count, inputs); |
| 243 if (cont->IsBranch()) instr->MarkAsControl(); |
243 } | 244 } |
244 | 245 |
245 | 246 |
246 void VisitBinop(InstructionSelector* selector, Node* node, | 247 void VisitBinop(InstructionSelector* selector, Node* node, |
247 InstructionCode opcode, InstructionCode reverse_opcode) { | 248 InstructionCode opcode, InstructionCode reverse_opcode) { |
248 FlagsContinuation cont; | 249 FlagsContinuation cont; |
249 VisitBinop(selector, node, opcode, reverse_opcode, &cont); | 250 VisitBinop(selector, node, opcode, reverse_opcode, &cont); |
250 } | 251 } |
251 | 252 |
252 | 253 |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 if (cont->IsSet()) { | 571 if (cont->IsSet()) { |
571 outputs[output_count++] = g.DefineAsRegister(cont->result()); | 572 outputs[output_count++] = g.DefineAsRegister(cont->result()); |
572 } | 573 } |
573 | 574 |
574 DCHECK_NE(0, input_count); | 575 DCHECK_NE(0, input_count); |
575 DCHECK_NE(0, output_count); | 576 DCHECK_NE(0, output_count); |
576 DCHECK_GE(arraysize(inputs), input_count); | 577 DCHECK_GE(arraysize(inputs), input_count); |
577 DCHECK_GE(arraysize(outputs), output_count); | 578 DCHECK_GE(arraysize(outputs), output_count); |
578 DCHECK_NE(kMode_None, AddressingModeField::decode(opcode)); | 579 DCHECK_NE(kMode_None, AddressingModeField::decode(opcode)); |
579 | 580 |
580 selector->Emit(cont->Encode(opcode), output_count, outputs, input_count, | 581 Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, |
581 inputs); | 582 outputs, input_count, inputs); |
| 583 if (cont->IsBranch()) instr->MarkAsControl(); |
582 } | 584 } |
583 | 585 |
584 | 586 |
585 template <typename TryMatchShift> | 587 template <typename TryMatchShift> |
586 static inline void VisitShift(InstructionSelector* selector, Node* node, | 588 static inline void VisitShift(InstructionSelector* selector, Node* node, |
587 TryMatchShift try_match_shift) { | 589 TryMatchShift try_match_shift) { |
588 FlagsContinuation cont; | 590 FlagsContinuation cont; |
589 VisitShift(selector, node, try_match_shift, &cont); | 591 VisitShift(selector, node, try_match_shift, &cont); |
590 } | 592 } |
591 | 593 |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 | 1070 |
1069 // Shared routine for multiple float compare operations. | 1071 // Shared routine for multiple float compare operations. |
1070 void VisitFloat64Compare(InstructionSelector* selector, Node* node, | 1072 void VisitFloat64Compare(InstructionSelector* selector, Node* node, |
1071 FlagsContinuation* cont) { | 1073 FlagsContinuation* cont) { |
1072 ArmOperandGenerator g(selector); | 1074 ArmOperandGenerator g(selector); |
1073 Float64BinopMatcher m(node); | 1075 Float64BinopMatcher m(node); |
1074 if (cont->IsBranch()) { | 1076 if (cont->IsBranch()) { |
1075 selector->Emit(cont->Encode(kArmVcmpF64), nullptr, | 1077 selector->Emit(cont->Encode(kArmVcmpF64), nullptr, |
1076 g.UseRegister(m.left().node()), | 1078 g.UseRegister(m.left().node()), |
1077 g.UseRegister(m.right().node()), g.Label(cont->true_block()), | 1079 g.UseRegister(m.right().node()), g.Label(cont->true_block()), |
1078 g.Label(cont->false_block())); | 1080 g.Label(cont->false_block()))->MarkAsControl(); |
1079 } else { | 1081 } else { |
1080 DCHECK(cont->IsSet()); | 1082 DCHECK(cont->IsSet()); |
1081 selector->Emit( | 1083 selector->Emit( |
1082 cont->Encode(kArmVcmpF64), g.DefineAsRegister(cont->result()), | 1084 cont->Encode(kArmVcmpF64), g.DefineAsRegister(cont->result()), |
1083 g.UseRegister(m.left().node()), g.UseRegister(m.right().node())); | 1085 g.UseRegister(m.left().node()), g.UseRegister(m.right().node())); |
1084 } | 1086 } |
1085 } | 1087 } |
1086 | 1088 |
1087 | 1089 |
1088 // Shared routine for multiple word compare operations. | 1090 // Shared routine for multiple word compare operations. |
(...skipping 26 matching lines...) Expand all Loading... |
1115 inputs[input_count++] = g.Label(cont->false_block()); | 1117 inputs[input_count++] = g.Label(cont->false_block()); |
1116 } else { | 1118 } else { |
1117 DCHECK(cont->IsSet()); | 1119 DCHECK(cont->IsSet()); |
1118 outputs[output_count++] = g.DefineAsRegister(cont->result()); | 1120 outputs[output_count++] = g.DefineAsRegister(cont->result()); |
1119 } | 1121 } |
1120 | 1122 |
1121 DCHECK_NE(0, input_count); | 1123 DCHECK_NE(0, input_count); |
1122 DCHECK_GE(arraysize(inputs), input_count); | 1124 DCHECK_GE(arraysize(inputs), input_count); |
1123 DCHECK_GE(arraysize(outputs), output_count); | 1125 DCHECK_GE(arraysize(outputs), output_count); |
1124 | 1126 |
1125 selector->Emit(cont->Encode(opcode), output_count, outputs, input_count, | 1127 Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, |
1126 inputs); | 1128 outputs, input_count, inputs); |
| 1129 if (cont->IsBranch()) instr->MarkAsControl(); |
1127 } | 1130 } |
1128 | 1131 |
1129 | 1132 |
1130 void VisitWordCompare(InstructionSelector* selector, Node* node, | 1133 void VisitWordCompare(InstructionSelector* selector, Node* node, |
1131 FlagsContinuation* cont) { | 1134 FlagsContinuation* cont) { |
1132 VisitWordCompare(selector, node, kArmCmp, cont); | 1135 VisitWordCompare(selector, node, kArmCmp, cont); |
1133 } | 1136 } |
1134 | 1137 |
1135 | 1138 |
1136 // Shared routine for word comparisons against zero. | 1139 // Shared routine for word comparisons against zero. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 break; | 1224 break; |
1222 } | 1225 } |
1223 | 1226 |
1224 // Continuation could not be combined with a compare, emit compare against 0. | 1227 // Continuation could not be combined with a compare, emit compare against 0. |
1225 ArmOperandGenerator g(selector); | 1228 ArmOperandGenerator g(selector); |
1226 InstructionCode const opcode = | 1229 InstructionCode const opcode = |
1227 cont->Encode(kArmTst) | AddressingModeField::encode(kMode_Operand2_R); | 1230 cont->Encode(kArmTst) | AddressingModeField::encode(kMode_Operand2_R); |
1228 InstructionOperand* const value_operand = g.UseRegister(value); | 1231 InstructionOperand* const value_operand = g.UseRegister(value); |
1229 if (cont->IsBranch()) { | 1232 if (cont->IsBranch()) { |
1230 selector->Emit(opcode, nullptr, value_operand, value_operand, | 1233 selector->Emit(opcode, nullptr, value_operand, value_operand, |
1231 g.Label(cont->true_block()), g.Label(cont->false_block())); | 1234 g.Label(cont->true_block()), |
| 1235 g.Label(cont->false_block()))->MarkAsControl(); |
1232 } else { | 1236 } else { |
1233 selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, | 1237 selector->Emit(opcode, g.DefineAsRegister(cont->result()), value_operand, |
1234 value_operand); | 1238 value_operand); |
1235 } | 1239 } |
1236 } | 1240 } |
1237 | 1241 |
1238 } // namespace | 1242 } // namespace |
1239 | 1243 |
1240 | 1244 |
1241 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, | 1245 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 MachineOperatorBuilder::kFloat64Ceil | | 1333 MachineOperatorBuilder::kFloat64Ceil | |
1330 MachineOperatorBuilder::kFloat64RoundTruncate | | 1334 MachineOperatorBuilder::kFloat64RoundTruncate | |
1331 MachineOperatorBuilder::kFloat64RoundTiesAway; | 1335 MachineOperatorBuilder::kFloat64RoundTiesAway; |
1332 } | 1336 } |
1333 return flags; | 1337 return flags; |
1334 } | 1338 } |
1335 | 1339 |
1336 } // namespace compiler | 1340 } // namespace compiler |
1337 } // namespace internal | 1341 } // namespace internal |
1338 } // namespace v8 | 1342 } // namespace v8 |
OLD | NEW |