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/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
6 #include "vm/dart_api_impl.h" | 6 #include "vm/dart_api_impl.h" |
7 #include "vm/datastream.h" | 7 #include "vm/datastream.h" |
8 #include "vm/exceptions.h" | 8 #include "vm/exceptions.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
11 #include "vm/message.h" | 11 #include "vm/message.h" |
12 #include "vm/message_handler.h" | 12 #include "vm/message_handler.h" |
13 #include "vm/native_entry.h" | 13 #include "vm/native_entry.h" |
14 #include "vm/object.h" | 14 #include "vm/object.h" |
15 #include "vm/port.h" | 15 #include "vm/port.h" |
16 #include "vm/service_event.h" | 16 #include "vm/service_event.h" |
17 #include "vm/service_isolate.h" | 17 #include "vm/service_isolate.h" |
18 #include "vm/symbols.h" | 18 #include "vm/symbols.h" |
| 19 #include "vm/kernel_isolate.h" |
19 | 20 |
20 namespace dart { | 21 namespace dart { |
21 | 22 |
22 DECLARE_FLAG(bool, trace_service); | 23 DECLARE_FLAG(bool, trace_service); |
| 24 DECLARE_FLAG(bool, show_kernel_isolate); |
23 | 25 |
24 static uint8_t* malloc_allocator(uint8_t* ptr, | 26 static uint8_t* malloc_allocator(uint8_t* ptr, |
25 intptr_t old_size, | 27 intptr_t old_size, |
26 intptr_t new_size) { | 28 intptr_t new_size) { |
27 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); | 29 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); |
28 return reinterpret_cast<uint8_t*>(new_ptr); | 30 return reinterpret_cast<uint8_t*>(new_ptr); |
29 } | 31 } |
30 | 32 |
31 static void malloc_deallocator(uint8_t* ptr) { | 33 static void malloc_deallocator(uint8_t* ptr) { |
32 free(reinterpret_cast<void*>(ptr)); | 34 free(reinterpret_cast<void*>(ptr)); |
(...skipping 17 matching lines...) Expand all Loading... |
50 // Get function. | 52 // Get function. |
51 const String& function_name = | 53 const String& function_name = |
52 String::Handle(String::New("_registerIsolate")); | 54 String::Handle(String::New("_registerIsolate")); |
53 ASSERT(!function_name.IsNull()); | 55 ASSERT(!function_name.IsNull()); |
54 register_function_ = library.LookupFunctionAllowPrivate(function_name); | 56 register_function_ = library.LookupFunctionAllowPrivate(function_name); |
55 ASSERT(!register_function_.IsNull()); | 57 ASSERT(!register_function_.IsNull()); |
56 } | 58 } |
57 | 59 |
58 virtual void VisitIsolate(Isolate* isolate) { | 60 virtual void VisitIsolate(Isolate* isolate) { |
59 ASSERT(ServiceIsolate::IsServiceIsolate(Isolate::Current())); | 61 ASSERT(ServiceIsolate::IsServiceIsolate(Isolate::Current())); |
60 if (IsVMInternalIsolate(isolate)) { | 62 bool is_kernel_isolate = false; |
61 // We do not register the service (and descendants) or the vm-isolate. | 63 #ifndef DART_PRECOMPILED_RUNTIME |
| 64 is_kernel_isolate = |
| 65 KernelIsolate::IsKernelIsolate(isolate) && !FLAG_show_kernel_isolate; |
| 66 #endif |
| 67 if (IsVMInternalIsolate(isolate) || is_kernel_isolate) { |
| 68 // We do not register the service (and descendants), the vm-isolate, or |
| 69 // the kernel isolate. |
62 return; | 70 return; |
63 } | 71 } |
64 // Setup arguments for call. | 72 // Setup arguments for call. |
65 Dart_Port port_id = isolate->main_port(); | 73 Dart_Port port_id = isolate->main_port(); |
66 const Integer& port_int = Integer::Handle(Integer::New(port_id)); | 74 const Integer& port_int = Integer::Handle(Integer::New(port_id)); |
67 ASSERT(!port_int.IsNull()); | 75 ASSERT(!port_int.IsNull()); |
68 const SendPort& send_port = SendPort::Handle(SendPort::New(port_id)); | 76 const SendPort& send_port = SendPort::Handle(SendPort::New(port_id)); |
69 const String& name = String::Handle(String::New(isolate->name())); | 77 const String& name = String::Handle(String::New(isolate->name())); |
70 ASSERT(!name.IsNull()); | 78 ASSERT(!name.IsNull()); |
71 const Array& args = Array::Handle(Array::New(3)); | 79 const Array& args = Array::Handle(Array::New(3)); |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 ServiceEvent spawn_event(NULL, ServiceEvent::kIsolateSpawn); | 479 ServiceEvent spawn_event(NULL, ServiceEvent::kIsolateSpawn); |
472 spawn_event.set_spawn_token(&token); | 480 spawn_event.set_spawn_token(&token); |
473 spawn_event.set_spawn_error(&String::Cast(result)); | 481 spawn_event.set_spawn_error(&String::Cast(result)); |
474 Service::HandleEvent(&spawn_event); | 482 Service::HandleEvent(&spawn_event); |
475 } | 483 } |
476 #endif // PRODUCT | 484 #endif // PRODUCT |
477 return Object::null(); | 485 return Object::null(); |
478 } | 486 } |
479 | 487 |
480 } // namespace dart | 488 } // namespace dart |
OLD | NEW |