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

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

Issue 2411823003: VM support for running Kernel binaries. (Closed)
Patch Set: Address comments Created 4 years, 2 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/kernel.h » ('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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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 2573 matching lines...) Expand 10 before | Expand all | Expand 10 after
2584 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 2584 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
2585 } 2585 }
2586 2586
2587 // Restore RSP from RBP as we are coming from a throw and the code for 2587 // Restore RSP from RBP as we are coming from a throw and the code for
2588 // popping arguments has not been run. 2588 // popping arguments has not been run.
2589 const intptr_t fp_sp_dist = 2589 const intptr_t fp_sp_dist =
2590 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; 2590 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize;
2591 ASSERT(fp_sp_dist <= 0); 2591 ASSERT(fp_sp_dist <= 0);
2592 __ leaq(RSP, Address(RBP, fp_sp_dist)); 2592 __ leaq(RSP, Address(RBP, fp_sp_dist));
2593 2593
2594 // Restore stack and initialize the two exception variables: 2594 // Auxiliary variables introduced by the try catch can be captured if we are
2595 // exception and stack trace variables. 2595 // inside a function with yield/resume points. In this case we first need
2596 __ movq(Address(RBP, exception_var().index() * kWordSize), 2596 // to restore the context to match the context at entry into the closure.
2597 kExceptionObjectReg); 2597 if (should_restore_closure_context()) {
2598 __ movq(Address(RBP, stacktrace_var().index() * kWordSize), 2598 const ParsedFunction& parsed_function = compiler->parsed_function();
2599 kStackTraceObjectReg); 2599 ASSERT(parsed_function.function().IsClosureFunction());
2600 LocalScope* scope = parsed_function.node_sequence()->scope();
2601
2602 LocalVariable* closure_parameter = scope->VariableAt(0);
2603 ASSERT(!closure_parameter->is_captured());
2604 __ movq(CTX, Address(RBP, closure_parameter->index() * kWordSize));
2605 __ movq(CTX, FieldAddress(CTX, Closure::context_offset()));
2606
2607 #ifdef DEBUG
2608 Label ok;
2609 __ LoadClassId(RBX, CTX);
2610 __ cmpq(RBX, Immediate(kContextCid));
2611 __ j(EQUAL, &ok, Assembler::kNearJump);
2612 __ Stop("Incorrect context at entry");
2613 __ Bind(&ok);
2614 #endif
2615
2616 const intptr_t context_index =
2617 parsed_function.current_context_var()->index();
2618 __ movq(Address(RBP, context_index * kWordSize), CTX);
2619 }
2620
2621 // Initialize exception and stack trace variables.
2622 if (exception_var().is_captured()) {
2623 ASSERT(stacktrace_var().is_captured());
2624 __ StoreIntoObject(
2625 CTX,
2626 FieldAddress(CTX, Context::variable_offset(exception_var().index())),
2627 kExceptionObjectReg);
2628 __ StoreIntoObject(
2629 CTX,
2630 FieldAddress(CTX, Context::variable_offset(stacktrace_var().index())),
2631 kStackTraceObjectReg);
2632 } else {
2633 __ movq(Address(RBP, exception_var().index() * kWordSize),
2634 kExceptionObjectReg);
2635 __ movq(Address(RBP, stacktrace_var().index() * kWordSize),
2636 kStackTraceObjectReg);
2637 }
2600 } 2638 }
2601 2639
2602 2640
2603 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone, 2641 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone,
2604 bool opt) const { 2642 bool opt) const {
2605 const intptr_t kNumInputs = 0; 2643 const intptr_t kNumInputs = 0;
2606 const intptr_t kNumTemps = 1; 2644 const intptr_t kNumTemps = 1;
2607 LocationSummary* summary = new(zone) LocationSummary( 2645 LocationSummary* summary = new(zone) LocationSummary(
2608 zone, kNumInputs, 2646 zone, kNumInputs,
2609 kNumTemps, 2647 kNumTemps,
(...skipping 3989 matching lines...) Expand 10 before | Expand all | Expand 10 after
6599 __ Drop(1); 6637 __ Drop(1);
6600 __ popq(result); 6638 __ popq(result);
6601 } 6639 }
6602 6640
6603 6641
6604 } // namespace dart 6642 } // namespace dart
6605 6643
6606 #undef __ 6644 #undef __
6607 6645
6608 #endif // defined TARGET_ARCH_X64 6646 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/kernel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698