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.h" | 5 #include "src/compiler/instruction-selector.h" |
6 | 6 |
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-inl.h" | 9 #include "src/compiler/node-properties-inl.h" |
10 #include "src/compiler/pipeline.h" | 10 #include "src/compiler/pipeline.h" |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 return VisitGoto(block->SuccessorAt(0)); | 501 return VisitGoto(block->SuccessorAt(0)); |
502 case BasicBlock::kBranch: { | 502 case BasicBlock::kBranch: { |
503 DCHECK_EQ(IrOpcode::kBranch, input->opcode()); | 503 DCHECK_EQ(IrOpcode::kBranch, input->opcode()); |
504 BasicBlock* tbranch = block->SuccessorAt(0); | 504 BasicBlock* tbranch = block->SuccessorAt(0); |
505 BasicBlock* fbranch = block->SuccessorAt(1); | 505 BasicBlock* fbranch = block->SuccessorAt(1); |
506 // SSA deconstruction requires targets of branches not to have phis. | 506 // SSA deconstruction requires targets of branches not to have phis. |
507 // Edge split form guarantees this property, but is more strict. | 507 // Edge split form guarantees this property, but is more strict. |
508 CheckNoPhis(tbranch); | 508 CheckNoPhis(tbranch); |
509 CheckNoPhis(fbranch); | 509 CheckNoPhis(fbranch); |
510 if (tbranch == fbranch) return VisitGoto(tbranch); | 510 if (tbranch == fbranch) return VisitGoto(tbranch); |
| 511 // Treat special Branch(Always, IfTrue, IfFalse) as Goto(IfTrue). |
| 512 Node* const condition = input->InputAt(0); |
| 513 if (condition->opcode() == IrOpcode::kAlways) return VisitGoto(tbranch); |
511 return VisitBranch(input, tbranch, fbranch); | 514 return VisitBranch(input, tbranch, fbranch); |
512 } | 515 } |
513 case BasicBlock::kReturn: { | 516 case BasicBlock::kReturn: { |
514 // If the result itself is a return, return its input. | 517 // If the result itself is a return, return its input. |
515 Node* value = (input != NULL && input->opcode() == IrOpcode::kReturn) | 518 Node* value = (input != NULL && input->opcode() == IrOpcode::kReturn) |
516 ? input->InputAt(0) | 519 ? input->InputAt(0) |
517 : input; | 520 : input; |
518 return VisitReturn(value); | 521 return VisitReturn(value); |
519 } | 522 } |
520 case BasicBlock::kThrow: | 523 case BasicBlock::kThrow: |
(...skipping 13 matching lines...) Expand all Loading... |
534 MachineType InstructionSelector::GetMachineType(Node* node) { | 537 MachineType InstructionSelector::GetMachineType(Node* node) { |
535 DCHECK_NOT_NULL(schedule()->block(node)); // should only use scheduled nodes. | 538 DCHECK_NOT_NULL(schedule()->block(node)); // should only use scheduled nodes. |
536 switch (node->opcode()) { | 539 switch (node->opcode()) { |
537 case IrOpcode::kStart: | 540 case IrOpcode::kStart: |
538 case IrOpcode::kLoop: | 541 case IrOpcode::kLoop: |
539 case IrOpcode::kEnd: | 542 case IrOpcode::kEnd: |
540 case IrOpcode::kBranch: | 543 case IrOpcode::kBranch: |
541 case IrOpcode::kIfTrue: | 544 case IrOpcode::kIfTrue: |
542 case IrOpcode::kIfFalse: | 545 case IrOpcode::kIfFalse: |
543 case IrOpcode::kEffectPhi: | 546 case IrOpcode::kEffectPhi: |
| 547 case IrOpcode::kEffectSet: |
544 case IrOpcode::kMerge: | 548 case IrOpcode::kMerge: |
545 case IrOpcode::kTerminate: | |
546 // No code needed for these graph artifacts. | 549 // No code needed for these graph artifacts. |
547 return kMachNone; | 550 return kMachNone; |
548 case IrOpcode::kFinish: | 551 case IrOpcode::kFinish: |
549 return kMachAnyTagged; | 552 return kMachAnyTagged; |
550 case IrOpcode::kParameter: | 553 case IrOpcode::kParameter: |
551 return linkage()->GetParameterType(OpParameter<int>(node)); | 554 return linkage()->GetParameterType(OpParameter<int>(node)); |
552 case IrOpcode::kOsrValue: | 555 case IrOpcode::kOsrValue: |
553 return kMachAnyTagged; | 556 return kMachAnyTagged; |
554 case IrOpcode::kPhi: | 557 case IrOpcode::kPhi: |
555 return OpParameter<MachineType>(node); | 558 return OpParameter<MachineType>(node); |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 MachineOperatorBuilder::Flags | 1173 MachineOperatorBuilder::Flags |
1171 InstructionSelector::SupportedMachineOperatorFlags() { | 1174 InstructionSelector::SupportedMachineOperatorFlags() { |
1172 return MachineOperatorBuilder::Flag::kNoFlags; | 1175 return MachineOperatorBuilder::Flag::kNoFlags; |
1173 } | 1176 } |
1174 | 1177 |
1175 #endif // !V8_TURBOFAN_BACKEND | 1178 #endif // !V8_TURBOFAN_BACKEND |
1176 | 1179 |
1177 } // namespace compiler | 1180 } // namespace compiler |
1178 } // namespace internal | 1181 } // namespace internal |
1179 } // namespace v8 | 1182 } // namespace v8 |
OLD | NEW |