| 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/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 ASSERT(result == R0); | 80 ASSERT(result == R0); |
| 81 #if defined(DEBUG) | 81 #if defined(DEBUG) |
| 82 // TODO(srdjan): Fix for functions with finally clause. | 82 // TODO(srdjan): Fix for functions with finally clause. |
| 83 // A finally clause may leave a previously pushed return value if it | 83 // A finally clause may leave a previously pushed return value if it |
| 84 // has its own return instruction. Method that have finally are currently | 84 // has its own return instruction. Method that have finally are currently |
| 85 // not optimized. | 85 // not optimized. |
| 86 if (!compiler->HasFinally()) { | 86 if (!compiler->HasFinally()) { |
| 87 Label stack_ok; | 87 Label stack_ok; |
| 88 __ Comment("Stack Check"); | 88 __ Comment("Stack Check"); |
| 89 const intptr_t fp_sp_dist = | 89 const intptr_t fp_sp_dist = |
| 90 (kFirstLocalSlotIndex + 1 - compiler->StackSize()) * kWordSize; | 90 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
| 91 ASSERT(fp_sp_dist <= 0); | 91 ASSERT(fp_sp_dist <= 0); |
| 92 __ sub(R2, SP, ShifterOperand(FP)); | 92 __ sub(R2, SP, ShifterOperand(FP)); |
| 93 __ CompareImmediate(R2, fp_sp_dist); | 93 __ CompareImmediate(R2, fp_sp_dist); |
| 94 __ b(&stack_ok, EQ); | 94 __ b(&stack_ok, EQ); |
| 95 __ bkpt(0); | 95 __ bkpt(0); |
| 96 __ Bind(&stack_ok); | 96 __ Bind(&stack_ok); |
| 97 } | 97 } |
| 98 #endif | 98 #endif |
| 99 __ LeaveDartFrame(); | 99 __ LeaveDartFrame(); |
| 100 __ Ret(); | 100 __ Ret(); |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 793 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 794 ASSERT(locs()->temp(0).reg() == R1); | 794 ASSERT(locs()->temp(0).reg() == R1); |
| 795 ASSERT(locs()->temp(1).reg() == R2); | 795 ASSERT(locs()->temp(1).reg() == R2); |
| 796 ASSERT(locs()->temp(2).reg() == R5); | 796 ASSERT(locs()->temp(2).reg() == R5); |
| 797 Register result = locs()->out().reg(); | 797 Register result = locs()->out().reg(); |
| 798 | 798 |
| 799 // Push the result place holder initialized to NULL. | 799 // Push the result place holder initialized to NULL. |
| 800 __ PushObject(Object::ZoneHandle()); | 800 __ PushObject(Object::ZoneHandle()); |
| 801 // Pass a pointer to the first argument in R2. | 801 // Pass a pointer to the first argument in R2. |
| 802 if (!function().HasOptionalParameters()) { | 802 if (!function().HasOptionalParameters()) { |
| 803 __ AddImmediate(R2, FP, (kLastParamSlotIndex + | 803 __ AddImmediate(R2, FP, (kParamEndSlotFromFp + |
| 804 function().NumParameters() - 1) * kWordSize); | 804 function().NumParameters()) * kWordSize); |
| 805 } else { | 805 } else { |
| 806 __ AddImmediate(R2, FP, kFirstLocalSlotIndex * kWordSize); | 806 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize); |
| 807 } | 807 } |
| 808 // Compute the effective address. When running under the simulator, | 808 // Compute the effective address. When running under the simulator, |
| 809 // this is a redirection address that forces the simulator to call | 809 // this is a redirection address that forces the simulator to call |
| 810 // into the runtime system. | 810 // into the runtime system. |
| 811 uword entry = reinterpret_cast<uword>(native_c_function()); | 811 uword entry = reinterpret_cast<uword>(native_c_function()); |
| 812 #if defined(USING_SIMULATOR) | 812 #if defined(USING_SIMULATOR) |
| 813 entry = Simulator::RedirectExternalReference(entry, Simulator::kNativeCall); | 813 entry = Simulator::RedirectExternalReference(entry, Simulator::kNativeCall); |
| 814 #endif | 814 #endif |
| 815 __ LoadImmediate(R5, entry); | 815 __ LoadImmediate(R5, entry); |
| 816 __ LoadImmediate(R1, NativeArguments::ComputeArgcTag(function())); | 816 __ LoadImmediate(R1, NativeArguments::ComputeArgcTag(function())); |
| (...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1721 LocationSummary::kNoCall); | 1721 LocationSummary::kNoCall); |
| 1722 } | 1722 } |
| 1723 | 1723 |
| 1724 | 1724 |
| 1725 // Restore stack and initialize the two exception variables: | 1725 // Restore stack and initialize the two exception variables: |
| 1726 // exception and stack trace variables. | 1726 // exception and stack trace variables. |
| 1727 void CatchEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1727 void CatchEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1728 // Restore SP from FP as we are coming from a throw and the code for | 1728 // Restore SP from FP as we are coming from a throw and the code for |
| 1729 // popping arguments has not been run. | 1729 // popping arguments has not been run. |
| 1730 const intptr_t fp_sp_dist = | 1730 const intptr_t fp_sp_dist = |
| 1731 (kFirstLocalSlotIndex + 1 - compiler->StackSize()) * kWordSize; | 1731 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
| 1732 ASSERT(fp_sp_dist <= 0); | 1732 ASSERT(fp_sp_dist <= 0); |
| 1733 __ AddImmediate(SP, FP, fp_sp_dist); | 1733 __ AddImmediate(SP, FP, fp_sp_dist); |
| 1734 | 1734 |
| 1735 ASSERT(!exception_var().is_captured()); | 1735 ASSERT(!exception_var().is_captured()); |
| 1736 ASSERT(!stacktrace_var().is_captured()); | 1736 ASSERT(!stacktrace_var().is_captured()); |
| 1737 __ StoreToOffset(kStoreWord, kExceptionObjectReg, | 1737 __ StoreToOffset(kStoreWord, kExceptionObjectReg, |
| 1738 FP, exception_var().index() * kWordSize); | 1738 FP, exception_var().index() * kWordSize); |
| 1739 __ StoreToOffset(kStoreWord, kStackTraceObjectReg, | 1739 __ StoreToOffset(kStoreWord, kStackTraceObjectReg, |
| 1740 FP, stacktrace_var().index() * kWordSize); | 1740 FP, stacktrace_var().index() * kWordSize); |
| 1741 | 1741 |
| (...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2793 compiler->GenerateCall(token_pos(), | 2793 compiler->GenerateCall(token_pos(), |
| 2794 &label, | 2794 &label, |
| 2795 PcDescriptors::kOther, | 2795 PcDescriptors::kOther, |
| 2796 locs()); | 2796 locs()); |
| 2797 __ Drop(2); // Discard type arguments and receiver. | 2797 __ Drop(2); // Discard type arguments and receiver. |
| 2798 } | 2798 } |
| 2799 | 2799 |
| 2800 } // namespace dart | 2800 } // namespace dart |
| 2801 | 2801 |
| 2802 #endif // defined TARGET_ARCH_ARM | 2802 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |