| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // Allow the embedder to handle message notification. | 97 // Allow the embedder to handle message notification. |
| 98 (*callback)(Api::CastIsolate(isolate_)); | 98 (*callback)(Api::CastIsolate(isolate_)); |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 | 101 |
| 102 | 102 |
| 103 bool IsolateMessageHandler::HandleMessage(Message* message) { | 103 bool IsolateMessageHandler::HandleMessage(Message* message) { |
| 104 StartIsolateScope start_scope(isolate_); | 104 StartIsolateScope start_scope(isolate_); |
| 105 StackZone zone(isolate_); | 105 StackZone zone(isolate_); |
| 106 HandleScope handle_scope(isolate_); | 106 HandleScope handle_scope(isolate_); |
| 107 // TODO(turnidge): Rework collection total dart execution. This can |
| 108 // overcount when other things (gc, compilation) are active. |
| 109 TIMERSCOPE(time_dart_execution); |
| 107 | 110 |
| 108 // If the message is in band we lookup the receive port to dispatch to. If | 111 // If the message is in band we lookup the receive port to dispatch to. If |
| 109 // the receive port is closed, we drop the message without deserializing it. | 112 // the receive port is closed, we drop the message without deserializing it. |
| 110 Object& receive_port = Object::Handle(); | 113 Object& receive_port = Object::Handle(); |
| 111 if (!message->IsOOB()) { | 114 if (!message->IsOOB()) { |
| 112 receive_port = DartLibraryCalls::LookupReceivePort(message->dest_port()); | 115 receive_port = DartLibraryCalls::LookupReceivePort(message->dest_port()); |
| 113 if (receive_port.IsError()) { | 116 if (receive_port.IsError()) { |
| 114 return ProcessUnhandledException(Object::null_instance(), | 117 return ProcessUnhandledException(Object::null_instance(), |
| 115 Error::Cast(receive_port)); | 118 Error::Cast(receive_port)); |
| 116 } | 119 } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 if ((exception != isolate_->object_store()->out_of_memory()) && | 248 if ((exception != isolate_->object_store()->out_of_memory()) && |
| 246 (exception != isolate_->object_store()->stack_overflow())) { | 249 (exception != isolate_->object_store()->stack_overflow())) { |
| 247 if (UnhandledExceptionCallbackHandler(message, error)) { | 250 if (UnhandledExceptionCallbackHandler(message, error)) { |
| 248 return true; | 251 return true; |
| 249 } | 252 } |
| 250 } | 253 } |
| 251 } | 254 } |
| 252 | 255 |
| 253 // Invoke the isolate's unhandled exception callback if there is one. | 256 // Invoke the isolate's unhandled exception callback if there is one. |
| 254 if (Isolate::UnhandledExceptionCallback() != NULL) { | 257 if (Isolate::UnhandledExceptionCallback() != NULL) { |
| 255 VmToNativeTimerScope timer(Isolate::Current()); | |
| 256 Dart_EnterScope(); | 258 Dart_EnterScope(); |
| 257 Dart_Handle error = Api::NewHandle(isolate_, result.raw()); | 259 Dart_Handle error = Api::NewHandle(isolate_, result.raw()); |
| 258 (Isolate::UnhandledExceptionCallback())(error); | 260 (Isolate::UnhandledExceptionCallback())(error); |
| 259 Dart_ExitScope(); | 261 Dart_ExitScope(); |
| 260 } | 262 } |
| 261 | 263 |
| 262 isolate_->object_store()->set_sticky_error(result); | 264 isolate_->object_store()->set_sticky_error(result); |
| 263 return false; | 265 return false; |
| 264 } | 266 } |
| 265 | 267 |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 return func.raw(); | 1051 return func.raw(); |
| 1050 } | 1052 } |
| 1051 | 1053 |
| 1052 | 1054 |
| 1053 void IsolateSpawnState::Cleanup() { | 1055 void IsolateSpawnState::Cleanup() { |
| 1054 SwitchIsolateScope switch_scope(isolate()); | 1056 SwitchIsolateScope switch_scope(isolate()); |
| 1055 Dart::ShutdownIsolate(); | 1057 Dart::ShutdownIsolate(); |
| 1056 } | 1058 } |
| 1057 | 1059 |
| 1058 } // namespace dart | 1060 } // namespace dart |
| OLD | NEW |