| 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 #include "src/compiler/pipeline.h" | 6 #include "src/compiler/pipeline.h" |
| 7 #include "test/unittests/compiler/instruction-sequence-unittest.h" | 7 #include "test/unittests/compiler/instruction-sequence-unittest.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 CHECK_EQ(0, NonRedundantSize(first_instr->parallel_moves()[0])); | 100 CHECK_EQ(0, NonRedundantSize(first_instr->parallel_moves()[0])); |
| 101 auto move = last_instr->parallel_moves()[0]; | 101 auto move = last_instr->parallel_moves()[0]; |
| 102 CHECK_EQ(1, NonRedundantSize(move)); | 102 CHECK_EQ(1, NonRedundantSize(move)); |
| 103 CHECK(Contains(move, Reg(0), Reg(1))); | 103 CHECK(Contains(move, Reg(0), Reg(1))); |
| 104 } | 104 } |
| 105 | 105 |
| 106 | 106 |
| 107 TEST_F(MoveOptimizerTest, RemovesRedundantExplicit) { | 107 TEST_F(MoveOptimizerTest, RemovesRedundantExplicit) { |
| 108 int first_reg_index = | 108 int first_reg_index = |
| 109 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) | 109 RegisterConfiguration::Turbofan()->GetAllocatableGeneralCode(0); |
| 110 ->GetAllocatableGeneralCode(0); | |
| 111 int second_reg_index = | 110 int second_reg_index = |
| 112 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) | 111 RegisterConfiguration::Turbofan()->GetAllocatableGeneralCode(1); |
| 113 ->GetAllocatableGeneralCode(1); | |
| 114 | 112 |
| 115 StartBlock(); | 113 StartBlock(); |
| 116 auto first_instr = EmitNop(); | 114 auto first_instr = EmitNop(); |
| 117 AddMove(first_instr, Reg(first_reg_index), ExplicitReg(second_reg_index)); | 115 AddMove(first_instr, Reg(first_reg_index), ExplicitReg(second_reg_index)); |
| 118 auto last_instr = EmitNop(); | 116 auto last_instr = EmitNop(); |
| 119 AddMove(last_instr, Reg(second_reg_index), Reg(first_reg_index)); | 117 AddMove(last_instr, Reg(second_reg_index), Reg(first_reg_index)); |
| 120 EndBlock(Last()); | 118 EndBlock(Last()); |
| 121 | 119 |
| 122 Optimize(); | 120 Optimize(); |
| 123 | 121 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 ParallelMove* first_move = first_instr->parallel_moves()[0]; | 333 ParallelMove* first_move = first_instr->parallel_moves()[0]; |
| 336 CHECK_EQ(0, NonRedundantSize(first_move)); | 334 CHECK_EQ(0, NonRedundantSize(first_move)); |
| 337 | 335 |
| 338 ParallelMove* last_move = last_instr->parallel_moves()[0]; | 336 ParallelMove* last_move = last_instr->parallel_moves()[0]; |
| 339 CHECK_EQ(0, NonRedundantSize(last_move)); | 337 CHECK_EQ(0, NonRedundantSize(last_move)); |
| 340 } | 338 } |
| 341 | 339 |
| 342 } // namespace compiler | 340 } // namespace compiler |
| 343 } // namespace internal | 341 } // namespace internal |
| 344 } // namespace v8 | 342 } // namespace v8 |
| OLD | NEW |