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.h" | 9 #include "src/compiler/node-properties.h" |
10 #include "src/compiler/pipeline.h" | 10 #include "src/compiler/pipeline.h" |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
496 } | 496 } |
497 | 497 |
498 } // namespace | 498 } // namespace |
499 | 499 |
500 | 500 |
501 void InstructionSelector::VisitControl(BasicBlock* block) { | 501 void InstructionSelector::VisitControl(BasicBlock* block) { |
502 Node* input = block->control_input(); | 502 Node* input = block->control_input(); |
503 switch (block->control()) { | 503 switch (block->control()) { |
504 case BasicBlock::kGoto: | 504 case BasicBlock::kGoto: |
505 return VisitGoto(block->SuccessorAt(0)); | 505 return VisitGoto(block->SuccessorAt(0)); |
506 case BasicBlock::kCall: { | |
507 DCHECK_EQ(IrOpcode::kCall, input->opcode()); | |
508 BasicBlock* success = block->SuccessorAt(0); | |
509 BasicBlock* exception = block->SuccessorAt(1); | |
510 // SSA deconstruction requires targets of branches not to have phis. | |
511 // Edge split form guarantees this property, but is more strict. | |
512 CheckNoPhis(success); | |
titzer
2015/02/17 10:32:52
We could probably CheckNoPhis for all blocks if Su
Michael Starzinger
2015/02/17 10:58:29
Done. Also inlined the CheckNoPhis helper as per o
| |
513 CheckNoPhis(exception); | |
514 // TODO(mstarzinger): Record location of {exception} in {handler_table}. | |
515 return VisitCall(input), VisitGoto(success); | |
516 } | |
506 case BasicBlock::kBranch: { | 517 case BasicBlock::kBranch: { |
507 DCHECK_EQ(IrOpcode::kBranch, input->opcode()); | 518 DCHECK_EQ(IrOpcode::kBranch, input->opcode()); |
508 BasicBlock* tbranch = block->SuccessorAt(0); | 519 BasicBlock* tbranch = block->SuccessorAt(0); |
509 BasicBlock* fbranch = block->SuccessorAt(1); | 520 BasicBlock* fbranch = block->SuccessorAt(1); |
510 // SSA deconstruction requires targets of branches not to have phis. | 521 // SSA deconstruction requires targets of branches not to have phis. |
511 // Edge split form guarantees this property, but is more strict. | 522 // Edge split form guarantees this property, but is more strict. |
512 CheckNoPhis(tbranch); | 523 CheckNoPhis(tbranch); |
513 CheckNoPhis(fbranch); | 524 CheckNoPhis(fbranch); |
514 if (tbranch == fbranch) return VisitGoto(tbranch); | 525 if (tbranch == fbranch) return VisitGoto(tbranch); |
515 // Treat special Branch(Always, IfTrue, IfFalse) as Goto(IfTrue). | 526 // Treat special Branch(Always, IfTrue, IfFalse) as Goto(IfTrue). |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
693 Emit(SourcePositionInstruction::New(instruction_zone(), source_position)); | 704 Emit(SourcePositionInstruction::New(instruction_zone(), source_position)); |
694 } | 705 } |
695 } | 706 } |
696 switch (node->opcode()) { | 707 switch (node->opcode()) { |
697 case IrOpcode::kStart: | 708 case IrOpcode::kStart: |
698 case IrOpcode::kLoop: | 709 case IrOpcode::kLoop: |
699 case IrOpcode::kEnd: | 710 case IrOpcode::kEnd: |
700 case IrOpcode::kBranch: | 711 case IrOpcode::kBranch: |
701 case IrOpcode::kIfTrue: | 712 case IrOpcode::kIfTrue: |
702 case IrOpcode::kIfFalse: | 713 case IrOpcode::kIfFalse: |
714 case IrOpcode::kIfException: | |
715 case IrOpcode::kIfSuccess: | |
703 case IrOpcode::kSwitch: | 716 case IrOpcode::kSwitch: |
704 case IrOpcode::kCase: | 717 case IrOpcode::kCase: |
705 case IrOpcode::kEffectPhi: | 718 case IrOpcode::kEffectPhi: |
706 case IrOpcode::kMerge: | 719 case IrOpcode::kMerge: |
707 // No code needed for these graph artifacts. | 720 // No code needed for these graph artifacts. |
708 return; | 721 return; |
709 case IrOpcode::kFinish: | 722 case IrOpcode::kFinish: |
710 return MarkAsReference(node), VisitFinish(node); | 723 return MarkAsReference(node), VisitFinish(node); |
711 case IrOpcode::kParameter: { | 724 case IrOpcode::kParameter: { |
712 MachineType type = linkage()->GetParameterType(OpParameter<int>(node)); | 725 MachineType type = linkage()->GetParameterType(OpParameter<int>(node)); |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1212 MachineOperatorBuilder::Flags | 1225 MachineOperatorBuilder::Flags |
1213 InstructionSelector::SupportedMachineOperatorFlags() { | 1226 InstructionSelector::SupportedMachineOperatorFlags() { |
1214 return MachineOperatorBuilder::Flag::kNoFlags; | 1227 return MachineOperatorBuilder::Flag::kNoFlags; |
1215 } | 1228 } |
1216 | 1229 |
1217 #endif // !V8_TURBOFAN_BACKEND | 1230 #endif // !V8_TURBOFAN_BACKEND |
1218 | 1231 |
1219 } // namespace compiler | 1232 } // namespace compiler |
1220 } // namespace internal | 1233 } // namespace internal |
1221 } // namespace v8 | 1234 } // namespace v8 |
OLD | NEW |