| 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 <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "src/base/adapters.h" | 9 #include "src/base/adapters.h" |
| 10 #include "src/compiler/instruction-selector-impl.h" | 10 #include "src/compiler/instruction-selector-impl.h" |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 } | 467 } |
| 468 case BasicBlock::kTailCall: { | 468 case BasicBlock::kTailCall: { |
| 469 DCHECK_EQ(IrOpcode::kTailCall, input->opcode()); | 469 DCHECK_EQ(IrOpcode::kTailCall, input->opcode()); |
| 470 return VisitTailCall(input); | 470 return VisitTailCall(input); |
| 471 } | 471 } |
| 472 case BasicBlock::kBranch: { | 472 case BasicBlock::kBranch: { |
| 473 DCHECK_EQ(IrOpcode::kBranch, input->opcode()); | 473 DCHECK_EQ(IrOpcode::kBranch, input->opcode()); |
| 474 BasicBlock* tbranch = block->SuccessorAt(0); | 474 BasicBlock* tbranch = block->SuccessorAt(0); |
| 475 BasicBlock* fbranch = block->SuccessorAt(1); | 475 BasicBlock* fbranch = block->SuccessorAt(1); |
| 476 if (tbranch == fbranch) return VisitGoto(tbranch); | 476 if (tbranch == fbranch) return VisitGoto(tbranch); |
| 477 // Treat special Branch(Always, IfTrue, IfFalse) as Goto(IfTrue). | |
| 478 Node* const condition = input->InputAt(0); | |
| 479 if (condition->opcode() == IrOpcode::kAlways) return VisitGoto(tbranch); | |
| 480 return VisitBranch(input, tbranch, fbranch); | 477 return VisitBranch(input, tbranch, fbranch); |
| 481 } | 478 } |
| 482 case BasicBlock::kSwitch: { | 479 case BasicBlock::kSwitch: { |
| 483 DCHECK_EQ(IrOpcode::kSwitch, input->opcode()); | 480 DCHECK_EQ(IrOpcode::kSwitch, input->opcode()); |
| 484 SwitchInfo sw; | 481 SwitchInfo sw; |
| 485 // Last successor must be Default. | 482 // Last successor must be Default. |
| 486 sw.default_branch = block->successors().back(); | 483 sw.default_branch = block->successors().back(); |
| 487 DCHECK_EQ(IrOpcode::kIfDefault, sw.default_branch->front()->opcode()); | 484 DCHECK_EQ(IrOpcode::kIfDefault, sw.default_branch->front()->opcode()); |
| 488 // All other successors must be cases. | 485 // All other successors must be cases. |
| 489 sw.case_count = block->SuccessorCount() - 1; | 486 sw.case_count = block->SuccessorCount() - 1; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 case IrOpcode::kEnd: | 540 case IrOpcode::kEnd: |
| 544 case IrOpcode::kBranch: | 541 case IrOpcode::kBranch: |
| 545 case IrOpcode::kIfTrue: | 542 case IrOpcode::kIfTrue: |
| 546 case IrOpcode::kIfFalse: | 543 case IrOpcode::kIfFalse: |
| 547 case IrOpcode::kIfSuccess: | 544 case IrOpcode::kIfSuccess: |
| 548 case IrOpcode::kSwitch: | 545 case IrOpcode::kSwitch: |
| 549 case IrOpcode::kIfValue: | 546 case IrOpcode::kIfValue: |
| 550 case IrOpcode::kIfDefault: | 547 case IrOpcode::kIfDefault: |
| 551 case IrOpcode::kEffectPhi: | 548 case IrOpcode::kEffectPhi: |
| 552 case IrOpcode::kMerge: | 549 case IrOpcode::kMerge: |
| 550 case IrOpcode::kTerminate: |
| 553 // No code needed for these graph artifacts. | 551 // No code needed for these graph artifacts. |
| 554 return; | 552 return; |
| 555 case IrOpcode::kIfException: | 553 case IrOpcode::kIfException: |
| 556 return MarkAsReference(node), VisitIfException(node); | 554 return MarkAsReference(node), VisitIfException(node); |
| 557 case IrOpcode::kFinish: | 555 case IrOpcode::kFinish: |
| 558 return MarkAsReference(node), VisitFinish(node); | 556 return MarkAsReference(node), VisitFinish(node); |
| 559 case IrOpcode::kParameter: { | 557 case IrOpcode::kParameter: { |
| 560 MachineType type = | 558 MachineType type = |
| 561 linkage()->GetParameterType(ParameterIndexOf(node->op())); | 559 linkage()->GetParameterType(ParameterIndexOf(node->op())); |
| 562 MarkAsRepresentation(type, node); | 560 MarkAsRepresentation(type, node); |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 MachineOperatorBuilder::Flags | 1144 MachineOperatorBuilder::Flags |
| 1147 InstructionSelector::SupportedMachineOperatorFlags() { | 1145 InstructionSelector::SupportedMachineOperatorFlags() { |
| 1148 return MachineOperatorBuilder::Flag::kNoFlags; | 1146 return MachineOperatorBuilder::Flag::kNoFlags; |
| 1149 } | 1147 } |
| 1150 | 1148 |
| 1151 #endif // !V8_TURBOFAN_BACKEND | 1149 #endif // !V8_TURBOFAN_BACKEND |
| 1152 | 1150 |
| 1153 } // namespace compiler | 1151 } // namespace compiler |
| 1154 } // namespace internal | 1152 } // namespace internal |
| 1155 } // namespace v8 | 1153 } // namespace v8 |
| OLD | NEW |