Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(497)

Side by Side Diff: runtime/vm/intermediate_language_arm64.cc

Issue 2796283003: VM: [Kernel] Implement CatchBlockEntryInstr::should_restore_closure_context on all platforms. (Closed)
Patch Set: Address Zach's comment Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_dbc.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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 2599 matching lines...) Expand 10 before | Expand all | Expand 10 after
2610 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 2610 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
2611 } 2611 }
2612 2612
2613 // Restore SP from FP as we are coming from a throw and the code for 2613 // Restore SP from FP as we are coming from a throw and the code for
2614 // popping arguments has not been run. 2614 // popping arguments has not been run.
2615 const intptr_t fp_sp_dist = 2615 const intptr_t fp_sp_dist =
2616 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; 2616 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize;
2617 ASSERT(fp_sp_dist <= 0); 2617 ASSERT(fp_sp_dist <= 0);
2618 __ AddImmediate(SP, FP, fp_sp_dist); 2618 __ AddImmediate(SP, FP, fp_sp_dist);
2619 2619
2620 // Restore stack and initialize the two exception variables: 2620 // Auxiliary variables introduced by the try catch can be captured if we are
2621 // exception and stack trace variables. 2621 // inside a function with yield/resume points. In this case we first need
2622 __ StoreToOffset(kExceptionObjectReg, FP, 2622 // to restore the context to match the context at entry into the closure.
2623 exception_var().index() * kWordSize); 2623 if (should_restore_closure_context()) {
2624 __ StoreToOffset(kStackTraceObjectReg, FP, 2624 const ParsedFunction& parsed_function = compiler->parsed_function();
2625 stacktrace_var().index() * kWordSize); 2625 ASSERT(parsed_function.function().IsClosureFunction());
2626 LocalScope* scope = parsed_function.node_sequence()->scope();
2627
2628 LocalVariable* closure_parameter = scope->VariableAt(0);
2629 ASSERT(!closure_parameter->is_captured());
2630 __ LoadFromOffset(CTX, FP, closure_parameter->index() * kWordSize);
2631 __ LoadFieldFromOffset(CTX, CTX, Closure::context_offset());
2632
2633 const intptr_t context_index =
2634 parsed_function.current_context_var()->index();
2635 __ StoreToOffset(CTX, FP, context_index * kWordSize);
2636 }
2637
2638 // Initialize exception and stack trace variables.
2639 if (exception_var().is_captured()) {
2640 ASSERT(stacktrace_var().is_captured());
2641 __ StoreIntoObjectOffset(CTX,
2642 Context::variable_offset(exception_var().index()),
2643 kExceptionObjectReg);
2644 __ StoreIntoObjectOffset(CTX,
2645 Context::variable_offset(stacktrace_var().index()),
2646 kStackTraceObjectReg);
2647 } else {
2648 // Restore stack and initialize the two exception variables:
2649 // exception and stack trace variables.
2650 __ StoreToOffset(kExceptionObjectReg, FP,
2651 exception_var().index() * kWordSize);
2652 __ StoreToOffset(kStackTraceObjectReg, FP,
2653 stacktrace_var().index() * kWordSize);
2654 }
2626 } 2655 }
2627 2656
2628 2657
2629 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone, 2658 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone,
2630 bool opt) const { 2659 bool opt) const {
2631 const intptr_t kNumInputs = 0; 2660 const intptr_t kNumInputs = 0;
2632 const intptr_t kNumTemps = 1; 2661 const intptr_t kNumTemps = 1;
2633 LocationSummary* summary = new (zone) LocationSummary( 2662 LocationSummary* summary = new (zone) LocationSummary(
2634 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); 2663 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath);
2635 summary->set_temp(0, Location::RequiresRegister()); 2664 summary->set_temp(0, Location::RequiresRegister());
(...skipping 3414 matching lines...) Expand 10 before | Expand all | Expand 10 after
6050 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(), 6079 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(),
6051 kGrowRegExpStackRuntimeEntry, 1, locs()); 6080 kGrowRegExpStackRuntimeEntry, 1, locs());
6052 __ Drop(1); 6081 __ Drop(1);
6053 __ Pop(result); 6082 __ Pop(result);
6054 } 6083 }
6055 6084
6056 6085
6057 } // namespace dart 6086 } // namespace dart
6058 6087
6059 #endif // defined TARGET_ARCH_ARM64 6088 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_dbc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698