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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 #if defined(DEBUG) | 83 #if defined(DEBUG) |
84 // TODO(srdjan): Fix for functions with finally clause. | 84 // TODO(srdjan): Fix for functions with finally clause. |
85 // A finally clause may leave a previously pushed return value if it | 85 // A finally clause may leave a previously pushed return value if it |
86 // has its own return instruction. Method that have finally are currently | 86 // has its own return instruction. Method that have finally are currently |
87 // not optimized. | 87 // not optimized. |
88 if (!compiler->HasFinally()) { | 88 if (!compiler->HasFinally()) { |
89 Label stack_ok; | 89 Label stack_ok; |
90 __ Comment("Stack Check"); | 90 __ Comment("Stack Check"); |
91 __ TraceSimMsg("Stack Check"); | 91 __ TraceSimMsg("Stack Check"); |
92 const intptr_t fp_sp_dist = | 92 const intptr_t fp_sp_dist = |
93 (kFirstLocalSlotIndex + 1 - compiler->StackSize()) * kWordSize; | 93 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
94 ASSERT(fp_sp_dist <= 0); | 94 ASSERT(fp_sp_dist <= 0); |
95 __ subu(T2, SP, FP); | 95 __ subu(T2, SP, FP); |
96 | 96 |
97 __ BranchEqual(T2, fp_sp_dist, &stack_ok); | 97 __ BranchEqual(T2, fp_sp_dist, &stack_ok); |
98 __ break_(0); | 98 __ break_(0); |
99 | 99 |
100 __ Bind(&stack_ok); | 100 __ Bind(&stack_ok); |
101 } | 101 } |
102 #endif | 102 #endif |
103 // This sequence is patched by a debugger breakpoint. There is no need for | 103 // This sequence is patched by a debugger breakpoint. There is no need for |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 __ TraceSimMsg("NativeCallInstr"); | 807 __ TraceSimMsg("NativeCallInstr"); |
808 ASSERT(locs()->temp(0).reg() == A1); | 808 ASSERT(locs()->temp(0).reg() == A1); |
809 ASSERT(locs()->temp(1).reg() == A2); | 809 ASSERT(locs()->temp(1).reg() == A2); |
810 ASSERT(locs()->temp(2).reg() == T5); | 810 ASSERT(locs()->temp(2).reg() == T5); |
811 Register result = locs()->out().reg(); | 811 Register result = locs()->out().reg(); |
812 | 812 |
813 // Push the result place holder initialized to NULL. | 813 // Push the result place holder initialized to NULL. |
814 __ PushObject(Object::ZoneHandle()); | 814 __ PushObject(Object::ZoneHandle()); |
815 // Pass a pointer to the first argument in A2. | 815 // Pass a pointer to the first argument in A2. |
816 if (!function().HasOptionalParameters()) { | 816 if (!function().HasOptionalParameters()) { |
817 __ AddImmediate(A2, FP, (kLastParamSlotIndex + | 817 __ AddImmediate(A2, FP, (kParamEndSlotFromFp + |
818 function().NumParameters() - 1) * kWordSize); | 818 function().NumParameters()) * kWordSize); |
819 } else { | 819 } else { |
820 __ AddImmediate(A2, FP, kFirstLocalSlotIndex * kWordSize); | 820 __ AddImmediate(A2, FP, kFirstLocalSlotFromFp * kWordSize); |
821 } | 821 } |
822 // Compute the effective address. When running under the simulator, | 822 // Compute the effective address. When running under the simulator, |
823 // this is a redirection address that forces the simulator to call | 823 // this is a redirection address that forces the simulator to call |
824 // into the runtime system. | 824 // into the runtime system. |
825 uword entry = reinterpret_cast<uword>(native_c_function()); | 825 uword entry = reinterpret_cast<uword>(native_c_function()); |
826 #if defined(USING_SIMULATOR) | 826 #if defined(USING_SIMULATOR) |
827 entry = Simulator::RedirectExternalReference(entry, Simulator::kNativeCall); | 827 entry = Simulator::RedirectExternalReference(entry, Simulator::kNativeCall); |
828 #endif | 828 #endif |
829 __ LoadImmediate(T5, entry); | 829 __ LoadImmediate(T5, entry); |
830 __ LoadImmediate(A1, NativeArguments::ComputeArgcTag(function())); | 830 __ LoadImmediate(A1, NativeArguments::ComputeArgcTag(function())); |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1669 LocationSummary::kNoCall); | 1669 LocationSummary::kNoCall); |
1670 } | 1670 } |
1671 | 1671 |
1672 | 1672 |
1673 // Restore stack and initialize the two exception variables: | 1673 // Restore stack and initialize the two exception variables: |
1674 // exception and stack trace variables. | 1674 // exception and stack trace variables. |
1675 void CatchEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1675 void CatchEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1676 // Restore SP from FP as we are coming from a throw and the code for | 1676 // Restore SP from FP as we are coming from a throw and the code for |
1677 // popping arguments has not been run. | 1677 // popping arguments has not been run. |
1678 const intptr_t fp_sp_dist = | 1678 const intptr_t fp_sp_dist = |
1679 (kFirstLocalSlotIndex + 1 - compiler->StackSize()) * kWordSize; | 1679 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
1680 ASSERT(fp_sp_dist <= 0); | 1680 ASSERT(fp_sp_dist <= 0); |
1681 __ AddImmediate(SP, FP, fp_sp_dist); | 1681 __ AddImmediate(SP, FP, fp_sp_dist); |
1682 | 1682 |
1683 ASSERT(!exception_var().is_captured()); | 1683 ASSERT(!exception_var().is_captured()); |
1684 ASSERT(!stacktrace_var().is_captured()); | 1684 ASSERT(!stacktrace_var().is_captured()); |
1685 | 1685 |
1686 __ sw(kExceptionObjectReg, | 1686 __ sw(kExceptionObjectReg, |
1687 Address(FP, exception_var().index() * kWordSize)); | 1687 Address(FP, exception_var().index() * kWordSize)); |
1688 __ sw(kStackTraceObjectReg, | 1688 __ sw(kStackTraceObjectReg, |
1689 Address(FP, stacktrace_var().index() * kWordSize)); | 1689 Address(FP, stacktrace_var().index() * kWordSize)); |
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2824 compiler->GenerateCall(token_pos(), | 2824 compiler->GenerateCall(token_pos(), |
2825 &label, | 2825 &label, |
2826 PcDescriptors::kOther, | 2826 PcDescriptors::kOther, |
2827 locs()); | 2827 locs()); |
2828 __ Drop(2); // Discard type arguments and receiver. | 2828 __ Drop(2); // Discard type arguments and receiver. |
2829 } | 2829 } |
2830 | 2830 |
2831 } // namespace dart | 2831 } // namespace dart |
2832 | 2832 |
2833 #endif // defined TARGET_ARCH_MIPS | 2833 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |