| 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/cpu.h" | 7 #include "vm/cpu.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 frame = frames.NextFrame(); | 56 frame = frames.NextFrame(); |
| 57 ASSERT(frame != NULL); | 57 ASSERT(frame != NULL); |
| 58 } | 58 } |
| 59 ASSERT(frame->IsEntryFrame()); | 59 ASSERT(frame->IsEntryFrame()); |
| 60 *handler_pc = frame->pc(); | 60 *handler_pc = frame->pc(); |
| 61 *handler_sp = frame->sp(); | 61 *handler_sp = frame->sp(); |
| 62 *handler_fp = frame->fp(); | 62 *handler_fp = frame->fp(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 | 65 |
| 66 static void ThrowExceptionHelper(const Instance& exception, | 66 static void ThrowExceptionHelper(const Instance& incoming_exception, |
| 67 const Instance& existing_stacktrace) { | 67 const Instance& existing_stacktrace) { |
| 68 Instance& exception = Instance::Handle(incoming_exception.raw()); |
| 69 if (exception.IsNull()) { |
| 70 GrowableArray<const Object*> arguments; |
| 71 exception ^= Exceptions::Create(Exceptions::kNullPointer, arguments); |
| 72 } |
| 68 uword handler_pc = 0; | 73 uword handler_pc = 0; |
| 69 uword handler_sp = 0; | 74 uword handler_sp = 0; |
| 70 uword handler_fp = 0; | 75 uword handler_fp = 0; |
| 71 GrowableArray<uword> stack_frame_pcs; | 76 GrowableArray<uword> stack_frame_pcs; |
| 72 bool handler_exists = FindExceptionHandler(&handler_pc, | 77 bool handler_exists = FindExceptionHandler(&handler_pc, |
| 73 &handler_sp, | 78 &handler_sp, |
| 74 &handler_fp, | 79 &handler_fp, |
| 75 &stack_frame_pcs); | 80 &stack_frame_pcs); |
| 76 // TODO(5411263): At some point we can optimize by figuring out if a | 81 // TODO(5411263): At some point we can optimize by figuring out if a |
| 77 // stack trace is needed based on whether the catch code specifies a | 82 // stack trace is needed based on whether the catch code specifies a |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 case kIsolateSpawn: | 356 case kIsolateSpawn: |
| 352 library = Library::IsolateLibrary(); | 357 library = Library::IsolateLibrary(); |
| 353 class_name = String::NewSymbol("IsolateSpawnException"); | 358 class_name = String::NewSymbol("IsolateSpawnException"); |
| 354 break; | 359 break; |
| 355 } | 360 } |
| 356 | 361 |
| 357 return DartLibraryCalls::ExceptionCreate(library, class_name, arguments); | 362 return DartLibraryCalls::ExceptionCreate(library, class_name, arguments); |
| 358 } | 363 } |
| 359 | 364 |
| 360 } // namespace dart | 365 } // namespace dart |
| OLD | NEW |