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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 temp_vector_0_(local_zone), | 52 temp_vector_0_(local_zone), |
53 temp_vector_1_(local_zone) {} | 53 temp_vector_1_(local_zone) {} |
54 | 54 |
55 | 55 |
56 void MoveOptimizer::Run() { | 56 void MoveOptimizer::Run() { |
57 for (auto* block : code()->instruction_blocks()) { | 57 for (auto* block : code()->instruction_blocks()) { |
58 CompressBlock(block); | 58 CompressBlock(block); |
59 } | 59 } |
60 for (auto block : code()->instruction_blocks()) { | 60 for (auto block : code()->instruction_blocks()) { |
61 if (block->PredecessorCount() <= 1) continue; | 61 if (block->PredecessorCount() <= 1) continue; |
| 62 bool has_only_deferred = true; |
| 63 for (RpoNumber pred_id : block->predecessors()) { |
| 64 if (!code()->InstructionBlockAt(pred_id)->IsDeferred()) { |
| 65 has_only_deferred = false; |
| 66 break; |
| 67 } |
| 68 } |
| 69 // This would pull down common moves. If the moves occur in deferred blocks, |
| 70 // and the closest common successor is not deferred, we lose the |
| 71 // optimization of just spilling/filling in deferred blocks. |
| 72 if (has_only_deferred) continue; |
62 OptimizeMerge(block); | 73 OptimizeMerge(block); |
63 } | 74 } |
64 for (auto gap : to_finalize_) { | 75 for (auto gap : to_finalize_) { |
65 FinalizeMoves(gap); | 76 FinalizeMoves(gap); |
66 } | 77 } |
67 } | 78 } |
68 | 79 |
69 | 80 |
70 void MoveOptimizer::CompressMoves(MoveOpVector* eliminated, ParallelMove* left, | 81 void MoveOptimizer::CompressMoves(MoveOpVector* eliminated, ParallelMove* left, |
71 ParallelMove* right) { | 82 ParallelMove* right) { |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 static_cast<Instruction::GapPosition>(1), code_zone()); | 287 static_cast<Instruction::GapPosition>(1), code_zone()); |
277 slot_1->AddMove(group_begin->destination(), load->destination()); | 288 slot_1->AddMove(group_begin->destination(), load->destination()); |
278 load->Eliminate(); | 289 load->Eliminate(); |
279 } | 290 } |
280 loads.clear(); | 291 loads.clear(); |
281 } | 292 } |
282 | 293 |
283 } // namespace compiler | 294 } // namespace compiler |
284 } // namespace internal | 295 } // namespace internal |
285 } // namespace v8 | 296 } // namespace v8 |
OLD | NEW |