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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 OperandMap values_; | 109 OperandMap values_; |
110 }; | 110 }; |
111 | 111 |
112 | 112 |
113 // An abstract interpreter for moves, swaps and parallel moves. | 113 // An abstract interpreter for moves, swaps and parallel moves. |
114 class MoveInterpreter : public GapResolver::Assembler { | 114 class MoveInterpreter : public GapResolver::Assembler { |
115 public: | 115 public: |
116 explicit MoveInterpreter(Zone* zone) : zone_(zone) {} | 116 explicit MoveInterpreter(Zone* zone) : zone_(zone) {} |
117 | 117 |
118 virtual void AssembleMove(InstructionOperand* source, | 118 virtual void AssembleMove(InstructionOperand* source, |
119 InstructionOperand* destination) OVERRIDE { | 119 InstructionOperand* destination) override { |
120 ParallelMove* moves = new (zone_) ParallelMove(zone_); | 120 ParallelMove* moves = new (zone_) ParallelMove(zone_); |
121 moves->AddMove(*source, *destination); | 121 moves->AddMove(*source, *destination); |
122 state_.ExecuteInParallel(moves); | 122 state_.ExecuteInParallel(moves); |
123 } | 123 } |
124 | 124 |
125 virtual void AssembleSwap(InstructionOperand* source, | 125 virtual void AssembleSwap(InstructionOperand* source, |
126 InstructionOperand* destination) OVERRIDE { | 126 InstructionOperand* destination) override { |
127 ParallelMove* moves = new (zone_) ParallelMove(zone_); | 127 ParallelMove* moves = new (zone_) ParallelMove(zone_); |
128 moves->AddMove(*source, *destination); | 128 moves->AddMove(*source, *destination); |
129 moves->AddMove(*destination, *source); | 129 moves->AddMove(*destination, *source); |
130 state_.ExecuteInParallel(moves); | 130 state_.ExecuteInParallel(moves); |
131 } | 131 } |
132 | 132 |
133 void AssembleParallelMove(const ParallelMove* moves) { | 133 void AssembleParallelMove(const ParallelMove* moves) { |
134 state_.ExecuteInParallel(moves); | 134 state_.ExecuteInParallel(moves); |
135 } | 135 } |
136 | 136 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 mi1.AssembleParallelMove(pm); | 195 mi1.AssembleParallelMove(pm); |
196 | 196 |
197 MoveInterpreter mi2(pmc.main_zone()); | 197 MoveInterpreter mi2(pmc.main_zone()); |
198 GapResolver resolver(&mi2); | 198 GapResolver resolver(&mi2); |
199 resolver.Resolve(pm); | 199 resolver.Resolve(pm); |
200 | 200 |
201 CHECK(mi1.state() == mi2.state()); | 201 CHECK(mi1.state() == mi2.state()); |
202 } | 202 } |
203 } | 203 } |
204 } | 204 } |
OLD | NEW |