| 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 "test/unittests/compiler/instruction-sequence-unittest.h" | 6 #include "test/unittests/compiler/instruction-sequence-unittest.h" |
| 7 | 7 |
| 8 namespace v8 { | 8 namespace v8 { |
| 9 namespace internal { | 9 namespace internal { |
| 10 namespace compiler { | 10 namespace compiler { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 << printable; | 60 << printable; |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 InstructionOperand* ConvertMoveArg(TestOperand op) { | 65 InstructionOperand* ConvertMoveArg(TestOperand op) { |
| 66 CHECK_EQ(kNoValue, op.vreg_.value_); | 66 CHECK_EQ(kNoValue, op.vreg_.value_); |
| 67 CHECK_NE(kNoValue, op.value_); | 67 CHECK_NE(kNoValue, op.value_); |
| 68 switch (op.type_) { | 68 switch (op.type_) { |
| 69 case kConstant: | 69 case kConstant: |
| 70 return ConstantOperand::New(op.value_, zone()); | 70 return ConstantOperand::New(zone(), op.value_); |
| 71 case kFixedSlot: | 71 case kFixedSlot: |
| 72 return StackSlotOperand::New(op.value_, zone()); | 72 return StackSlotOperand::New(zone(), op.value_); |
| 73 case kFixedRegister: | 73 case kFixedRegister: |
| 74 CHECK(0 <= op.value_ && op.value_ < num_general_registers()); | 74 CHECK(0 <= op.value_ && op.value_ < num_general_registers()); |
| 75 return RegisterOperand::New(op.value_, zone()); | 75 return RegisterOperand::New(zone(), op.value_); |
| 76 default: | 76 default: |
| 77 break; | 77 break; |
| 78 } | 78 } |
| 79 CHECK(false); | 79 CHECK(false); |
| 80 return nullptr; | 80 return nullptr; |
| 81 } | 81 } |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 | 84 |
| 85 TEST_F(MoveOptimizerTest, RemovesRedundant) { | 85 TEST_F(MoveOptimizerTest, RemovesRedundant) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 CHECK(gap_1->AreMovesRedundant()); | 171 CHECK(gap_1->AreMovesRedundant()); |
| 172 auto move = LastInstruction()->parallel_moves()[0]; | 172 auto move = LastInstruction()->parallel_moves()[0]; |
| 173 CHECK_EQ(2, NonRedundantSize(move)); | 173 CHECK_EQ(2, NonRedundantSize(move)); |
| 174 CHECK(Contains(move, Reg(0), Reg(1))); | 174 CHECK(Contains(move, Reg(0), Reg(1))); |
| 175 CHECK(Contains(move, Reg(1), Reg(0))); | 175 CHECK(Contains(move, Reg(1), Reg(0))); |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace compiler | 178 } // namespace compiler |
| 179 } // namespace internal | 179 } // namespace internal |
| 180 } // namespace v8 | 180 } // namespace v8 |
| OLD | NEW |