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 } | 60 } |
61 | 61 |
62 private: | 62 private: |
63 InstructionOperand ConvertMoveArg(TestOperand op) { | 63 InstructionOperand ConvertMoveArg(TestOperand op) { |
64 CHECK_EQ(kNoValue, op.vreg_.value_); | 64 CHECK_EQ(kNoValue, op.vreg_.value_); |
65 CHECK_NE(kNoValue, op.value_); | 65 CHECK_NE(kNoValue, op.value_); |
66 switch (op.type_) { | 66 switch (op.type_) { |
67 case kConstant: | 67 case kConstant: |
68 return ConstantOperand(op.value_); | 68 return ConstantOperand(op.value_); |
69 case kFixedSlot: | 69 case kFixedSlot: |
70 return StackSlotOperand(kRepWord32, op.value_); | 70 return AllocatedOperand(LocationOperand::STACK_SLOT, kRepWord32, |
71 op.value_); | |
71 case kFixedRegister: | 72 case kFixedRegister: |
72 CHECK(0 <= op.value_ && op.value_ < num_general_registers()); | 73 CHECK(0 <= op.value_ && op.value_ < num_general_registers()); |
73 return RegisterOperand(kRepWord32, op.value_); | 74 return AllocatedOperand(LocationOperand::REGISTER, kRepWord32, |
75 op.value_); | |
Mircea Trofin
2015/10/15 15:05:38
Should we also have a unit test where the move opt
danno
2015/10/23 08:07:49
Done
| |
74 default: | 76 default: |
75 break; | 77 break; |
76 } | 78 } |
77 CHECK(false); | 79 CHECK(false); |
78 return InstructionOperand(); | 80 return InstructionOperand(); |
79 } | 81 } |
80 }; | 82 }; |
81 | 83 |
82 | 84 |
83 TEST_F(MoveOptimizerTest, RemovesRedundant) { | 85 TEST_F(MoveOptimizerTest, RemovesRedundant) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 CHECK(gap_1->AreMovesRedundant()); | 175 CHECK(gap_1->AreMovesRedundant()); |
174 auto move = last->parallel_moves()[0]; | 176 auto move = last->parallel_moves()[0]; |
175 CHECK_EQ(2, NonRedundantSize(move)); | 177 CHECK_EQ(2, NonRedundantSize(move)); |
176 CHECK(Contains(move, Reg(0), Reg(1))); | 178 CHECK(Contains(move, Reg(0), Reg(1))); |
177 CHECK(Contains(move, Reg(1), Reg(0))); | 179 CHECK(Contains(move, Reg(1), Reg(0))); |
178 } | 180 } |
179 | 181 |
180 } // namespace compiler | 182 } // namespace compiler |
181 } // namespace internal | 183 } // namespace internal |
182 } // namespace v8 | 184 } // namespace v8 |
OLD | NEW |