Chromium Code Reviews| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 String::Handle(script.url()).ToCString(), | 237 String::Handle(script.url()).ToCString(), |
| 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) { |
|
siva
2012/06/08 17:17:27
Isolate* isolate = Isolate::Current();
if (isolate
hausner
2012/06/08 17:42:35
Done.
| |
| 248 if (Isolate::Current()->debugger()->IsActive()) { | |
| 249 Isolate::Current()->debugger()->SignalExceptionThrown(exception); | |
| 250 } | |
| 247 // Null object is a valid exception object. | 251 // Null object is a valid exception object. |
| 248 ThrowExceptionHelper(exception, Instance::Handle()); | 252 ThrowExceptionHelper(exception, Instance::Handle()); |
|
siva
2012/06/08 17:17:27
Instance::Handle(isolate);
hausner
2012/06/08 17:42:35
Done.
| |
| 249 } | 253 } |
| 250 | 254 |
| 251 | 255 |
| 252 void Exceptions::ReThrow(const Instance& exception, | 256 void Exceptions::ReThrow(const Instance& exception, |
| 253 const Instance& stacktrace) { | 257 const Instance& stacktrace) { |
| 254 // Null object is a valid exception object. | 258 // Null object is a valid exception object. |
| 255 ThrowExceptionHelper(exception, stacktrace); | 259 ThrowExceptionHelper(exception, stacktrace); |
| 256 } | 260 } |
| 257 | 261 |
| 258 | 262 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 356 case kIsolateSpawn: | 360 case kIsolateSpawn: |
| 357 library = Library::IsolateLibrary(); | 361 library = Library::IsolateLibrary(); |
| 358 class_name = String::NewSymbol("IsolateSpawnException"); | 362 class_name = String::NewSymbol("IsolateSpawnException"); |
| 359 break; | 363 break; |
| 360 } | 364 } |
| 361 | 365 |
| 362 return DartLibraryCalls::ExceptionCreate(library, class_name, arguments); | 366 return DartLibraryCalls::ExceptionCreate(library, class_name, arguments); |
| 363 } | 367 } |
| 364 | 368 |
| 365 } // namespace dart | 369 } // namespace dart |
| OLD | NEW |