| 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 "vm/code_observers.h" | 10 #include "vm/code_observers.h" |
| (...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 Object& result = Object::Handle(); | 1184 Object& result = Object::Handle(); |
| 1185 result = state->ResolveFunction(); | 1185 result = state->ResolveFunction(); |
| 1186 bool is_spawn_uri = state->is_spawn_uri(); | 1186 bool is_spawn_uri = state->is_spawn_uri(); |
| 1187 if (result.IsError()) { | 1187 if (result.IsError()) { |
| 1188 StoreError(isolate, result); | 1188 StoreError(isolate, result); |
| 1189 return false; | 1189 return false; |
| 1190 } | 1190 } |
| 1191 ASSERT(result.IsFunction()); | 1191 ASSERT(result.IsFunction()); |
| 1192 Function& func = Function::Handle(isolate); | 1192 Function& func = Function::Handle(isolate); |
| 1193 func ^= result.raw(); | 1193 func ^= result.raw(); |
| 1194 func = func.ImplicitClosureFunction(); | |
| 1195 | 1194 |
| 1196 // TODO(turnidge): Currently we need a way to force a one-time | 1195 // TODO(turnidge): Currently we need a way to force a one-time |
| 1197 // breakpoint for all spawned isolates to support isolate | 1196 // breakpoint for all spawned isolates to support isolate |
| 1198 // debugging. Remove this once the vmservice becomes the standard | 1197 // debugging. Remove this once the vmservice becomes the standard |
| 1199 // way to debug. | 1198 // way to debug. Set the breakpoint on the static function instead |
| 1199 // of its implicit closure function because that latter is merely |
| 1200 // a dispatcher that is marked as undebuggable. |
| 1200 if (FLAG_break_at_isolate_spawn) { | 1201 if (FLAG_break_at_isolate_spawn) { |
| 1201 isolate->debugger()->OneTimeBreakAtEntry(func); | 1202 isolate->debugger()->OneTimeBreakAtEntry(func); |
| 1202 } | 1203 } |
| 1203 | 1204 |
| 1205 func = func.ImplicitClosureFunction(); |
| 1206 |
| 1204 const Array& capabilities = Array::Handle(Array::New(2)); | 1207 const Array& capabilities = Array::Handle(Array::New(2)); |
| 1205 Capability& capability = Capability::Handle(); | 1208 Capability& capability = Capability::Handle(); |
| 1206 capability = Capability::New(isolate->pause_capability()); | 1209 capability = Capability::New(isolate->pause_capability()); |
| 1207 capabilities.SetAt(0, capability); | 1210 capabilities.SetAt(0, capability); |
| 1208 // Check whether this isolate should be started in paused state. | 1211 // Check whether this isolate should be started in paused state. |
| 1209 if (state->paused()) { | 1212 if (state->paused()) { |
| 1210 bool added = isolate->AddResumeCapability(capability); | 1213 bool added = isolate->AddResumeCapability(capability); |
| 1211 ASSERT(added); // There should be no pending resume capabilities. | 1214 ASSERT(added); // There should be no pending resume capabilities. |
| 1212 isolate->message_handler()->increment_paused(); | 1215 isolate->message_handler()->increment_paused(); |
| 1213 } | 1216 } |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1973 serialized_message_, serialized_message_len_); | 1976 serialized_message_, serialized_message_len_); |
| 1974 } | 1977 } |
| 1975 | 1978 |
| 1976 | 1979 |
| 1977 void IsolateSpawnState::Cleanup() { | 1980 void IsolateSpawnState::Cleanup() { |
| 1978 SwitchIsolateScope switch_scope(I); | 1981 SwitchIsolateScope switch_scope(I); |
| 1979 Dart::ShutdownIsolate(); | 1982 Dart::ShutdownIsolate(); |
| 1980 } | 1983 } |
| 1981 | 1984 |
| 1982 } // namespace dart | 1985 } // namespace dart |
| OLD | NEW |