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 "platform/address_sanitizer.h" | 7 #include "platform/address_sanitizer.h" |
8 | 8 |
9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 void Exceptions::ReThrow(Thread* thread, | 495 void Exceptions::ReThrow(Thread* thread, |
496 const Instance& exception, | 496 const Instance& exception, |
497 const Instance& stacktrace) { | 497 const Instance& stacktrace) { |
498 // Null object is a valid exception object. | 498 // Null object is a valid exception object. |
499 ThrowExceptionHelper(thread, exception, stacktrace, true); | 499 ThrowExceptionHelper(thread, exception, stacktrace, true); |
500 } | 500 } |
501 | 501 |
502 | 502 |
503 void Exceptions::PropagateError(const Error& error) { | 503 void Exceptions::PropagateError(const Error& error) { |
504 Thread* thread = Thread::Current(); | 504 Thread* thread = Thread::Current(); |
505 Isolate* isolate = thread->isolate(); | |
506 Zone* zone = thread->zone(); | 505 Zone* zone = thread->zone(); |
507 ASSERT(isolate->top_exit_frame_info() != 0); | 506 ASSERT(thread->top_exit_frame_info() != 0); |
508 if (error.IsUnhandledException()) { | 507 if (error.IsUnhandledException()) { |
509 // If the error object represents an unhandled exception, then | 508 // If the error object represents an unhandled exception, then |
510 // rethrow the exception in the normal fashion. | 509 // rethrow the exception in the normal fashion. |
511 const UnhandledException& uhe = UnhandledException::Cast(error); | 510 const UnhandledException& uhe = UnhandledException::Cast(error); |
512 const Instance& exc = Instance::Handle(zone, uhe.exception()); | 511 const Instance& exc = Instance::Handle(zone, uhe.exception()); |
513 const Instance& stk = Instance::Handle(zone, uhe.stacktrace()); | 512 const Instance& stk = Instance::Handle(zone, uhe.stacktrace()); |
514 Exceptions::ReThrow(thread, exc, stk); | 513 Exceptions::ReThrow(thread, exc, stk); |
515 } else { | 514 } else { |
516 // Return to the invocation stub and return this error object. The | 515 // Return to the invocation stub and return this error object. The |
517 // C++ code which invoked this dart sequence can check and do the | 516 // C++ code which invoked this dart sequence can check and do the |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 | 675 |
677 // Throw JavascriptCompatibilityError exception. | 676 // Throw JavascriptCompatibilityError exception. |
678 void Exceptions::ThrowJavascriptCompatibilityError(const char* msg) { | 677 void Exceptions::ThrowJavascriptCompatibilityError(const char* msg) { |
679 const Array& exc_args = Array::Handle(Array::New(1)); | 678 const Array& exc_args = Array::Handle(Array::New(1)); |
680 const String& msg_str = String::Handle(String::New(msg)); | 679 const String& msg_str = String::Handle(String::New(msg)); |
681 exc_args.SetAt(0, msg_str); | 680 exc_args.SetAt(0, msg_str); |
682 Exceptions::ThrowByType(Exceptions::kJavascriptCompatibilityError, exc_args); | 681 Exceptions::ThrowByType(Exceptions::kJavascriptCompatibilityError, exc_args); |
683 } | 682 } |
684 | 683 |
685 } // namespace dart | 684 } // namespace dart |
OLD | NEW |