| 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/move-optimizer.h" | 5 #include "src/compiler/move-optimizer.h" |
| 6 | 6 |
| 7 namespace v8 { | 7 namespace v8 { |
| 8 namespace internal { | 8 namespace internal { |
| 9 namespace compiler { | 9 namespace compiler { |
| 10 | 10 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 // Elide moves made redundant by the instruction. | 138 // Elide moves made redundant by the instruction. |
| 139 for (MoveOperands* move : *moves) { | 139 for (MoveOperands* move : *moves) { |
| 140 if (outputs.find(move->destination()) != outputs.end() && | 140 if (outputs.find(move->destination()) != outputs.end() && |
| 141 inputs.find(move->destination()) == inputs.end()) { | 141 inputs.find(move->destination()) == inputs.end()) { |
| 142 move->Eliminate(); | 142 move->Eliminate(); |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 | 145 |
| 146 // The ret instruction makes any assignment before it unnecessary, except for | 146 // The ret instruction makes any assignment before it unnecessary, except for |
| 147 // the one for its input. | 147 // the one for its input. |
| 148 if (instruction->opcode() == ArchOpcode::kArchRet) { | 148 if (instruction->IsRet() || instruction->IsTailCall()) { |
| 149 for (MoveOperands* move : *moves) { | 149 for (MoveOperands* move : *moves) { |
| 150 if (inputs.find(move->destination()) == inputs.end()) { | 150 if (inputs.find(move->destination()) == inputs.end()) { |
| 151 move->Eliminate(); | 151 move->Eliminate(); |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 | 156 |
| 157 void MoveOptimizer::MigrateMoves(Instruction* to, Instruction* from) { | 157 void MoveOptimizer::MigrateMoves(Instruction* to, Instruction* from) { |
| 158 if (from->IsCall()) return; | 158 if (from->IsCall()) return; |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 static_cast<Instruction::GapPosition>(1), code_zone()); | 500 static_cast<Instruction::GapPosition>(1), code_zone()); |
| 501 slot_1->AddMove(group_begin->destination(), load->destination()); | 501 slot_1->AddMove(group_begin->destination(), load->destination()); |
| 502 load->Eliminate(); | 502 load->Eliminate(); |
| 503 } | 503 } |
| 504 loads.clear(); | 504 loads.clear(); |
| 505 } | 505 } |
| 506 | 506 |
| 507 } // namespace compiler | 507 } // namespace compiler |
| 508 } // namespace internal | 508 } // namespace internal |
| 509 } // namespace v8 | 509 } // namespace v8 |
| OLD | NEW |