| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/isolate.h" | 5 #include "vm/isolate.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "platform/json.h" | 9 #include "platform/json.h" |
| 10 #include "lib/mirrors.h" | 10 #include "lib/mirrors.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 callback_name = isolate_->object_store()->unhandled_exception_handler(); | 182 callback_name = isolate_->object_store()->unhandled_exception_handler(); |
| 183 } else { | 183 } else { |
| 184 callback_name = String::New("_unhandledExceptionCallback"); | 184 callback_name = String::New("_unhandledExceptionCallback"); |
| 185 } | 185 } |
| 186 Library& lib = | 186 Library& lib = |
| 187 Library::Handle(isolate_, isolate_->object_store()->isolate_library()); | 187 Library::Handle(isolate_, isolate_->object_store()->isolate_library()); |
| 188 Function& func = | 188 Function& func = |
| 189 Function::Handle(isolate_, lib.LookupLocalFunction(callback_name)); | 189 Function::Handle(isolate_, lib.LookupLocalFunction(callback_name)); |
| 190 if (func.IsNull()) { | 190 if (func.IsNull()) { |
| 191 lib = isolate_->object_store()->root_library(); | 191 lib = isolate_->object_store()->root_library(); |
| 192 func = lib.LookupLocalFunction(callback_name); | 192 // Note: bootstrap code in builtin library may attempt to resolve a |
| 193 // callback function before the script is fully loaded, in which case |
| 194 // the root library may not be registered yet. |
| 195 if (!lib.IsNull()) { |
| 196 func = lib.LookupLocalFunction(callback_name); |
| 197 } |
| 193 } | 198 } |
| 194 return func.raw(); | 199 return func.raw(); |
| 195 } | 200 } |
| 196 | 201 |
| 197 | 202 |
| 198 bool IsolateMessageHandler::UnhandledExceptionCallbackHandler( | 203 bool IsolateMessageHandler::UnhandledExceptionCallbackHandler( |
| 199 const Object& message, const UnhandledException& error) { | 204 const Object& message, const UnhandledException& error) { |
| 200 const Instance& cause = Instance::Handle(isolate_, error.exception()); | 205 const Instance& cause = Instance::Handle(isolate_, error.exception()); |
| 201 const Instance& stacktrace = | 206 const Instance& stacktrace = |
| 202 Instance::Handle(isolate_, error.stacktrace()); | 207 Instance::Handle(isolate_, error.stacktrace()); |
| (...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 return func.raw(); | 1180 return func.raw(); |
| 1176 } | 1181 } |
| 1177 | 1182 |
| 1178 | 1183 |
| 1179 void IsolateSpawnState::Cleanup() { | 1184 void IsolateSpawnState::Cleanup() { |
| 1180 SwitchIsolateScope switch_scope(isolate()); | 1185 SwitchIsolateScope switch_scope(isolate()); |
| 1181 Dart::ShutdownIsolate(); | 1186 Dart::ShutdownIsolate(); |
| 1182 } | 1187 } |
| 1183 | 1188 |
| 1184 } // namespace dart | 1189 } // namespace dart |
| OLD | NEW |