OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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/service_isolate.h" | 5 #include "vm/service_isolate.h" |
6 | 6 |
7 #include "vm/compiler.h" | 7 #include "vm/compiler.h" |
8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
11 #include "vm/lockers.h" | 11 #include "vm/lockers.h" |
12 #include "vm/message.h" | 12 #include "vm/message.h" |
13 #include "vm/message_handler.h" | 13 #include "vm/message_handler.h" |
14 #include "vm/native_entry.h" | 14 #include "vm/native_entry.h" |
15 #include "vm/native_arguments.h" | 15 #include "vm/native_arguments.h" |
16 #include "vm/object.h" | 16 #include "vm/object.h" |
17 #include "vm/object_store.h" | 17 #include "vm/object_store.h" |
18 #include "vm/port.h" | 18 #include "vm/port.h" |
19 #include "vm/service.h" | 19 #include "vm/service.h" |
20 #include "vm/symbols.h" | 20 #include "vm/symbols.h" |
21 #include "vm/thread_pool.h" | 21 #include "vm/thread_pool.h" |
22 #include "vm/timeline.h" | 22 #include "vm/timeline.h" |
23 | 23 |
24 namespace dart { | 24 namespace dart { |
25 | 25 |
26 #define Z (T->zone()) | 26 #define Z (T->zone()) |
27 | 27 |
28 | 28 |
29 DEFINE_FLAG(bool, trace_service, false, "Trace VM service requests."); | 29 DEFINE_FLAG(bool, trace_service, false, "Trace VM service requests."); |
30 DEFINE_FLAG(bool, trace_service_pause_events, false, | 30 DEFINE_FLAG(bool, |
| 31 trace_service_pause_events, |
| 32 false, |
31 "Trace VM service isolate pause events."); | 33 "Trace VM service isolate pause events."); |
32 DEFINE_FLAG(bool, trace_service_verbose, false, | 34 DEFINE_FLAG(bool, |
| 35 trace_service_verbose, |
| 36 false, |
33 "Provide extra service tracing information."); | 37 "Provide extra service tracing information."); |
34 | 38 |
35 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { | 39 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { |
36 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); | 40 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); |
37 return reinterpret_cast<uint8_t*>(new_ptr); | 41 return reinterpret_cast<uint8_t*>(new_ptr); |
38 } | 42 } |
39 | 43 |
40 | 44 |
41 // These must be kept in sync with service/constants.dart | 45 // These must be kept in sync with service/constants.dart |
42 #define VM_SERVICE_ISOLATE_EXIT_MESSAGE_ID 0 | 46 #define VM_SERVICE_ISOLATE_EXIT_MESSAGE_ID 0 |
43 #define VM_SERVICE_ISOLATE_STARTUP_MESSAGE_ID 1 | 47 #define VM_SERVICE_ISOLATE_STARTUP_MESSAGE_ID 1 |
44 #define VM_SERVICE_ISOLATE_SHUTDOWN_MESSAGE_ID 2 | 48 #define VM_SERVICE_ISOLATE_SHUTDOWN_MESSAGE_ID 2 |
45 | 49 |
46 #define VM_SERVICE_WEB_SERVER_CONTROL_MESSAGE_ID 3 | 50 #define VM_SERVICE_WEB_SERVER_CONTROL_MESSAGE_ID 3 |
47 #define VM_SERVICE_SERVER_INFO_MESSAGE_ID 4 | 51 #define VM_SERVICE_SERVER_INFO_MESSAGE_ID 4 |
48 | 52 |
49 static RawArray* MakeServiceControlMessage(Dart_Port port_id, intptr_t code, | 53 static RawArray* MakeServiceControlMessage(Dart_Port port_id, |
| 54 intptr_t code, |
50 const String& name) { | 55 const String& name) { |
51 const Array& list = Array::Handle(Array::New(4)); | 56 const Array& list = Array::Handle(Array::New(4)); |
52 ASSERT(!list.IsNull()); | 57 ASSERT(!list.IsNull()); |
53 const Integer& code_int = Integer::Handle(Integer::New(code)); | 58 const Integer& code_int = Integer::Handle(Integer::New(code)); |
54 const Integer& port_int = Integer::Handle(Integer::New(port_id)); | 59 const Integer& port_int = Integer::Handle(Integer::New(port_id)); |
55 const SendPort& send_port = SendPort::Handle(SendPort::New(port_id)); | 60 const SendPort& send_port = SendPort::Handle(SendPort::New(port_id)); |
56 list.SetAt(0, code_int); | 61 list.SetAt(0, code_int); |
57 list.SetAt(1, port_int); | 62 list.SetAt(1, port_int); |
58 list.SetAt(2, send_port); | 63 list.SetAt(2, send_port); |
59 list.SetAt(3, name); | 64 list.SetAt(3, name); |
(...skipping 30 matching lines...) Expand all Loading... |
90 Dart_Port ServiceIsolate::origin_ = ILLEGAL_PORT; | 95 Dart_Port ServiceIsolate::origin_ = ILLEGAL_PORT; |
91 Dart_IsolateCreateCallback ServiceIsolate::create_callback_ = NULL; | 96 Dart_IsolateCreateCallback ServiceIsolate::create_callback_ = NULL; |
92 uint8_t* ServiceIsolate::exit_message_ = NULL; | 97 uint8_t* ServiceIsolate::exit_message_ = NULL; |
93 intptr_t ServiceIsolate::exit_message_length_ = 0; | 98 intptr_t ServiceIsolate::exit_message_length_ = 0; |
94 Monitor* ServiceIsolate::monitor_ = NULL; | 99 Monitor* ServiceIsolate::monitor_ = NULL; |
95 bool ServiceIsolate::initializing_ = true; | 100 bool ServiceIsolate::initializing_ = true; |
96 bool ServiceIsolate::shutting_down_ = false; | 101 bool ServiceIsolate::shutting_down_ = false; |
97 char* ServiceIsolate::server_address_ = NULL; | 102 char* ServiceIsolate::server_address_ = NULL; |
98 | 103 |
99 void ServiceIsolate::RequestServerInfo(const SendPort& sp) { | 104 void ServiceIsolate::RequestServerInfo(const SendPort& sp) { |
100 const Array& message = | 105 const Array& message = Array::Handle(MakeServerControlMessage( |
101 Array::Handle( | 106 sp, VM_SERVICE_SERVER_INFO_MESSAGE_ID, false /* ignored */)); |
102 MakeServerControlMessage(sp, | |
103 VM_SERVICE_SERVER_INFO_MESSAGE_ID, | |
104 false /* ignored */)); | |
105 ASSERT(!message.IsNull()); | 107 ASSERT(!message.IsNull()); |
106 uint8_t* data = NULL; | 108 uint8_t* data = NULL; |
107 MessageWriter writer(&data, &allocator, false); | 109 MessageWriter writer(&data, &allocator, false); |
108 writer.WriteMessage(message); | 110 writer.WriteMessage(message); |
109 intptr_t len = writer.BytesWritten(); | 111 intptr_t len = writer.BytesWritten(); |
110 PortMap::PostMessage(new Message(port_, data, len, Message::kNormalPriority)); | 112 PortMap::PostMessage(new Message(port_, data, len, Message::kNormalPriority)); |
111 } | 113 } |
112 | 114 |
113 | 115 |
114 void ServiceIsolate::ControlWebServer(const SendPort& sp, bool enable) { | 116 void ServiceIsolate::ControlWebServer(const SendPort& sp, bool enable) { |
115 const Array& message = | 117 const Array& message = Array::Handle(MakeServerControlMessage( |
116 Array::Handle( | 118 sp, VM_SERVICE_WEB_SERVER_CONTROL_MESSAGE_ID, enable)); |
117 MakeServerControlMessage(sp, | |
118 VM_SERVICE_WEB_SERVER_CONTROL_MESSAGE_ID, | |
119 enable)); | |
120 ASSERT(!message.IsNull()); | 119 ASSERT(!message.IsNull()); |
121 uint8_t* data = NULL; | 120 uint8_t* data = NULL; |
122 MessageWriter writer(&data, &allocator, false); | 121 MessageWriter writer(&data, &allocator, false); |
123 writer.WriteMessage(message); | 122 writer.WriteMessage(message); |
124 intptr_t len = writer.BytesWritten(); | 123 intptr_t len = writer.BytesWritten(); |
125 PortMap::PostMessage(new Message(port_, data, len, Message::kNormalPriority)); | 124 PortMap::PostMessage(new Message(port_, data, len, Message::kNormalPriority)); |
126 } | 125 } |
127 | 126 |
128 | 127 |
129 void ServiceIsolate::SetServerAddress(const char* address) { | 128 void ServiceIsolate::SetServerAddress(const char* address) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 } | 196 } |
198 Thread* thread = Thread::Current(); | 197 Thread* thread = Thread::Current(); |
199 Isolate* isolate = thread->isolate(); | 198 Isolate* isolate = thread->isolate(); |
200 if (IsServiceIsolateDescendant(isolate)) { | 199 if (IsServiceIsolateDescendant(isolate)) { |
201 return false; | 200 return false; |
202 } | 201 } |
203 ASSERT(isolate != NULL); | 202 ASSERT(isolate != NULL); |
204 HANDLESCOPE(thread); | 203 HANDLESCOPE(thread); |
205 const String& name = String::Handle(String::New(isolate->name())); | 204 const String& name = String::Handle(String::New(isolate->name())); |
206 ASSERT(!name.IsNull()); | 205 ASSERT(!name.IsNull()); |
207 const Array& list = Array::Handle( | 206 const Array& list = Array::Handle(MakeServiceControlMessage( |
208 MakeServiceControlMessage(Dart_GetMainPortId(), | 207 Dart_GetMainPortId(), VM_SERVICE_ISOLATE_STARTUP_MESSAGE_ID, name)); |
209 VM_SERVICE_ISOLATE_STARTUP_MESSAGE_ID, | |
210 name)); | |
211 ASSERT(!list.IsNull()); | 208 ASSERT(!list.IsNull()); |
212 uint8_t* data = NULL; | 209 uint8_t* data = NULL; |
213 MessageWriter writer(&data, &allocator, false); | 210 MessageWriter writer(&data, &allocator, false); |
214 writer.WriteMessage(list); | 211 writer.WriteMessage(list); |
215 intptr_t len = writer.BytesWritten(); | 212 intptr_t len = writer.BytesWritten(); |
216 if (FLAG_trace_service) { | 213 if (FLAG_trace_service) { |
217 OS::Print("vm-service: Isolate %s %" Pd64 " registered.\n", | 214 OS::Print("vm-service: Isolate %s %" Pd64 " registered.\n", |
218 name.ToCString(), | 215 name.ToCString(), Dart_GetMainPortId()); |
219 Dart_GetMainPortId()); | |
220 } | 216 } |
221 return PortMap::PostMessage( | 217 return PortMap::PostMessage( |
222 new Message(port_, data, len, Message::kNormalPriority)); | 218 new Message(port_, data, len, Message::kNormalPriority)); |
223 } | 219 } |
224 | 220 |
225 | 221 |
226 bool ServiceIsolate::SendIsolateShutdownMessage() { | 222 bool ServiceIsolate::SendIsolateShutdownMessage() { |
227 if (!IsRunning()) { | 223 if (!IsRunning()) { |
228 return false; | 224 return false; |
229 } | 225 } |
230 Thread* thread = Thread::Current(); | 226 Thread* thread = Thread::Current(); |
231 Isolate* isolate = thread->isolate(); | 227 Isolate* isolate = thread->isolate(); |
232 if (IsServiceIsolateDescendant(isolate)) { | 228 if (IsServiceIsolateDescendant(isolate)) { |
233 return false; | 229 return false; |
234 } | 230 } |
235 ASSERT(isolate != NULL); | 231 ASSERT(isolate != NULL); |
236 HANDLESCOPE(thread); | 232 HANDLESCOPE(thread); |
237 const String& name = String::Handle(String::New(isolate->name())); | 233 const String& name = String::Handle(String::New(isolate->name())); |
238 ASSERT(!name.IsNull()); | 234 ASSERT(!name.IsNull()); |
239 const Array& list = Array::Handle( | 235 const Array& list = Array::Handle(MakeServiceControlMessage( |
240 MakeServiceControlMessage(Dart_GetMainPortId(), | 236 Dart_GetMainPortId(), VM_SERVICE_ISOLATE_SHUTDOWN_MESSAGE_ID, name)); |
241 VM_SERVICE_ISOLATE_SHUTDOWN_MESSAGE_ID, | |
242 name)); | |
243 ASSERT(!list.IsNull()); | 237 ASSERT(!list.IsNull()); |
244 uint8_t* data = NULL; | 238 uint8_t* data = NULL; |
245 MessageWriter writer(&data, &allocator, false); | 239 MessageWriter writer(&data, &allocator, false); |
246 writer.WriteMessage(list); | 240 writer.WriteMessage(list); |
247 intptr_t len = writer.BytesWritten(); | 241 intptr_t len = writer.BytesWritten(); |
248 if (FLAG_trace_service) { | 242 if (FLAG_trace_service) { |
249 OS::Print("vm-service: Isolate %s %" Pd64 " deregistered.\n", | 243 OS::Print("vm-service: Isolate %s %" Pd64 " deregistered.\n", |
250 name.ToCString(), | 244 name.ToCString(), Dart_GetMainPortId()); |
251 Dart_GetMainPortId()); | |
252 } | 245 } |
253 return PortMap::PostMessage( | 246 return PortMap::PostMessage( |
254 new Message(port_, data, len, Message::kNormalPriority)); | 247 new Message(port_, data, len, Message::kNormalPriority)); |
255 } | 248 } |
256 | 249 |
257 | 250 |
258 void ServiceIsolate::SendServiceExitMessage() { | 251 void ServiceIsolate::SendServiceExitMessage() { |
259 if (!IsRunning()) { | 252 if (!IsRunning()) { |
260 return; | 253 return; |
261 } | 254 } |
262 if ((exit_message_ == NULL) || (exit_message_length_ == 0)) { | 255 if ((exit_message_ == NULL) || (exit_message_length_ == 0)) { |
263 return; | 256 return; |
264 } | 257 } |
265 if (FLAG_trace_service) { | 258 if (FLAG_trace_service) { |
266 OS::Print("vm-service: sending service exit message.\n"); | 259 OS::Print("vm-service: sending service exit message.\n"); |
267 } | 260 } |
268 PortMap::PostMessage(new Message(port_, | 261 PortMap::PostMessage(new Message(port_, exit_message_, exit_message_length_, |
269 exit_message_, | |
270 exit_message_length_, | |
271 Message::kNormalPriority)); | 262 Message::kNormalPriority)); |
272 } | 263 } |
273 | 264 |
274 | 265 |
275 void ServiceIsolate::SetServicePort(Dart_Port port) { | 266 void ServiceIsolate::SetServicePort(Dart_Port port) { |
276 MonitorLocker ml(monitor_); | 267 MonitorLocker ml(monitor_); |
277 port_ = port; | 268 port_ = port; |
278 } | 269 } |
279 | 270 |
280 | 271 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 initializing_ = false; | 333 initializing_ = false; |
343 ml.NotifyAll(); | 334 ml.NotifyAll(); |
344 } | 335 } |
345 | 336 |
346 | 337 |
347 class RunServiceTask : public ThreadPool::Task { | 338 class RunServiceTask : public ThreadPool::Task { |
348 public: | 339 public: |
349 virtual void Run() { | 340 virtual void Run() { |
350 ASSERT(Isolate::Current() == NULL); | 341 ASSERT(Isolate::Current() == NULL); |
351 #ifndef PRODUCT | 342 #ifndef PRODUCT |
352 TimelineDurationScope tds(Timeline::GetVMStream(), | 343 TimelineDurationScope tds(Timeline::GetVMStream(), "ServiceIsolateStartup"); |
353 "ServiceIsolateStartup"); | |
354 #endif // !PRODUCT | 344 #endif // !PRODUCT |
355 char* error = NULL; | 345 char* error = NULL; |
356 Isolate* isolate = NULL; | 346 Isolate* isolate = NULL; |
357 | 347 |
358 Dart_IsolateCreateCallback create_callback = | 348 Dart_IsolateCreateCallback create_callback = |
359 ServiceIsolate::create_callback(); | 349 ServiceIsolate::create_callback(); |
360 // TODO(johnmccutchan): Support starting up service isolate without embedder | 350 // TODO(johnmccutchan): Support starting up service isolate without embedder |
361 // provided isolate creation callback. | 351 // provided isolate creation callback. |
362 if (create_callback == NULL) { | 352 if (create_callback == NULL) { |
363 ServiceIsolate::FinishedInitializing(); | 353 ServiceIsolate::FinishedInitializing(); |
364 return; | 354 return; |
365 } | 355 } |
366 | 356 |
367 Dart_IsolateFlags api_flags; | 357 Dart_IsolateFlags api_flags; |
368 Isolate::FlagsInitialize(&api_flags); | 358 Isolate::FlagsInitialize(&api_flags); |
369 | 359 |
370 isolate = | 360 isolate = reinterpret_cast<Isolate*>(create_callback( |
371 reinterpret_cast<Isolate*>(create_callback(ServiceIsolate::kName, | 361 ServiceIsolate::kName, NULL, NULL, NULL, &api_flags, NULL, &error)); |
372 NULL, | |
373 NULL, | |
374 NULL, | |
375 &api_flags, | |
376 NULL, | |
377 &error)); | |
378 if (isolate == NULL) { | 362 if (isolate == NULL) { |
379 if (FLAG_trace_service) { | 363 if (FLAG_trace_service) { |
380 OS::PrintErr("vm-service: Isolate creation error: %s\n", error); | 364 OS::PrintErr("vm-service: Isolate creation error: %s\n", error); |
381 } | 365 } |
382 ServiceIsolate::SetServiceIsolate(NULL); | 366 ServiceIsolate::SetServiceIsolate(NULL); |
383 ServiceIsolate::FinishedInitializing(); | 367 ServiceIsolate::FinishedInitializing(); |
384 ServiceIsolate::FinishedExiting(); | 368 ServiceIsolate::FinishedExiting(); |
385 return; | 369 return; |
386 } | 370 } |
387 | 371 |
388 bool got_unwind; | 372 bool got_unwind; |
389 { | 373 { |
390 ASSERT(Isolate::Current() == NULL); | 374 ASSERT(Isolate::Current() == NULL); |
391 StartIsolateScope start_scope(isolate); | 375 StartIsolateScope start_scope(isolate); |
392 ServiceIsolate::ConstructExitMessageAndCache(isolate); | 376 ServiceIsolate::ConstructExitMessageAndCache(isolate); |
393 got_unwind = RunMain(isolate); | 377 got_unwind = RunMain(isolate); |
394 } | 378 } |
395 | 379 |
396 if (got_unwind) { | 380 if (got_unwind) { |
397 ShutdownIsolate(reinterpret_cast<uword>(isolate)); | 381 ShutdownIsolate(reinterpret_cast<uword>(isolate)); |
398 return; | 382 return; |
399 } | 383 } |
400 | 384 |
401 ServiceIsolate::FinishedInitializing(); | 385 ServiceIsolate::FinishedInitializing(); |
402 | 386 |
403 isolate->message_handler()->Run(Dart::thread_pool(), | 387 isolate->message_handler()->Run(Dart::thread_pool(), NULL, ShutdownIsolate, |
404 NULL, | |
405 ShutdownIsolate, | |
406 reinterpret_cast<uword>(isolate)); | 388 reinterpret_cast<uword>(isolate)); |
407 } | 389 } |
408 | 390 |
409 protected: | 391 protected: |
410 static void ShutdownIsolate(uword parameter) { | 392 static void ShutdownIsolate(uword parameter) { |
411 if (FLAG_trace_service) { | 393 if (FLAG_trace_service) { |
412 OS::Print("vm-service: ShutdownIsolate\n"); | 394 OS::Print("vm-service: ShutdownIsolate\n"); |
413 } | 395 } |
414 Isolate* I = reinterpret_cast<Isolate*>(parameter); | 396 Isolate* I = reinterpret_cast<Isolate*>(parameter); |
415 ASSERT(ServiceIsolate::IsServiceIsolate(I)); | 397 ASSERT(ServiceIsolate::IsServiceIsolate(I)); |
(...skipping 27 matching lines...) Expand all Loading... |
443 } | 425 } |
444 ServiceIsolate::FinishedExiting(); | 426 ServiceIsolate::FinishedExiting(); |
445 } | 427 } |
446 | 428 |
447 bool RunMain(Isolate* I) { | 429 bool RunMain(Isolate* I) { |
448 Thread* T = Thread::Current(); | 430 Thread* T = Thread::Current(); |
449 ASSERT(I == T->isolate()); | 431 ASSERT(I == T->isolate()); |
450 StackZone zone(T); | 432 StackZone zone(T); |
451 HANDLESCOPE(T); | 433 HANDLESCOPE(T); |
452 // Invoke main which will return the loadScriptPort. | 434 // Invoke main which will return the loadScriptPort. |
453 const Library& root_library = Library::Handle(Z, | 435 const Library& root_library = |
454 I->object_store()->root_library()); | 436 Library::Handle(Z, I->object_store()->root_library()); |
455 if (root_library.IsNull()) { | 437 if (root_library.IsNull()) { |
456 if (FLAG_trace_service) { | 438 if (FLAG_trace_service) { |
457 OS::Print("vm-service: Embedder did not install a script."); | 439 OS::Print("vm-service: Embedder did not install a script."); |
458 } | 440 } |
459 // Service isolate is not supported by embedder. | 441 // Service isolate is not supported by embedder. |
460 return false; | 442 return false; |
461 } | 443 } |
462 ASSERT(!root_library.IsNull()); | 444 ASSERT(!root_library.IsNull()); |
463 const String& entry_name = String::Handle(Z, String::New("main")); | 445 const String& entry_name = String::Handle(Z, String::New("main")); |
464 ASSERT(!entry_name.IsNull()); | 446 ASSERT(!entry_name.IsNull()); |
465 const Function& entry = Function::Handle(Z, | 447 const Function& entry = Function::Handle( |
466 root_library.LookupFunctionAllowPrivate(entry_name)); | 448 Z, root_library.LookupFunctionAllowPrivate(entry_name)); |
467 if (entry.IsNull()) { | 449 if (entry.IsNull()) { |
468 // Service isolate is not supported by embedder. | 450 // Service isolate is not supported by embedder. |
469 if (FLAG_trace_service) { | 451 if (FLAG_trace_service) { |
470 OS::Print("vm-service: Embedder did not provide a main function."); | 452 OS::Print("vm-service: Embedder did not provide a main function."); |
471 } | 453 } |
472 return false; | 454 return false; |
473 } | 455 } |
474 ASSERT(!entry.IsNull()); | 456 ASSERT(!entry.IsNull()); |
475 const Object& result = Object::Handle(Z, | 457 const Object& result = Object::Handle( |
476 DartEntry::InvokeFunction(entry, Object::empty_array())); | 458 Z, DartEntry::InvokeFunction(entry, Object::empty_array())); |
477 ASSERT(!result.IsNull()); | 459 ASSERT(!result.IsNull()); |
478 if (result.IsError()) { | 460 if (result.IsError()) { |
479 // Service isolate did not initialize properly. | 461 // Service isolate did not initialize properly. |
480 if (FLAG_trace_service) { | 462 if (FLAG_trace_service) { |
481 const Error& error = Error::Cast(result); | 463 const Error& error = Error::Cast(result); |
482 OS::Print("vm-service: Calling main resulted in an error: %s", | 464 OS::Print("vm-service: Calling main resulted in an error: %s", |
483 error.ToErrorCString()); | 465 error.ToErrorCString()); |
484 } | 466 } |
485 if (result.IsUnwindError()) { | 467 if (result.IsUnwindError()) { |
486 return true; | 468 return true; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 } | 531 } |
550 } | 532 } |
551 | 533 |
552 | 534 |
553 void ServiceIsolate::BootVmServiceLibrary() { | 535 void ServiceIsolate::BootVmServiceLibrary() { |
554 Thread* thread = Thread::Current(); | 536 Thread* thread = Thread::Current(); |
555 const Library& vmservice_library = | 537 const Library& vmservice_library = |
556 Library::Handle(Library::LookupLibrary(thread, Symbols::DartVMService())); | 538 Library::Handle(Library::LookupLibrary(thread, Symbols::DartVMService())); |
557 ASSERT(!vmservice_library.IsNull()); | 539 ASSERT(!vmservice_library.IsNull()); |
558 const String& boot_function_name = String::Handle(String::New("boot")); | 540 const String& boot_function_name = String::Handle(String::New("boot")); |
559 const Function& boot_function = | 541 const Function& boot_function = Function::Handle( |
560 Function::Handle( | 542 vmservice_library.LookupFunctionAllowPrivate(boot_function_name)); |
561 vmservice_library.LookupFunctionAllowPrivate(boot_function_name)); | |
562 ASSERT(!boot_function.IsNull()); | 543 ASSERT(!boot_function.IsNull()); |
563 const Object& result = | 544 const Object& result = Object::Handle( |
564 Object::Handle( | 545 DartEntry::InvokeFunction(boot_function, Object::empty_array())); |
565 DartEntry::InvokeFunction(boot_function, Object::empty_array())); | |
566 ASSERT(!result.IsNull()); | 546 ASSERT(!result.IsNull()); |
567 Dart_Port port = ILLEGAL_PORT; | 547 Dart_Port port = ILLEGAL_PORT; |
568 if (result.IsReceivePort()) { | 548 if (result.IsReceivePort()) { |
569 port = ReceivePort::Cast(result).Id(); | 549 port = ReceivePort::Cast(result).Id(); |
570 } | 550 } |
571 ASSERT(port != ILLEGAL_PORT); | 551 ASSERT(port != ILLEGAL_PORT); |
572 ServiceIsolate::SetServicePort(port); | 552 ServiceIsolate::SetServicePort(port); |
573 } | 553 } |
574 | 554 |
575 | 555 |
576 void ServiceIsolate::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 556 void ServiceIsolate::VisitObjectPointers(ObjectPointerVisitor* visitor) {} |
577 } | |
578 | 557 |
579 } // namespace dart | 558 } // namespace dart |
OLD | NEW |