| 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 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 OperandGenerator g(this); | 846 OperandGenerator g(this); |
| 847 int index = OpParameter<int>(node); | 847 int index = OpParameter<int>(node); |
| 848 Emit(kArchNop, | 848 Emit(kArchNop, |
| 849 g.DefineAsLocation(node, linkage()->GetParameterLocation(index), | 849 g.DefineAsLocation(node, linkage()->GetParameterLocation(index), |
| 850 linkage()->GetParameterType(index))); | 850 linkage()->GetParameterType(index))); |
| 851 } | 851 } |
| 852 | 852 |
| 853 | 853 |
| 854 void InstructionSelector::VisitPhi(Node* node) { | 854 void InstructionSelector::VisitPhi(Node* node) { |
| 855 // TODO(bmeurer): Emit a PhiInstruction here. | 855 // TODO(bmeurer): Emit a PhiInstruction here. |
| 856 for (InputIter i = node->inputs().begin(); i != node->inputs().end(); ++i) { | 856 PhiInstruction* phi = new (instruction_zone()) |
| 857 MarkAsUsed(*i); | 857 PhiInstruction(instruction_zone(), sequence()->GetVirtualRegister(node)); |
| 858 sequence()->InstructionBlockAt(current_block_->GetRpoNumber())->AddPhi(phi); |
| 859 Node::Inputs inputs = node->inputs(); |
| 860 size_t j = 0; |
| 861 for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end(); |
| 862 ++iter, ++j) { |
| 863 MarkAsUsed(*iter); |
| 864 // TODO(mstarzinger): Use a ValueInputIterator instead. |
| 865 if (j >= current_block_->PredecessorCount()) continue; |
| 866 phi->operands().push_back(sequence()->GetVirtualRegister(*iter)); |
| 858 } | 867 } |
| 859 } | 868 } |
| 860 | 869 |
| 861 | 870 |
| 862 void InstructionSelector::VisitProjection(Node* node) { | 871 void InstructionSelector::VisitProjection(Node* node) { |
| 863 OperandGenerator g(this); | 872 OperandGenerator g(this); |
| 864 Node* value = node->InputAt(0); | 873 Node* value = node->InputAt(0); |
| 865 switch (value->opcode()) { | 874 switch (value->opcode()) { |
| 866 case IrOpcode::kInt32AddWithOverflow: | 875 case IrOpcode::kInt32AddWithOverflow: |
| 867 case IrOpcode::kInt32SubWithOverflow: | 876 case IrOpcode::kInt32SubWithOverflow: |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, | 1033 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, |
| 1025 BasicBlock* fbranch) { | 1034 BasicBlock* fbranch) { |
| 1026 UNIMPLEMENTED(); | 1035 UNIMPLEMENTED(); |
| 1027 } | 1036 } |
| 1028 | 1037 |
| 1029 #endif // !V8_TURBOFAN_BACKEND | 1038 #endif // !V8_TURBOFAN_BACKEND |
| 1030 | 1039 |
| 1031 } // namespace compiler | 1040 } // namespace compiler |
| 1032 } // namespace internal | 1041 } // namespace internal |
| 1033 } // namespace v8 | 1042 } // namespace v8 |
| OLD | NEW |