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 "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 2846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2857 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 2857 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
2858 } | 2858 } |
2859 | 2859 |
2860 // Restore SP from FP as we are coming from a throw and the code for | 2860 // Restore SP from FP as we are coming from a throw and the code for |
2861 // popping arguments has not been run. | 2861 // popping arguments has not been run. |
2862 const intptr_t fp_sp_dist = | 2862 const intptr_t fp_sp_dist = |
2863 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; | 2863 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
2864 ASSERT(fp_sp_dist <= 0); | 2864 ASSERT(fp_sp_dist <= 0); |
2865 __ AddImmediate(SP, FP, fp_sp_dist); | 2865 __ AddImmediate(SP, FP, fp_sp_dist); |
2866 | 2866 |
2867 // Restore stack and initialize the two exception variables: | 2867 // Auxiliary variables introduced by the try catch can be captured if we are |
2868 // exception and stack trace variables. | 2868 // inside a function with yield/resume points. In this case we first need |
2869 __ StoreToOffset(kWord, kExceptionObjectReg, | 2869 // to restore the context to match the context at entry into the closure. |
2870 FP, exception_var().index() * kWordSize); | 2870 if (should_restore_closure_context()) { |
2871 __ StoreToOffset(kWord, kStackTraceObjectReg, | 2871 const ParsedFunction& parsed_function = compiler->parsed_function(); |
2872 FP, stacktrace_var().index() * kWordSize); | 2872 ASSERT(parsed_function.function().IsClosureFunction()); |
| 2873 LocalScope* scope = parsed_function.node_sequence()->scope(); |
| 2874 |
| 2875 LocalVariable* closure_parameter = scope->VariableAt(0); |
| 2876 ASSERT(!closure_parameter->is_captured()); |
| 2877 __ ldr(CTX, Address(FP, closure_parameter->index() * kWordSize)); |
| 2878 __ ldr(CTX, FieldAddress(CTX, Closure::context_offset())); |
| 2879 |
| 2880 const intptr_t context_index = |
| 2881 parsed_function.current_context_var()->index(); |
| 2882 __ StoreToOffset(kWord, CTX, FP, context_index * kWordSize); |
| 2883 } |
| 2884 |
| 2885 // Initialize exception and stack trace variables. |
| 2886 if (exception_var().is_captured()) { |
| 2887 ASSERT(stacktrace_var().is_captured()); |
| 2888 __ StoreIntoObjectOffset(CTX, |
| 2889 Context::variable_offset(exception_var().index()), |
| 2890 kExceptionObjectReg); |
| 2891 __ StoreIntoObjectOffset(CTX, |
| 2892 Context::variable_offset(stacktrace_var().index()), |
| 2893 kStackTraceObjectReg); |
| 2894 } else { |
| 2895 __ StoreToOffset(kWord, kExceptionObjectReg, |
| 2896 FP, exception_var().index() * kWordSize); |
| 2897 __ StoreToOffset(kWord, kStackTraceObjectReg, |
| 2898 FP, stacktrace_var().index() * kWordSize); |
| 2899 } |
2873 } | 2900 } |
2874 | 2901 |
2875 | 2902 |
2876 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone, | 2903 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone, |
2877 bool opt) const { | 2904 bool opt) const { |
2878 const intptr_t kNumInputs = 0; | 2905 const intptr_t kNumInputs = 0; |
2879 const intptr_t kNumTemps = 1; | 2906 const intptr_t kNumTemps = 1; |
2880 LocationSummary* summary = new(zone) LocationSummary( | 2907 LocationSummary* summary = new(zone) LocationSummary( |
2881 zone, kNumInputs, | 2908 zone, kNumInputs, |
2882 kNumTemps, | 2909 kNumTemps, |
(...skipping 4110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6993 1, | 7020 1, |
6994 locs()); | 7021 locs()); |
6995 __ Drop(1); | 7022 __ Drop(1); |
6996 __ Pop(result); | 7023 __ Pop(result); |
6997 } | 7024 } |
6998 | 7025 |
6999 | 7026 |
7000 } // namespace dart | 7027 } // namespace dart |
7001 | 7028 |
7002 #endif // defined TARGET_ARCH_ARM | 7029 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |