| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 | 77 |
| 78 static MoveOperands* PrepareInsertAfter(ParallelMove* left, MoveOperands* move, | 78 static MoveOperands* PrepareInsertAfter(ParallelMove* left, MoveOperands* move, |
| 79 Zone* zone) { | 79 Zone* zone) { |
| 80 auto move_ops = left->move_operands(); | 80 auto move_ops = left->move_operands(); |
| 81 MoveOperands* replacement = nullptr; | 81 MoveOperands* replacement = nullptr; |
| 82 MoveOperands* to_eliminate = nullptr; | 82 MoveOperands* to_eliminate = nullptr; |
| 83 for (auto curr = move_ops->begin(); curr != move_ops->end(); ++curr) { | 83 for (auto curr = move_ops->begin(); curr != move_ops->end(); ++curr) { |
| 84 if (curr->IsEliminated()) continue; | 84 if (curr->IsEliminated()) continue; |
| 85 if (curr->destination()->Equals(move->source())) { | 85 if (curr->destination()->Equals(move->source())) { |
| 86 DCHECK_EQ(nullptr, replacement); | 86 DCHECK(!replacement); |
| 87 replacement = curr; | 87 replacement = curr; |
| 88 if (to_eliminate != nullptr) break; | 88 if (to_eliminate != nullptr) break; |
| 89 } else if (curr->destination()->Equals(move->destination())) { | 89 } else if (curr->destination()->Equals(move->destination())) { |
| 90 DCHECK_EQ(nullptr, to_eliminate); | 90 DCHECK(!to_eliminate); |
| 91 to_eliminate = curr; | 91 to_eliminate = curr; |
| 92 if (replacement != nullptr) break; | 92 if (replacement != nullptr) break; |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 DCHECK(!(replacement == to_eliminate && replacement != nullptr)); | 95 DCHECK(!(replacement == to_eliminate && replacement != nullptr)); |
| 96 if (replacement != nullptr) { | 96 if (replacement != nullptr) { |
| 97 auto new_source = new (zone) InstructionOperand( | 97 auto new_source = new (zone) InstructionOperand( |
| 98 replacement->source()->kind(), replacement->source()->index()); | 98 replacement->source()->kind(), replacement->source()->index()); |
| 99 move->set_source(new_source); | 99 move->set_source(new_source); |
| 100 } | 100 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 std::swap(*new_move, *it); | 196 std::swap(*new_move, *it); |
| 197 ++it; | 197 ++it; |
| 198 } | 198 } |
| 199 DCHECK_EQ(it, slot_1->move_operands()->end()); | 199 DCHECK_EQ(it, slot_1->move_operands()->end()); |
| 200 new_moves->clear(); | 200 new_moves->clear(); |
| 201 } | 201 } |
| 202 | 202 |
| 203 } // namespace compiler | 203 } // namespace compiler |
| 204 } // namespace internal | 204 } // namespace internal |
| 205 } // namespace v8 | 205 } // namespace v8 |
| OLD | NEW |