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 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
6 | 6 |
7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
8 | 8 |
9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
10 #include "vm/debugger.h" | 10 #include "vm/debugger.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 } | 194 } |
195 | 195 |
196 | 196 |
197 bool FlowGraphCompiler::IsNextBlock(BlockEntryInstr* block_entry) const { | 197 bool FlowGraphCompiler::IsNextBlock(BlockEntryInstr* block_entry) const { |
198 intptr_t current_index = reverse_index(current_block()->postorder_number()); | 198 intptr_t current_index = reverse_index(current_block()->postorder_number()); |
199 return (current_index < (block_order().length() - 1)) && | 199 return (current_index < (block_order().length() - 1)) && |
200 (block_order()[current_index + 1] == block_entry); | 200 (block_order()[current_index + 1] == block_entry); |
201 } | 201 } |
202 | 202 |
203 | 203 |
204 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { | |
205 // TODO(vegorov): consider saving only caller save (volatile) registers. | |
206 for (intptr_t reg_idx = 0; reg_idx < kNumberOfCpuRegisters; ++reg_idx) { | |
207 Register reg = static_cast<Register>(reg_idx); | |
208 if (locs->live_registers()->Contains(reg)) { | |
209 assembler()->PushRegister(reg); | |
210 } | |
211 } | |
212 } | |
213 | |
214 | |
215 void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) { | |
216 for (intptr_t reg_idx = kNumberOfCpuRegisters - 1; reg_idx >= 0; --reg_idx) { | |
217 Register reg = static_cast<Register>(reg_idx); | |
218 if (locs->live_registers()->Contains(reg)) { | |
219 assembler()->PopRegister(reg); | |
220 } | |
221 } | |
222 } | |
223 | |
224 | |
225 void FlowGraphCompiler::AddSlowPathCode(SlowPathCode* code) { | 204 void FlowGraphCompiler::AddSlowPathCode(SlowPathCode* code) { |
226 slow_path_code_.Add(code); | 205 slow_path_code_.Add(code); |
227 } | 206 } |
228 | 207 |
229 | 208 |
230 void FlowGraphCompiler::GenerateDeferredCode() { | 209 void FlowGraphCompiler::GenerateDeferredCode() { |
231 for (intptr_t i = 0; i < slow_path_code_.length(); i++) { | 210 for (intptr_t i = 0; i < slow_path_code_.length(); i++) { |
232 slow_path_code_[i]->EmitNativeCode(this); | 211 slow_path_code_[i]->EmitNativeCode(this); |
233 } | 212 } |
234 for (intptr_t i = 0; i < deopt_stubs_.length(); i++) { | 213 for (intptr_t i = 0; i < deopt_stubs_.length(); i++) { |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 switch (result_location.policy()) { | 631 switch (result_location.policy()) { |
653 case Location::kAny: | 632 case Location::kAny: |
654 case Location::kPrefersRegister: | 633 case Location::kPrefersRegister: |
655 case Location::kRequiresRegister: | 634 case Location::kRequiresRegister: |
656 result_location = Location::RegisterLocation( | 635 result_location = Location::RegisterLocation( |
657 AllocateFreeRegister(blocked_registers)); | 636 AllocateFreeRegister(blocked_registers)); |
658 break; | 637 break; |
659 case Location::kSameAsFirstInput: | 638 case Location::kSameAsFirstInput: |
660 result_location = locs->in(0); | 639 result_location = locs->in(0); |
661 break; | 640 break; |
| 641 case Location::kRequiresXmmRegister: |
| 642 UNREACHABLE(); |
| 643 break; |
662 } | 644 } |
663 locs->set_out(result_location); | 645 locs->set_out(result_location); |
664 } | 646 } |
665 } | 647 } |
666 | 648 |
667 | 649 |
668 ParallelMoveResolver::ParallelMoveResolver(FlowGraphCompiler* compiler) | 650 ParallelMoveResolver::ParallelMoveResolver(FlowGraphCompiler* compiler) |
669 : compiler_(compiler), moves_(32) {} | 651 : compiler_(compiler), moves_(32) {} |
670 | 652 |
671 | 653 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 return; | 749 return; |
768 } | 750 } |
769 } | 751 } |
770 | 752 |
771 // This move is not blocked. | 753 // This move is not blocked. |
772 EmitMove(index); | 754 EmitMove(index); |
773 } | 755 } |
774 | 756 |
775 | 757 |
776 } // namespace dart | 758 } // namespace dart |
OLD | NEW |