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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 } | 192 } |
193 | 193 |
194 | 194 |
195 bool FlowGraphCompiler::IsNextBlock(BlockEntryInstr* block_entry) const { | 195 bool FlowGraphCompiler::IsNextBlock(BlockEntryInstr* block_entry) const { |
196 intptr_t current_index = reverse_index(current_block()->postorder_number()); | 196 intptr_t current_index = reverse_index(current_block()->postorder_number()); |
197 return (current_index < (block_order().length() - 1)) && | 197 return (current_index < (block_order().length() - 1)) && |
198 (block_order()[current_index + 1] == block_entry); | 198 (block_order()[current_index + 1] == block_entry); |
199 } | 199 } |
200 | 200 |
201 | 201 |
202 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { | |
203 // TODO(vegorov): consider saving only caller save (volatile) registers. | |
204 for (intptr_t reg_idx = 0; reg_idx < kNumberOfCpuRegisters; ++reg_idx) { | |
205 Register reg = static_cast<Register>(reg_idx); | |
206 if (locs->live_registers()->Contains(reg)) { | |
207 assembler()->PushRegister(reg); | |
208 } | |
209 } | |
210 } | |
211 | |
212 | |
213 void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) { | |
214 for (intptr_t reg_idx = kNumberOfCpuRegisters - 1; reg_idx >= 0; --reg_idx) { | |
215 Register reg = static_cast<Register>(reg_idx); | |
216 if (locs->live_registers()->Contains(reg)) { | |
217 assembler()->PopRegister(reg); | |
218 } | |
219 } | |
220 } | |
221 | |
222 | |
223 void FlowGraphCompiler::AddSlowPathCode(SlowPathCode* code) { | 202 void FlowGraphCompiler::AddSlowPathCode(SlowPathCode* code) { |
224 slow_path_code_.Add(code); | 203 slow_path_code_.Add(code); |
225 } | 204 } |
226 | 205 |
227 | 206 |
228 void FlowGraphCompiler::GenerateDeferredCode() { | 207 void FlowGraphCompiler::GenerateDeferredCode() { |
229 for (intptr_t i = 0; i < slow_path_code_.length(); i++) { | 208 for (intptr_t i = 0; i < slow_path_code_.length(); i++) { |
230 slow_path_code_[i]->EmitNativeCode(this); | 209 slow_path_code_[i]->EmitNativeCode(this); |
231 } | 210 } |
232 for (intptr_t i = 0; i < deopt_stubs_.length(); i++) { | 211 for (intptr_t i = 0; i < deopt_stubs_.length(); i++) { |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 switch (result_location.policy()) { | 620 switch (result_location.policy()) { |
642 case Location::kAny: | 621 case Location::kAny: |
643 case Location::kPrefersRegister: | 622 case Location::kPrefersRegister: |
644 case Location::kRequiresRegister: | 623 case Location::kRequiresRegister: |
645 result_location = Location::RegisterLocation( | 624 result_location = Location::RegisterLocation( |
646 AllocateFreeRegister(blocked_registers)); | 625 AllocateFreeRegister(blocked_registers)); |
647 break; | 626 break; |
648 case Location::kSameAsFirstInput: | 627 case Location::kSameAsFirstInput: |
649 result_location = locs->in(0); | 628 result_location = locs->in(0); |
650 break; | 629 break; |
| 630 case Location::kRequiresXmmRegister: |
| 631 UNREACHABLE(); |
| 632 break; |
651 } | 633 } |
652 locs->set_out(result_location); | 634 locs->set_out(result_location); |
653 } | 635 } |
654 } | 636 } |
655 | 637 |
656 | 638 |
657 ParallelMoveResolver::ParallelMoveResolver(FlowGraphCompiler* compiler) | 639 ParallelMoveResolver::ParallelMoveResolver(FlowGraphCompiler* compiler) |
658 : compiler_(compiler), moves_(32) {} | 640 : compiler_(compiler), moves_(32) {} |
659 | 641 |
660 | 642 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 return; | 738 return; |
757 } | 739 } |
758 } | 740 } |
759 | 741 |
760 // This move is not blocked. | 742 // This move is not blocked. |
761 EmitMove(index); | 743 EmitMove(index); |
762 } | 744 } |
763 | 745 |
764 | 746 |
765 } // namespace dart | 747 } // namespace dart |
OLD | NEW |