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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 | 71 |
72 OperandMap values_; | 72 OperandMap values_; |
73 }; | 73 }; |
74 | 74 |
75 | 75 |
76 // An abstract interpreter for moves, swaps and parallel moves. | 76 // An abstract interpreter for moves, swaps and parallel moves. |
77 class MoveInterpreter : public GapResolver::Assembler { | 77 class MoveInterpreter : public GapResolver::Assembler { |
78 public: | 78 public: |
79 virtual void AssembleMove(InstructionOperand* source, | 79 virtual void AssembleMove(InstructionOperand* source, |
80 InstructionOperand* destination) V8_OVERRIDE { | 80 InstructionOperand* destination) OVERRIDE { |
81 InterpreterState::Moves moves; | 81 InterpreterState::Moves moves; |
82 moves.push_back(MoveOperands(source, destination)); | 82 moves.push_back(MoveOperands(source, destination)); |
83 state_.ExecuteInParallel(moves); | 83 state_.ExecuteInParallel(moves); |
84 } | 84 } |
85 | 85 |
86 virtual void AssembleSwap(InstructionOperand* source, | 86 virtual void AssembleSwap(InstructionOperand* source, |
87 InstructionOperand* destination) V8_OVERRIDE { | 87 InstructionOperand* destination) OVERRIDE { |
88 InterpreterState::Moves moves; | 88 InterpreterState::Moves moves; |
89 moves.push_back(MoveOperands(source, destination)); | 89 moves.push_back(MoveOperands(source, destination)); |
90 moves.push_back(MoveOperands(destination, source)); | 90 moves.push_back(MoveOperands(destination, source)); |
91 state_.ExecuteInParallel(moves); | 91 state_.ExecuteInParallel(moves); |
92 } | 92 } |
93 | 93 |
94 void AssembleParallelMove(const ParallelMove* pm) { | 94 void AssembleParallelMove(const ParallelMove* pm) { |
95 InterpreterState::Moves moves(pm->move_operands()->begin(), | 95 InterpreterState::Moves moves(pm->move_operands()->begin(), |
96 pm->move_operands()->end()); | 96 pm->move_operands()->end()); |
97 state_.ExecuteInParallel(moves); | 97 state_.ExecuteInParallel(moves); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 mi1.AssembleParallelMove(pm); | 164 mi1.AssembleParallelMove(pm); |
165 | 165 |
166 MoveInterpreter mi2; | 166 MoveInterpreter mi2; |
167 GapResolver resolver(&mi2); | 167 GapResolver resolver(&mi2); |
168 resolver.Resolve(pm); | 168 resolver.Resolve(pm); |
169 | 169 |
170 CHECK(mi1.state() == mi2.state()); | 170 CHECK(mi1.state() == mi2.state()); |
171 } | 171 } |
172 } | 172 } |
173 } | 173 } |
OLD | NEW |