OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/exceptions.h" | 5 #include "vm/exceptions.h" |
6 | 6 |
7 #include "vm/dart_api_impl.h" | 7 #include "vm/dart_api_impl.h" |
8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
9 #include "vm/debugger.h" | 9 #include "vm/debugger.h" |
10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 ASSERT(handler_pc != 0); | 187 ASSERT(handler_pc != 0); |
188 | 188 |
189 // TODO(5411263): At some point we can optimize by figuring out if a | 189 // TODO(5411263): At some point we can optimize by figuring out if a |
190 // stack trace is needed based on whether the catch code specifies a | 190 // stack trace is needed based on whether the catch code specifies a |
191 // stack trace object or there is a rethrow in the catch clause. | 191 // stack trace object or there is a rethrow in the catch clause. |
192 Stacktrace& stacktrace = Stacktrace::Handle(); | 192 Stacktrace& stacktrace = Stacktrace::Handle(); |
193 if (pc_offset_list.Length() != 0) { | 193 if (pc_offset_list.Length() != 0) { |
194 if (existing_stacktrace.IsNull()) { | 194 if (existing_stacktrace.IsNull()) { |
195 stacktrace = Stacktrace::New(func_list, code_list, pc_offset_list); | 195 stacktrace = Stacktrace::New(func_list, code_list, pc_offset_list); |
196 } else { | 196 } else { |
197 stacktrace ^= existing_stacktrace.raw(); | 197 stacktrace |= existing_stacktrace.raw(); |
198 stacktrace.Append(func_list, code_list, pc_offset_list); | 198 stacktrace.Append(func_list, code_list, pc_offset_list); |
199 } | 199 } |
200 } else { | 200 } else { |
201 stacktrace ^= existing_stacktrace.raw(); | 201 stacktrace |= existing_stacktrace.raw(); |
202 } | 202 } |
203 if (FLAG_print_stacktrace_at_throw) { | 203 if (FLAG_print_stacktrace_at_throw) { |
204 OS::Print("Exception '%s' thrown:\n", exception.ToCString()); | 204 OS::Print("Exception '%s' thrown:\n", exception.ToCString()); |
205 OS::Print("%s\n", stacktrace.ToCString()); | 205 OS::Print("%s\n", stacktrace.ToCString()); |
206 } | 206 } |
207 if (handler_exists) { | 207 if (handler_exists) { |
208 // Found a dart handler for the exception, jump to it. | 208 // Found a dart handler for the exception, jump to it. |
209 JumpToExceptionHandler(handler_pc, | 209 JumpToExceptionHandler(handler_pc, |
210 handler_sp, | 210 handler_sp, |
211 handler_fp, | 211 handler_fp, |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 case kIsolateUnhandledException: | 464 case kIsolateUnhandledException: |
465 library = Library::IsolateLibrary(); | 465 library = Library::IsolateLibrary(); |
466 class_name = &Symbols::IsolateUnhandledException(); | 466 class_name = &Symbols::IsolateUnhandledException(); |
467 break; | 467 break; |
468 } | 468 } |
469 | 469 |
470 return DartLibraryCalls::ExceptionCreate(library, *class_name, arguments); | 470 return DartLibraryCalls::ExceptionCreate(library, *class_name, arguments); |
471 } | 471 } |
472 | 472 |
473 } // namespace dart | 473 } // namespace dart |
OLD | NEW |