| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/code_generator.h" | 8 #include "vm/code_generator.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 2564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2575 | 2575 |
| 2576 void CodeGenerator::VisitCatchClauseNode(CatchClauseNode* node) { | 2576 void CodeGenerator::VisitCatchClauseNode(CatchClauseNode* node) { |
| 2577 // NOTE: The implicit variables ':saved_context', ':exception_var' | 2577 // NOTE: The implicit variables ':saved_context', ':exception_var' |
| 2578 // and ':stacktrace_var' can never be captured variables. | 2578 // and ':stacktrace_var' can never be captured variables. |
| 2579 // Restore CTX from local variable ':saved_context'. | 2579 // Restore CTX from local variable ':saved_context'. |
| 2580 GenerateLoadVariable(CTX, node->context_var()); | 2580 GenerateLoadVariable(CTX, node->context_var()); |
| 2581 | 2581 |
| 2582 // Restore RSP from RBP as we are coming from a throw and the code for | 2582 // Restore RSP from RBP as we are coming from a throw and the code for |
| 2583 // popping arguments has not been run. | 2583 // popping arguments has not been run. |
| 2584 ASSERT(locals_space_size() >= 0); | 2584 ASSERT(locals_space_size() >= 0); |
| 2585 __ movq(RSP, RBP); | 2585 if (locals_space_size() == 0) { |
| 2586 __ subq(RSP, Immediate(locals_space_size())); | 2586 __ movq(RSP, RBP); |
| 2587 } else { |
| 2588 __ leaq(RSP, Address(RBP, -locals_space_size())); |
| 2589 } |
| 2587 | 2590 |
| 2588 // The JumpToExceptionHandler trampoline code sets up | 2591 // The JumpToExceptionHandler trampoline code sets up |
| 2589 // - the exception object in RAX (kExceptionObjectReg) | 2592 // - the exception object in RAX (kExceptionObjectReg) |
| 2590 // - the stacktrace object in register RDX (kStackTraceObjectReg) | 2593 // - the stacktrace object in register RDX (kStackTraceObjectReg) |
| 2591 // We now setup the exception object and the trace object | 2594 // We now setup the exception object and the trace object |
| 2592 // so that the handler code has access to these objects. | 2595 // so that the handler code has access to these objects. |
| 2593 GenerateStoreVariable(node->exception_var(), | 2596 GenerateStoreVariable(node->exception_var(), |
| 2594 kExceptionObjectReg, | 2597 kExceptionObjectReg, |
| 2595 kNoRegister); | 2598 kNoRegister); |
| 2596 GenerateStoreVariable(node->stacktrace_var(), | 2599 GenerateStoreVariable(node->stacktrace_var(), |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2728 const Error& error = Error::Handle( | 2731 const Error& error = Error::Handle( |
| 2729 Parser::FormatError(script, token_index, "Error", format, args)); | 2732 Parser::FormatError(script, token_index, "Error", format, args)); |
| 2730 va_end(args); | 2733 va_end(args); |
| 2731 Isolate::Current()->long_jump_base()->Jump(1, error); | 2734 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2732 UNREACHABLE(); | 2735 UNREACHABLE(); |
| 2733 } | 2736 } |
| 2734 | 2737 |
| 2735 } // namespace dart | 2738 } // namespace dart |
| 2736 | 2739 |
| 2737 #endif // defined TARGET_ARCH_X64 | 2740 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |