| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 CPU::JumpToErrorHandler(handler_pc, | 112 CPU::JumpToErrorHandler(handler_pc, |
| 113 handler_sp, | 113 handler_sp, |
| 114 handler_fp, | 114 handler_fp, |
| 115 unhandled_exception); | 115 unhandled_exception); |
| 116 } | 116 } |
| 117 UNREACHABLE(); | 117 UNREACHABLE(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 | 120 |
| 121 void Exceptions::Throw(const Instance& exception) { | 121 void Exceptions::Throw(const Instance& exception) { |
| 122 // Null object is a valid exception object. |
| 122 ThrowExceptionHelper(exception, Instance::Handle()); | 123 ThrowExceptionHelper(exception, Instance::Handle()); |
| 123 } | 124 } |
| 124 | 125 |
| 125 | 126 |
| 126 void Exceptions::ReThrow(const Instance& exception, | 127 void Exceptions::ReThrow(const Instance& exception, |
| 127 const Instance& stacktrace) { | 128 const Instance& stacktrace) { |
| 128 ASSERT(!exception.IsNull()); | 129 // Null object is a valid exception object. |
| 129 ThrowExceptionHelper(exception, stacktrace); | 130 ThrowExceptionHelper(exception, stacktrace); |
| 130 } | 131 } |
| 131 | 132 |
| 132 | 133 |
| 133 void Exceptions::PropagateError(const Object& obj) { | 134 void Exceptions::PropagateError(const Object& obj) { |
| 134 ASSERT(Isolate::Current()->top_exit_frame_info() != 0); | 135 ASSERT(Isolate::Current()->top_exit_frame_info() != 0); |
| 135 Error& error = Error::Handle(); | 136 Error& error = Error::Handle(); |
| 136 error ^= obj.raw(); | 137 error ^= obj.raw(); |
| 137 if (error.IsUnhandledException()) { | 138 if (error.IsUnhandledException()) { |
| 138 // If the error object represents an unhandled exception, then | 139 // If the error object represents an unhandled exception, then |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 break; | 214 break; |
| 214 case kIllegalJSRegExp: | 215 case kIllegalJSRegExp: |
| 215 class_name = String::NewSymbol("IllegalJSRegExpException"); | 216 class_name = String::NewSymbol("IllegalJSRegExpException"); |
| 216 break; | 217 break; |
| 217 } | 218 } |
| 218 | 219 |
| 219 return DartLibraryCalls::ExceptionCreate(class_name, arguments); | 220 return DartLibraryCalls::ExceptionCreate(class_name, arguments); |
| 220 } | 221 } |
| 221 | 222 |
| 222 } // namespace dart | 223 } // namespace dart |
| OLD | NEW |