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/gap-resolver.h" | 5 #include "src/compiler/gap-resolver.h" |
6 | 6 |
7 #include "src/base/utils/random-number-generator.h" | 7 #include "src/base/utils/random-number-generator.h" |
8 #include "test/cctest/cctest.h" | 8 #include "test/cctest/cctest.h" |
9 | 9 |
10 using namespace v8::internal; | 10 using namespace v8::internal; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 if (!mo.IsRedundant() && seen.find(mo.destination()) == seen.end()) { | 116 if (!mo.IsRedundant() && seen.find(mo.destination()) == seen.end()) { |
117 parallel_move->AddMove(mo.source(), mo.destination(), main_zone()); | 117 parallel_move->AddMove(mo.source(), mo.destination(), main_zone()); |
118 seen.insert(mo.destination()); | 118 seen.insert(mo.destination()); |
119 } | 119 } |
120 } | 120 } |
121 return parallel_move; | 121 return parallel_move; |
122 } | 122 } |
123 | 123 |
124 private: | 124 private: |
125 struct InstructionOperandComparator { | 125 struct InstructionOperandComparator { |
126 bool operator()(const InstructionOperand* x, const InstructionOperand* y) { | 126 bool operator()(const InstructionOperand* x, |
| 127 const InstructionOperand* y) const { |
127 return (x->kind() < y->kind()) || | 128 return (x->kind() < y->kind()) || |
128 (x->kind() == y->kind() && x->index() < y->index()); | 129 (x->kind() == y->kind() && x->index() < y->index()); |
129 } | 130 } |
130 }; | 131 }; |
131 | 132 |
132 InstructionOperand* CreateRandomOperand() { | 133 InstructionOperand* CreateRandomOperand() { |
133 int index = rng_->NextInt(6); | 134 int index = rng_->NextInt(6); |
134 switch (rng_->NextInt(5)) { | 135 switch (rng_->NextInt(5)) { |
135 case 0: | 136 case 0: |
136 return ConstantOperand::Create(index, main_zone()); | 137 return ConstantOperand::Create(index, main_zone()); |
(...skipping 26 matching lines...) Expand all Loading... |
163 mi1.AssembleParallelMove(pm); | 164 mi1.AssembleParallelMove(pm); |
164 | 165 |
165 MoveInterpreter mi2; | 166 MoveInterpreter mi2; |
166 GapResolver resolver(&mi2); | 167 GapResolver resolver(&mi2); |
167 resolver.Resolve(pm); | 168 resolver.Resolve(pm); |
168 | 169 |
169 CHECK(mi1.state() == mi2.state()); | 170 CHECK(mi1.state() == mi2.state()); |
170 } | 171 } |
171 } | 172 } |
172 } | 173 } |
OLD | NEW |