| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 // Will compress after insertion. | 197 // Will compress after insertion. |
| 198 gap_initialized = false; | 198 gap_initialized = false; |
| 199 std::swap(instr->parallel_moves()[0], instr->parallel_moves()[1]); | 199 std::swap(instr->parallel_moves()[0], instr->parallel_moves()[1]); |
| 200 } | 200 } |
| 201 auto move = instr->GetOrCreateParallelMove( | 201 auto move = instr->GetOrCreateParallelMove( |
| 202 static_cast<Instruction::GapPosition>(0), code_zone()); | 202 static_cast<Instruction::GapPosition>(0), code_zone()); |
| 203 // Delete relevant entries in predecessors and move everything to block. | 203 // Delete relevant entries in predecessors and move everything to block. |
| 204 bool first_iteration = true; | 204 bool first_iteration = true; |
| 205 for (auto pred_index : block->predecessors()) { | 205 for (auto pred_index : block->predecessors()) { |
| 206 auto pred = code()->InstructionBlockAt(pred_index); | 206 auto pred = code()->InstructionBlockAt(pred_index); |
| 207 auto instr = LastInstruction(pred); | 207 auto move_ops = LastInstruction(pred)->parallel_moves()[0]->move_operands(); |
| 208 auto move_ops = instr->parallel_moves()[0]->move_operands(); | |
| 209 for (auto op = move_ops->begin(); op != move_ops->end(); ++op) { | 208 for (auto op = move_ops->begin(); op != move_ops->end(); ++op) { |
| 210 if (op->IsRedundant()) continue; | 209 if (op->IsRedundant()) continue; |
| 211 MoveKey key = {*op->source(), *op->destination()}; | 210 MoveKey key = {*op->source(), *op->destination()}; |
| 212 auto it = move_map.find(key); | 211 auto it = move_map.find(key); |
| 213 USE(it); | 212 USE(it); |
| 214 DCHECK(it != move_map.end()); | 213 DCHECK(it != move_map.end()); |
| 215 if (first_iteration) { | 214 if (first_iteration) { |
| 216 move->AddMove(op->source(), op->destination(), code_zone()); | 215 move->AddMove(op->source(), op->destination(), code_zone()); |
| 217 } | 216 } |
| 218 op->Eliminate(); | 217 op->Eliminate(); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 std::swap(*new_move, *it); | 288 std::swap(*new_move, *it); |
| 290 ++it; | 289 ++it; |
| 291 } | 290 } |
| 292 DCHECK_EQ(it, slot_1->move_operands()->end()); | 291 DCHECK_EQ(it, slot_1->move_operands()->end()); |
| 293 new_moves.clear(); | 292 new_moves.clear(); |
| 294 } | 293 } |
| 295 | 294 |
| 296 } // namespace compiler | 295 } // namespace compiler |
| 297 } // namespace internal | 296 } // namespace internal |
| 298 } // namespace v8 | 297 } // namespace v8 |
| OLD | NEW |