Chromium Code Reviews| Index: src/compiler/instruction-selector.cc |
| diff --git a/src/compiler/instruction-selector.cc b/src/compiler/instruction-selector.cc |
| index bd3bfd73c9a7969a9dca3412945bb486d507b27d..157509310ba844c974dbe1aa8b35f96f7f79f1e0 100644 |
| --- a/src/compiler/instruction-selector.cc |
| +++ b/src/compiler/instruction-selector.cc |
| @@ -853,8 +853,17 @@ void InstructionSelector::VisitParameter(Node* node) { |
| void InstructionSelector::VisitPhi(Node* node) { |
| // TODO(bmeurer): Emit a PhiInstruction here. |
|
Benedikt Meurer
2014/10/19 18:13:03
Remove this TODO.
|
| - for (InputIter i = node->inputs().begin(); i != node->inputs().end(); ++i) { |
| - MarkAsUsed(*i); |
| + PhiInstruction* phi = new (instruction_zone()) |
| + PhiInstruction(instruction_zone(), sequence()->GetVirtualRegister(node)); |
| + sequence()->InstructionBlockAt(current_block_->GetRpoNumber())->AddPhi(phi); |
| + Node::Inputs inputs = node->inputs(); |
| + size_t j = 0; |
| + for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end(); |
|
Benedikt Meurer
2014/10/19 18:13:03
How about this instead?
const int input_count = n
|
| + ++iter, ++j) { |
| + MarkAsUsed(*iter); |
| + // TODO(mstarzinger): Use a ValueInputIterator instead. |
| + if (j >= current_block_->PredecessorCount()) continue; |
| + phi->operands().push_back(sequence()->GetVirtualRegister(*iter)); |
| } |
| } |