| 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/debugger.h" |
| 9 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| 10 #include "vm/object.h" | 11 #include "vm/object.h" |
| 11 #include "vm/stack_frame.h" | 12 #include "vm/stack_frame.h" |
| 12 | 13 |
| 13 namespace dart { | 14 namespace dart { |
| 14 | 15 |
| 15 DEFINE_FLAG(bool, print_stack_trace_at_throw, false, | 16 DEFINE_FLAG(bool, print_stack_trace_at_throw, false, |
| 16 "Prints a stack trace everytime a throw occurs."); | 17 "Prints a stack trace everytime a throw occurs."); |
| 17 | 18 |
| 18 // Iterate through the stack frames and try to find a frame with an | 19 // Iterate through the stack frames and try to find a frame with an |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 line, column); | 238 line, column); |
| 238 } | 239 } |
| 239 } | 240 } |
| 240 // Throw TypeError instance. | 241 // Throw TypeError instance. |
| 241 Exceptions::Throw(type_error); | 242 Exceptions::Throw(type_error); |
| 242 UNREACHABLE(); | 243 UNREACHABLE(); |
| 243 } | 244 } |
| 244 | 245 |
| 245 | 246 |
| 246 void Exceptions::Throw(const Instance& exception) { | 247 void Exceptions::Throw(const Instance& exception) { |
| 248 Isolate* isolate = Isolate::Current(); |
| 249 if (isolate->debugger()->IsActive()) { |
| 250 isolate->debugger()->SignalExceptionThrown(exception); |
| 251 } |
| 247 // Null object is a valid exception object. | 252 // Null object is a valid exception object. |
| 248 ThrowExceptionHelper(exception, Instance::Handle()); | 253 ThrowExceptionHelper(exception, Instance::Handle(isolate)); |
| 249 } | 254 } |
| 250 | 255 |
| 251 | 256 |
| 252 void Exceptions::ReThrow(const Instance& exception, | 257 void Exceptions::ReThrow(const Instance& exception, |
| 253 const Instance& stacktrace) { | 258 const Instance& stacktrace) { |
| 254 // Null object is a valid exception object. | 259 // Null object is a valid exception object. |
| 255 ThrowExceptionHelper(exception, stacktrace); | 260 ThrowExceptionHelper(exception, stacktrace); |
| 256 } | 261 } |
| 257 | 262 |
| 258 | 263 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 case kIsolateSpawn: | 361 case kIsolateSpawn: |
| 357 library = Library::IsolateLibrary(); | 362 library = Library::IsolateLibrary(); |
| 358 class_name = String::NewSymbol("IsolateSpawnException"); | 363 class_name = String::NewSymbol("IsolateSpawnException"); |
| 359 break; | 364 break; |
| 360 } | 365 } |
| 361 | 366 |
| 362 return DartLibraryCalls::ExceptionCreate(library, class_name, arguments); | 367 return DartLibraryCalls::ExceptionCreate(library, class_name, arguments); |
| 363 } | 368 } |
| 364 | 369 |
| 365 } // namespace dart | 370 } // namespace dart |
| OLD | NEW |