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

Side by Side Diff: runtime/vm/intermediate_language_ia32.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_dbc.cc ('k') | runtime/vm/intermediate_language_mips.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) 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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 2519 matching lines...) Expand 10 before | Expand all | Expand 10 after
2530 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 2530 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
2531 } 2531 }
2532 2532
2533 // Restore ESP from EBP as we are coming from a throw and the code for 2533 // Restore ESP from EBP as we are coming from a throw and the code for
2534 // popping arguments has not been run. 2534 // popping arguments has not been run.
2535 const intptr_t fp_sp_dist = 2535 const intptr_t fp_sp_dist =
2536 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; 2536 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize;
2537 ASSERT(fp_sp_dist <= 0); 2537 ASSERT(fp_sp_dist <= 0);
2538 __ leal(ESP, Address(EBP, fp_sp_dist)); 2538 __ leal(ESP, Address(EBP, fp_sp_dist));
2539 2539
2540 // Restore stack and initialize the two exception variables: 2540 // Auxiliary variables introduced by the try catch can be captured if we are
2541 // exception and stack trace variables. 2541 // inside a function with yield/resume points. In this case we first need
2542 __ movl(Address(EBP, exception_var().index() * kWordSize), 2542 // to restore the context to match the context at entry into the closure.
2543 kExceptionObjectReg); 2543 if (should_restore_closure_context()) {
2544 __ movl(Address(EBP, stacktrace_var().index() * kWordSize), 2544 const ParsedFunction& parsed_function = compiler->parsed_function();
2545 kStackTraceObjectReg); 2545 ASSERT(parsed_function.function().IsClosureFunction());
2546 LocalScope* scope = parsed_function.node_sequence()->scope();
2547
2548 LocalVariable* closure_parameter = scope->VariableAt(0);
2549 ASSERT(!closure_parameter->is_captured());
2550 __ movl(CTX, Address(EBP, closure_parameter->index() * kWordSize));
2551 __ movl(CTX, FieldAddress(CTX, Closure::context_offset()));
2552
2553 #ifdef DEBUG
2554 Label ok;
2555 __ LoadClassId(EBX, CTX);
2556 __ cmpl(EBX, Immediate(kContextCid));
2557 __ j(EQUAL, &ok, Assembler::kNearJump);
2558 __ Stop("Incorrect context at entry");
2559 __ Bind(&ok);
2560 #endif
2561
2562 const intptr_t context_index =
2563 parsed_function.current_context_var()->index();
2564 __ movl(Address(EBP, context_index * kWordSize), CTX);
2565 }
2566
2567 // Initialize exception and stack trace variables.
2568 if (exception_var().is_captured()) {
2569 ASSERT(stacktrace_var().is_captured());
2570 __ StoreIntoObject(
2571 CTX,
2572 FieldAddress(CTX, Context::variable_offset(exception_var().index())),
2573 kExceptionObjectReg);
2574 __ StoreIntoObject(
2575 CTX,
2576 FieldAddress(CTX, Context::variable_offset(stacktrace_var().index())),
2577 kStackTraceObjectReg);
2578 } else {
2579 // Restore stack and initialize the two exception variables:
2580 // exception and stack trace variables.
2581 __ movl(Address(EBP, exception_var().index() * kWordSize),
2582 kExceptionObjectReg);
2583 __ movl(Address(EBP, stacktrace_var().index() * kWordSize),
2584 kStackTraceObjectReg);
2585 }
2546 } 2586 }
2547 2587
2548 2588
2549 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone, 2589 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone,
2550 bool opt) const { 2590 bool opt) const {
2551 const intptr_t kNumInputs = 0; 2591 const intptr_t kNumInputs = 0;
2552 const intptr_t kNumTemps = opt ? 0 : 1; 2592 const intptr_t kNumTemps = opt ? 0 : 1;
2553 LocationSummary* summary = new (zone) LocationSummary( 2593 LocationSummary* summary = new (zone) LocationSummary(
2554 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); 2594 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath);
2555 if (!opt) { 2595 if (!opt) {
(...skipping 4334 matching lines...) Expand 10 before | Expand all | Expand 10 after
6890 __ Drop(1); 6930 __ Drop(1);
6891 __ popl(result); 6931 __ popl(result);
6892 } 6932 }
6893 6933
6894 6934
6895 } // namespace dart 6935 } // namespace dart
6896 6936
6897 #undef __ 6937 #undef __
6898 6938
6899 #endif // defined TARGET_ARCH_IA32 6939 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_dbc.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698