| 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/graph.h" | 7 #include "src/compiler/graph.h" |
| 8 #include "src/compiler/instruction-selector-impl.h" | 8 #include "src/compiler/instruction-selector-impl.h" |
| 9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
| 10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
| (...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 void InstructionSelector::VisitParameter(Node* node) { | 918 void InstructionSelector::VisitParameter(Node* node) { |
| 919 OperandGenerator g(this); | 919 OperandGenerator g(this); |
| 920 int index = OpParameter<int>(node); | 920 int index = OpParameter<int>(node); |
| 921 Emit(kArchNop, | 921 Emit(kArchNop, |
| 922 g.DefineAsLocation(node, linkage()->GetParameterLocation(index), | 922 g.DefineAsLocation(node, linkage()->GetParameterLocation(index), |
| 923 linkage()->GetParameterType(index))); | 923 linkage()->GetParameterType(index))); |
| 924 } | 924 } |
| 925 | 925 |
| 926 | 926 |
| 927 void InstructionSelector::VisitPhi(Node* node) { | 927 void InstructionSelector::VisitPhi(Node* node) { |
| 928 // TODO(bmeurer): Emit a PhiInstruction here. | 928 const int input_count = node->op()->ValueInputCount(); |
| 929 PhiInstruction* phi = new (instruction_zone()) | 929 PhiInstruction* phi = new (instruction_zone()) |
| 930 PhiInstruction(instruction_zone(), GetVirtualRegister(node)); | 930 PhiInstruction(instruction_zone(), GetVirtualRegister(node), |
| 931 static_cast<size_t>(input_count)); |
| 931 sequence()->InstructionBlockAt(current_block_->GetRpoNumber())->AddPhi(phi); | 932 sequence()->InstructionBlockAt(current_block_->GetRpoNumber())->AddPhi(phi); |
| 932 const int input_count = node->op()->ValueInputCount(); | |
| 933 phi->operands().reserve(static_cast<size_t>(input_count)); | |
| 934 for (int i = 0; i < input_count; ++i) { | 933 for (int i = 0; i < input_count; ++i) { |
| 935 Node* const input = node->InputAt(i); | 934 Node* const input = node->InputAt(i); |
| 936 MarkAsUsed(input); | 935 MarkAsUsed(input); |
| 937 phi->operands().push_back(GetVirtualRegister(input)); | 936 phi->Extend(instruction_zone(), GetVirtualRegister(input)); |
| 938 } | 937 } |
| 939 } | 938 } |
| 940 | 939 |
| 941 | 940 |
| 942 void InstructionSelector::VisitProjection(Node* node) { | 941 void InstructionSelector::VisitProjection(Node* node) { |
| 943 OperandGenerator g(this); | 942 OperandGenerator g(this); |
| 944 Node* value = node->InputAt(0); | 943 Node* value = node->InputAt(0); |
| 945 switch (value->opcode()) { | 944 switch (value->opcode()) { |
| 946 case IrOpcode::kInt32AddWithOverflow: | 945 case IrOpcode::kInt32AddWithOverflow: |
| 947 case IrOpcode::kInt32SubWithOverflow: | 946 case IrOpcode::kInt32SubWithOverflow: |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 MachineOperatorBuilder::Flags | 1113 MachineOperatorBuilder::Flags |
| 1115 InstructionSelector::SupportedMachineOperatorFlags() { | 1114 InstructionSelector::SupportedMachineOperatorFlags() { |
| 1116 return MachineOperatorBuilder::Flag::kNoFlags; | 1115 return MachineOperatorBuilder::Flag::kNoFlags; |
| 1117 } | 1116 } |
| 1118 | 1117 |
| 1119 #endif // !V8_TURBOFAN_BACKEND | 1118 #endif // !V8_TURBOFAN_BACKEND |
| 1120 | 1119 |
| 1121 } // namespace compiler | 1120 } // namespace compiler |
| 1122 } // namespace internal | 1121 } // namespace internal |
| 1123 } // namespace v8 | 1122 } // namespace v8 |
| OLD | NEW |