OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_FLOW_GRAPH_COMPILER_H_ | 5 #ifndef VM_FLOW_GRAPH_COMPILER_H_ |
6 #define VM_FLOW_GRAPH_COMPILER_H_ | 6 #define VM_FLOW_GRAPH_COMPILER_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/code_descriptors.h" | 10 #include "vm/code_descriptors.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 | 24 |
25 | 25 |
26 class ParallelMoveResolver : public ValueObject { | 26 class ParallelMoveResolver : public ValueObject { |
27 public: | 27 public: |
28 explicit ParallelMoveResolver(FlowGraphCompiler* compiler); | 28 explicit ParallelMoveResolver(FlowGraphCompiler* compiler); |
29 | 29 |
30 // Resolve a set of parallel moves, emitting assembler instructions. | 30 // Resolve a set of parallel moves, emitting assembler instructions. |
31 void EmitNativeCode(ParallelMoveInstr* parallel_move); | 31 void EmitNativeCode(ParallelMoveInstr* parallel_move); |
32 | 32 |
33 private: | 33 private: |
34 class ScratchFpuRegisterScope : public ValueObject { | |
35 public: | |
36 explicit ScratchFpuRegisterScope(ParallelMoveResolver* resolver); | |
37 ~ScratchFpuRegisterScope(); | |
38 | |
39 FpuRegister reg() const { return reg_; } | |
40 | |
41 private: | |
42 ParallelMoveResolver* resolver_; | |
43 FpuRegister reg_; | |
44 bool spilled_; | |
45 }; | |
46 | |
47 class ScratchRegisterScope : public ValueObject { | |
Florian Schneider
2013/04/09 09:44:27
Would one class instead of two almost identical cl
| |
48 public: | |
49 ScratchRegisterScope(ParallelMoveResolver* resolver, Register blocked); | |
50 ~ScratchRegisterScope(); | |
51 | |
52 Register reg() const { return reg_; } | |
53 | |
54 private: | |
55 ParallelMoveResolver* resolver_; | |
56 Register reg_; | |
57 bool spilled_; | |
58 }; | |
59 | |
60 | |
61 bool IsScratchLocation(Location loc); | |
62 void SpillScratch(Register reg); | |
63 void RestoreScratch(Register reg); | |
64 void SpillFpuScratch(FpuRegister reg); | |
65 void RestoreFpuScratch(FpuRegister reg); | |
66 | |
67 // friend class ScratchXmmRegisterScope; | |
68 | |
34 // Build the initial list of moves. | 69 // Build the initial list of moves. |
35 void BuildInitialMoveList(ParallelMoveInstr* parallel_move); | 70 void BuildInitialMoveList(ParallelMoveInstr* parallel_move); |
36 | 71 |
37 // Perform the move at the moves_ index in question (possibly requiring | 72 // Perform the move at the moves_ index in question (possibly requiring |
38 // other moves to satisfy dependencies). | 73 // other moves to satisfy dependencies). |
39 void PerformMove(int index); | 74 void PerformMove(int index); |
40 | 75 |
41 // Emit a move and remove it from the move graph. | 76 // Emit a move and remove it from the move graph. |
42 void EmitMove(int index); | 77 void EmitMove(int index); |
43 | 78 |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
547 // that should be used when deoptimizing we store it in this variable. | 582 // that should be used when deoptimizing we store it in this variable. |
548 // In future AddDeoptStub should be moved out of the instruction template. | 583 // In future AddDeoptStub should be moved out of the instruction template. |
549 Environment* pending_deoptimization_env_; | 584 Environment* pending_deoptimization_env_; |
550 | 585 |
551 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 586 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
552 }; | 587 }; |
553 | 588 |
554 } // namespace dart | 589 } // namespace dart |
555 | 590 |
556 #endif // VM_FLOW_GRAPH_COMPILER_H_ | 591 #endif // VM_FLOW_GRAPH_COMPILER_H_ |
OLD | NEW |