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 #ifndef V8_COMPILER_MOVE_OPTIMIZER_ | 5 #ifndef V8_COMPILER_MOVE_OPTIMIZER_ |
6 #define V8_COMPILER_MOVE_OPTIMIZER_ | 6 #define V8_COMPILER_MOVE_OPTIMIZER_ |
7 | 7 |
8 #include "src/compiler/instruction.h" | 8 #include "src/compiler/instruction.h" |
9 #include "src/zone-containers.h" | 9 #include "src/zone-containers.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 namespace compiler { | 13 namespace compiler { |
14 | 14 |
15 class MoveOptimizer FINAL { | 15 class MoveOptimizer FINAL { |
16 public: | 16 public: |
17 MoveOptimizer(Zone* local_zone, InstructionSequence* code); | 17 MoveOptimizer(Zone* local_zone, InstructionSequence* code); |
18 void Run(); | 18 void Run(); |
19 | 19 |
20 private: | 20 private: |
21 typedef ZoneVector<MoveOperands*> MoveOpVector; | 21 typedef ZoneVector<MoveOperands*> MoveOpVector; |
| 22 typedef ZoneVector<GapInstruction*> GapInstructions; |
22 | 23 |
23 InstructionSequence* code() const { return code_; } | 24 InstructionSequence* code() const { return code_; } |
24 Zone* local_zone() const { return local_zone_; } | 25 Zone* local_zone() const { return local_zone_; } |
25 Zone* code_zone() const { return code()->zone(); } | 26 Zone* code_zone() const { return code()->zone(); } |
| 27 MoveOpVector& temp_vector_0() { return temp_vector_0_; } |
| 28 MoveOpVector& temp_vector_1() { return temp_vector_1_; } |
26 | 29 |
| 30 void CompressBlock(InstructionBlock* blocke); |
27 void CompressMoves(MoveOpVector* eliminated, ParallelMove* left, | 31 void CompressMoves(MoveOpVector* eliminated, ParallelMove* left, |
28 ParallelMove* right); | 32 ParallelMove* right); |
29 void FinalizeMoves(MoveOpVector* loads, MoveOpVector* new_moves, | 33 void FinalizeMoves(GapInstruction* gap); |
30 GapInstruction* gap); | |
31 | 34 |
32 Zone* const local_zone_; | 35 Zone* const local_zone_; |
33 InstructionSequence* const code_; | 36 InstructionSequence* const code_; |
| 37 GapInstructions to_finalize_; |
34 MoveOpVector temp_vector_0_; | 38 MoveOpVector temp_vector_0_; |
35 MoveOpVector temp_vector_1_; | 39 MoveOpVector temp_vector_1_; |
36 | 40 |
37 DISALLOW_COPY_AND_ASSIGN(MoveOptimizer); | 41 DISALLOW_COPY_AND_ASSIGN(MoveOptimizer); |
38 }; | 42 }; |
39 | 43 |
40 } // namespace compiler | 44 } // namespace compiler |
41 } // namespace internal | 45 } // namespace internal |
42 } // namespace v8 | 46 } // namespace v8 |
43 | 47 |
44 #endif // V8_COMPILER_MOVE_OPTIMIZER_ | 48 #endif // V8_COMPILER_MOVE_OPTIMIZER_ |
OLD | NEW |