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 "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 2735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2746 if (HasParallelMove()) { | 2746 if (HasParallelMove()) { |
2747 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 2747 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
2748 } | 2748 } |
2749 // Restore SP from FP as we are coming from a throw and the code for | 2749 // Restore SP from FP as we are coming from a throw and the code for |
2750 // popping arguments has not been run. | 2750 // popping arguments has not been run. |
2751 const intptr_t fp_sp_dist = | 2751 const intptr_t fp_sp_dist = |
2752 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; | 2752 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
2753 ASSERT(fp_sp_dist <= 0); | 2753 ASSERT(fp_sp_dist <= 0); |
2754 __ AddImmediate(SP, FP, fp_sp_dist); | 2754 __ AddImmediate(SP, FP, fp_sp_dist); |
2755 | 2755 |
2756 // Restore stack and initialize the two exception variables: | 2756 // Auxiliary variables introduced by the try catch can be captured if we are |
2757 // exception and stack trace variables. | 2757 // inside a function with yield/resume points. In this case we first need |
2758 __ StoreToOffset(kExceptionObjectReg, FP, | 2758 // to restore the context to match the context at entry into the closure. |
2759 exception_var().index() * kWordSize); | 2759 if (should_restore_closure_context()) { |
2760 __ StoreToOffset(kStackTraceObjectReg, FP, | 2760 const ParsedFunction& parsed_function = compiler->parsed_function(); |
2761 stacktrace_var().index() * kWordSize); | 2761 ASSERT(parsed_function.function().IsClosureFunction()); |
| 2762 LocalScope* scope = parsed_function.node_sequence()->scope(); |
| 2763 |
| 2764 LocalVariable* closure_parameter = scope->VariableAt(0); |
| 2765 ASSERT(!closure_parameter->is_captured()); |
| 2766 __ LoadFromOffset(CTX, FP, closure_parameter->index() * kWordSize); |
| 2767 __ LoadFieldFromOffset(CTX, CTX, Closure::context_offset()); |
| 2768 |
| 2769 const intptr_t context_index = |
| 2770 parsed_function.current_context_var()->index(); |
| 2771 __ StoreToOffset(CTX, FP, context_index * kWordSize); |
| 2772 } |
| 2773 |
| 2774 // Initialize exception and stack trace variables. |
| 2775 if (exception_var().is_captured()) { |
| 2776 ASSERT(stacktrace_var().is_captured()); |
| 2777 __ StoreIntoObjectOffset(CTX, |
| 2778 Context::variable_offset(exception_var().index()), |
| 2779 kExceptionObjectReg); |
| 2780 __ StoreIntoObjectOffset(CTX, |
| 2781 Context::variable_offset(stacktrace_var().index()), |
| 2782 kStackTraceObjectReg); |
| 2783 } else { |
| 2784 // Restore stack and initialize the two exception variables: |
| 2785 // exception and stack trace variables. |
| 2786 __ StoreToOffset(kExceptionObjectReg, FP, |
| 2787 exception_var().index() * kWordSize); |
| 2788 __ StoreToOffset(kStackTraceObjectReg, FP, |
| 2789 stacktrace_var().index() * kWordSize); |
| 2790 } |
2762 } | 2791 } |
2763 | 2792 |
2764 | 2793 |
2765 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone, | 2794 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone, |
2766 bool opt) const { | 2795 bool opt) const { |
2767 const intptr_t kNumInputs = 0; | 2796 const intptr_t kNumInputs = 0; |
2768 const intptr_t kNumTemps = 1; | 2797 const intptr_t kNumTemps = 1; |
2769 LocationSummary* summary = new (zone) LocationSummary( | 2798 LocationSummary* summary = new (zone) LocationSummary( |
2770 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); | 2799 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); |
2771 summary->set_temp(0, Location::RequiresRegister()); | 2800 summary->set_temp(0, Location::RequiresRegister()); |
(...skipping 3274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6046 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(), | 6075 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(), |
6047 kGrowRegExpStackRuntimeEntry, 1, locs()); | 6076 kGrowRegExpStackRuntimeEntry, 1, locs()); |
6048 __ lw(result, Address(SP, 1 * kWordSize)); | 6077 __ lw(result, Address(SP, 1 * kWordSize)); |
6049 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 6078 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
6050 } | 6079 } |
6051 | 6080 |
6052 | 6081 |
6053 } // namespace dart | 6082 } // namespace dart |
6054 | 6083 |
6055 #endif // defined TARGET_ARCH_MIPS | 6084 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |