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); | |
110 | 107 |
111 // If the message is in band we lookup the receive port to dispatch to. If | 108 // If the message is in band we lookup the receive port to dispatch to. If |
112 // the receive port is closed, we drop the message without deserializing it. | 109 // the receive port is closed, we drop the message without deserializing it. |
113 Object& receive_port = Object::Handle(); | 110 Object& receive_port = Object::Handle(); |
114 if (!message->IsOOB()) { | 111 if (!message->IsOOB()) { |
115 receive_port = DartLibraryCalls::LookupReceivePort(message->dest_port()); | 112 receive_port = DartLibraryCalls::LookupReceivePort(message->dest_port()); |
116 if (receive_port.IsError()) { | 113 if (receive_port.IsError()) { |
117 return ProcessUnhandledException(Object::null_instance(), | 114 return ProcessUnhandledException(Object::null_instance(), |
118 Error::Cast(receive_port)); | 115 Error::Cast(receive_port)); |
119 } | 116 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 if ((exception != isolate_->object_store()->out_of_memory()) && | 245 if ((exception != isolate_->object_store()->out_of_memory()) && |
249 (exception != isolate_->object_store()->stack_overflow())) { | 246 (exception != isolate_->object_store()->stack_overflow())) { |
250 if (UnhandledExceptionCallbackHandler(message, error)) { | 247 if (UnhandledExceptionCallbackHandler(message, error)) { |
251 return true; | 248 return true; |
252 } | 249 } |
253 } | 250 } |
254 } | 251 } |
255 | 252 |
256 // Invoke the isolate's unhandled exception callback if there is one. | 253 // Invoke the isolate's unhandled exception callback if there is one. |
257 if (Isolate::UnhandledExceptionCallback() != NULL) { | 254 if (Isolate::UnhandledExceptionCallback() != NULL) { |
| 255 VmToNativeTimerScope timer(Isolate::Current()); |
258 Dart_EnterScope(); | 256 Dart_EnterScope(); |
259 Dart_Handle error = Api::NewHandle(isolate_, result.raw()); | 257 Dart_Handle error = Api::NewHandle(isolate_, result.raw()); |
260 (Isolate::UnhandledExceptionCallback())(error); | 258 (Isolate::UnhandledExceptionCallback())(error); |
261 Dart_ExitScope(); | 259 Dart_ExitScope(); |
262 } | 260 } |
263 | 261 |
264 isolate_->object_store()->set_sticky_error(result); | 262 isolate_->object_store()->set_sticky_error(result); |
265 return false; | 263 return false; |
266 } | 264 } |
267 | 265 |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 return func.raw(); | 1049 return func.raw(); |
1052 } | 1050 } |
1053 | 1051 |
1054 | 1052 |
1055 void IsolateSpawnState::Cleanup() { | 1053 void IsolateSpawnState::Cleanup() { |
1056 SwitchIsolateScope switch_scope(isolate()); | 1054 SwitchIsolateScope switch_scope(isolate()); |
1057 Dart::ShutdownIsolate(); | 1055 Dart::ShutdownIsolate(); |
1058 } | 1056 } |
1059 | 1057 |
1060 } // namespace dart | 1058 } // namespace dart |
OLD | NEW |