| 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 callback_name = isolate_->object_store()->unhandled_exception_handler(); | 180 callback_name = isolate_->object_store()->unhandled_exception_handler(); |
| 181 } else { | 181 } else { |
| 182 callback_name = String::New("_unhandledExceptionCallback"); | 182 callback_name = String::New("_unhandledExceptionCallback"); |
| 183 } | 183 } |
| 184 Library& lib = | 184 Library& lib = |
| 185 Library::Handle(isolate_, isolate_->object_store()->isolate_library()); | 185 Library::Handle(isolate_, isolate_->object_store()->isolate_library()); |
| 186 Function& func = | 186 Function& func = |
| 187 Function::Handle(isolate_, lib.LookupLocalFunction(callback_name)); | 187 Function::Handle(isolate_, lib.LookupLocalFunction(callback_name)); |
| 188 if (func.IsNull()) { | 188 if (func.IsNull()) { |
| 189 lib = isolate_->object_store()->root_library(); | 189 lib = isolate_->object_store()->root_library(); |
| 190 func = lib.LookupLocalFunction(callback_name); | 190 // Note: bootstrap code in builtin library may attempt to resolve a |
| 191 // callback function before the script is fully loaded, in which case |
| 192 // the root library may not be registered yet. |
| 193 if (!lib.IsNull()) { |
| 194 func = lib.LookupLocalFunction(callback_name); |
| 195 } |
| 191 } | 196 } |
| 192 return func.raw(); | 197 return func.raw(); |
| 193 } | 198 } |
| 194 | 199 |
| 195 | 200 |
| 196 bool IsolateMessageHandler::UnhandledExceptionCallbackHandler( | 201 bool IsolateMessageHandler::UnhandledExceptionCallbackHandler( |
| 197 const Object& message, const UnhandledException& error) { | 202 const Object& message, const UnhandledException& error) { |
| 198 const Instance& cause = Instance::Handle(isolate_, error.exception()); | 203 const Instance& cause = Instance::Handle(isolate_, error.exception()); |
| 199 const Instance& stacktrace = | 204 const Instance& stacktrace = |
| 200 Instance::Handle(isolate_, error.stacktrace()); | 205 Instance::Handle(isolate_, error.stacktrace()); |
| (...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 return func.raw(); | 1195 return func.raw(); |
| 1191 } | 1196 } |
| 1192 | 1197 |
| 1193 | 1198 |
| 1194 void IsolateSpawnState::Cleanup() { | 1199 void IsolateSpawnState::Cleanup() { |
| 1195 SwitchIsolateScope switch_scope(isolate()); | 1200 SwitchIsolateScope switch_scope(isolate()); |
| 1196 Dart::ShutdownIsolate(); | 1201 Dart::ShutdownIsolate(); |
| 1197 } | 1202 } |
| 1198 | 1203 |
| 1199 } // namespace dart | 1204 } // namespace dart |
| OLD | NEW |