| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 return Value(op->kind(), op->index()); | 58 return Value(op->kind(), op->index()); |
| 59 } | 59 } |
| 60 | 60 |
| 61 friend std::ostream& operator<<(std::ostream& os, | 61 friend std::ostream& operator<<(std::ostream& os, |
| 62 const InterpreterState& is) { | 62 const InterpreterState& is) { |
| 63 for (OperandMap::const_iterator it = is.values_.begin(); | 63 for (OperandMap::const_iterator it = is.values_.begin(); |
| 64 it != is.values_.end(); ++it) { | 64 it != is.values_.end(); ++it) { |
| 65 if (it != is.values_.begin()) os << " "; | 65 if (it != is.values_.begin()) os << " "; |
| 66 InstructionOperand source(it->first.first, it->first.second); | 66 InstructionOperand source(it->first.first, it->first.second); |
| 67 InstructionOperand destination(it->second.first, it->second.second); | 67 InstructionOperand destination(it->second.first, it->second.second); |
| 68 os << MoveOperands(&source, &destination); | 68 MoveOperands mo(&source, &destination); |
| 69 PrintableMoveOperands pmo = {RegisterConfiguration::ArchDefault(), &mo}; |
| 70 os << pmo; |
| 69 } | 71 } |
| 70 return os; | 72 return os; |
| 71 } | 73 } |
| 72 | 74 |
| 73 OperandMap values_; | 75 OperandMap values_; |
| 74 }; | 76 }; |
| 75 | 77 |
| 76 | 78 |
| 77 // An abstract interpreter for moves, swaps and parallel moves. | 79 // An abstract interpreter for moves, swaps and parallel moves. |
| 78 class MoveInterpreter : public GapResolver::Assembler { | 80 class MoveInterpreter : public GapResolver::Assembler { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 mi1.AssembleParallelMove(pm); | 167 mi1.AssembleParallelMove(pm); |
| 166 | 168 |
| 167 MoveInterpreter mi2; | 169 MoveInterpreter mi2; |
| 168 GapResolver resolver(&mi2); | 170 GapResolver resolver(&mi2); |
| 169 resolver.Resolve(pm); | 171 resolver.Resolve(pm); |
| 170 | 172 |
| 171 CHECK(mi1.state() == mi2.state()); | 173 CHECK(mi1.state() == mi2.state()); |
| 172 } | 174 } |
| 173 } | 175 } |
| 174 } | 176 } |
| OLD | NEW |