OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
9 | 9 |
10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 // type check runtime call is the checked value. | 711 // type check runtime call is the checked value. |
712 __ Drop(6); | 712 __ Drop(6); |
713 __ Pop(R0); | 713 __ Pop(R0); |
714 | 714 |
715 __ Bind(&is_assignable); | 715 __ Bind(&is_assignable); |
716 // Restore instantiator (R2) and its type arguments (R1). | 716 // Restore instantiator (R2) and its type arguments (R1). |
717 __ PopList((1 << R1) | (1 << R2)); | 717 __ PopList((1 << R1) | (1 << R2)); |
718 } | 718 } |
719 | 719 |
720 | 720 |
| 721 void FlowGraphCompiler::EmitTrySyncMove(intptr_t dest_offset, |
| 722 Location loc, |
| 723 bool* push_emitted) { |
| 724 if (loc.IsConstant()) { |
| 725 if (!*push_emitted) { |
| 726 __ Push(R0); |
| 727 *push_emitted = true; |
| 728 } |
| 729 __ LoadObject(R0, loc.constant()); |
| 730 __ StoreToOffset(kWord, R0, FP, dest_offset); |
| 731 } else if (loc.IsRegister()) { |
| 732 if (*push_emitted && (loc.reg() == R0)) { |
| 733 __ ldr(R0, Address(SP, 0)); |
| 734 __ StoreToOffset(kWord, R0, FP, dest_offset); |
| 735 } else { |
| 736 __ StoreToOffset(kWord, loc.reg(), FP, dest_offset); |
| 737 } |
| 738 } else { |
| 739 const intptr_t src_offset = loc.ToStackSlotOffset(); |
| 740 if (src_offset != dest_offset) { |
| 741 if (!*push_emitted) { |
| 742 __ Push(R0); |
| 743 *push_emitted = true; |
| 744 } |
| 745 __ LoadFromOffset(kWord, R0, FP, src_offset); |
| 746 __ StoreToOffset(kWord, R0, FP, dest_offset); |
| 747 } |
| 748 } |
| 749 } |
| 750 |
| 751 |
| 752 void FlowGraphCompiler::EmitTrySync(Instruction* instr, intptr_t try_index) { |
| 753 ASSERT(is_optimizing()); |
| 754 Environment* env = instr->env(); |
| 755 CatchBlockEntryInstr* catch_block = |
| 756 flow_graph().graph_entry()->GetCatchEntry(try_index); |
| 757 const GrowableArray<Definition*>* idefs = catch_block->initial_definitions(); |
| 758 // Parameters. |
| 759 intptr_t i = 0; |
| 760 bool push_emitted = false; |
| 761 const intptr_t num_non_copied_params = flow_graph().num_non_copied_params(); |
| 762 const intptr_t param_base = |
| 763 kParamEndSlotFromFp + num_non_copied_params; |
| 764 for (; i < num_non_copied_params; ++i) { |
| 765 if ((*idefs)[i]->IsConstant()) continue; // Common constants |
| 766 Location loc = env->LocationAt(i); |
| 767 EmitTrySyncMove((param_base - i) * kWordSize, loc, &push_emitted); |
| 768 } |
| 769 |
| 770 // Process locals. Skip exception_var and stacktrace_var. |
| 771 intptr_t local_base = kFirstLocalSlotFromFp + num_non_copied_params; |
| 772 intptr_t ex_idx = local_base - catch_block->exception_var().index(); |
| 773 intptr_t st_idx = local_base - catch_block->stacktrace_var().index(); |
| 774 for (; i < flow_graph().variable_count(); ++i) { |
| 775 if (i == ex_idx || i == st_idx) continue; |
| 776 if ((*idefs)[i]->IsConstant()) continue; |
| 777 Location loc = env->LocationAt(i); |
| 778 EmitTrySyncMove((local_base - i) * kWordSize, loc, &push_emitted); |
| 779 // Update safepoint bitmap to indicate that the target location |
| 780 // now contains a pointer. |
| 781 instr->locs()->stack_bitmap()->Set(i - num_non_copied_params, true); |
| 782 } |
| 783 if (push_emitted) { |
| 784 __ Pop(R0); |
| 785 } |
| 786 } |
| 787 |
| 788 |
721 void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) { | 789 void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) { |
722 if (is_optimizing()) return; | 790 if (is_optimizing()) return; |
723 Definition* defn = instr->AsDefinition(); | 791 Definition* defn = instr->AsDefinition(); |
724 if ((defn != NULL) && defn->is_used()) { | 792 if ((defn != NULL) && defn->is_used()) { |
725 __ Push(defn->locs()->out().reg()); | 793 __ Push(defn->locs()->out().reg()); |
726 } | 794 } |
727 } | 795 } |
728 | 796 |
729 | 797 |
730 // Input parameters: | 798 // Input parameters: |
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1817 DRegister dreg = EvenDRegisterOf(reg); | 1885 DRegister dreg = EvenDRegisterOf(reg); |
1818 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); | 1886 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); |
1819 } | 1887 } |
1820 | 1888 |
1821 | 1889 |
1822 #undef __ | 1890 #undef __ |
1823 | 1891 |
1824 } // namespace dart | 1892 } // namespace dart |
1825 | 1893 |
1826 #endif // defined TARGET_ARCH_ARM | 1894 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |