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" | 5 #include "vm/globals.h" |
6 | 6 |
7 #if defined(TARGET_ARCH_X64) | 7 #if defined(TARGET_ARCH_X64) |
8 | 8 |
9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 : [exception] "m" (exception), | 57 : [exception] "m" (exception), |
58 [stacktrace] "m" (stacktrace), | 58 [stacktrace] "m" (stacktrace), |
59 [pc] "m" (program_counter), | 59 [pc] "m" (program_counter), |
60 [sp] "m" (stack_pointer), | 60 [sp] "m" (stack_pointer), |
61 [fp] "m" (frame_pointer)); | 61 [fp] "m" (frame_pointer)); |
62 #endif | 62 #endif |
63 UNREACHABLE(); | 63 UNREACHABLE(); |
64 } | 64 } |
65 | 65 |
66 | 66 |
67 void CPU::JumpToErrorHandler( | 67 void CPU::JumpToUnhandledExceptionHandler( |
68 uword program_counter, | 68 uword program_counter, |
69 uword stack_pointer, | 69 uword stack_pointer, |
70 uword frame_pointer, | 70 uword frame_pointer, |
71 const Error& error) { | 71 const UnhandledException& unhandled_exception_object) { |
72 // The no_gc StackResource is unwound through the tear down of | 72 // The no_gc StackResource is unwound through the tear down of |
73 // stack resources below. | 73 // stack resources below. |
74 NoGCScope no_gc; | 74 NoGCScope no_gc; |
75 ASSERT(!error.IsNull()); | 75 ASSERT(!unhandled_exception_object.IsNull()); |
76 RawError* raw_error = error.raw(); | 76 RawUnhandledException* unhandled_exception = unhandled_exception_object.raw(); |
77 | 77 |
78 // Prepare for unwinding frames by destroying all the stack resources | 78 // Prepare for unwinding frames by destroying all the stack resources |
79 // in the previous frames. | 79 // in the previous frames. |
80 Isolate* isolate = Isolate::Current(); | 80 Isolate* isolate = Isolate::Current(); |
81 while (isolate->top_resource() != NULL && | 81 while (isolate->top_resource() != NULL && |
82 (reinterpret_cast<uword>(isolate->top_resource()) < stack_pointer)) { | 82 (reinterpret_cast<uword>(isolate->top_resource()) < stack_pointer)) { |
83 isolate->top_resource()->~StackResource(); | 83 isolate->top_resource()->~StackResource(); |
84 } | 84 } |
85 | 85 |
86 // Set up the error object as the return value in RAX and continue | 86 // Set up the unhandled exception object as the return value in RAX |
87 // from the invocation stub. | 87 // and continue from the invocation stub. |
88 #if defined(TARGET_OS_WINDOWS) | 88 #if defined(TARGET_OS_WINDOWS) |
89 UNIMPLEMENTED(); | 89 UNIMPLEMENTED(); |
90 #else | 90 #else |
91 asm volatile("mov %[raw_error], %%rax;" | 91 asm volatile("mov %[unhandled_exception], %%rax;" |
92 "mov %[pc], %%rbx;" | 92 "mov %[pc], %%rbx;" |
93 "mov %[fp], %%rcx;" | 93 "mov %[fp], %%rcx;" |
94 "mov %[sp], %%rdi;" | 94 "mov %[sp], %%rdi;" |
95 "mov %%rcx, %%rbp;" | 95 "mov %%rcx, %%rbp;" |
96 "mov %%rdi, %%rsp;" | 96 "mov %%rdi, %%rsp;" |
97 "jmp *%%rbx;" | 97 "jmp *%%rbx;" |
98 : | 98 : |
99 : [raw_error] "m" (raw_error), | 99 : [unhandled_exception] "m" (unhandled_exception), |
100 [pc] "m" (program_counter), | 100 [pc] "m" (program_counter), |
101 [sp] "m" (stack_pointer), | 101 [sp] "m" (stack_pointer), |
102 [fp] "m" (frame_pointer)); | 102 [fp] "m" (frame_pointer)); |
103 #endif | 103 #endif |
104 UNREACHABLE(); | 104 UNREACHABLE(); |
105 } | 105 } |
106 | 106 |
107 | 107 |
108 const char* CPU::Id() { | 108 const char* CPU::Id() { |
109 return "x64"; | 109 return "x64"; |
110 } | 110 } |
111 | 111 |
112 } // namespace dart | 112 } // namespace dart |
113 | 113 |
114 #endif // defined TARGET_ARCH_X64 | 114 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |