OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/dart.h" | 5 #include "vm/dart.h" |
6 | 6 |
7 #include "vm/code_index_table.h" | 7 #include "vm/code_index_table.h" |
8 #include "vm/dart_api_state.h" | 8 #include "vm/dart_api_state.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/freelist.h" | 10 #include "vm/freelist.h" |
11 #include "vm/handles.h" | 11 #include "vm/handles.h" |
12 #include "vm/heap.h" | 12 #include "vm/heap.h" |
13 #include "vm/isolate.h" | 13 #include "vm/isolate.h" |
14 #include "vm/object.h" | 14 #include "vm/object.h" |
15 #include "vm/object_store.h" | 15 #include "vm/object_store.h" |
16 #include "vm/port.h" | 16 #include "vm/port.h" |
17 #include "vm/snapshot.h" | 17 #include "vm/snapshot.h" |
18 #include "vm/stub_code.h" | 18 #include "vm/stub_code.h" |
| 19 #include "vm/thread_pool.h" |
19 #include "vm/virtual_memory.h" | 20 #include "vm/virtual_memory.h" |
20 #include "vm/zone.h" | 21 #include "vm/zone.h" |
21 | 22 |
22 namespace dart { | 23 namespace dart { |
23 | 24 |
24 DECLARE_FLAG(bool, trace_isolates); | 25 DECLARE_FLAG(bool, trace_isolates); |
25 | 26 |
26 Isolate* Dart::vm_isolate_ = NULL; | 27 Isolate* Dart::vm_isolate_ = NULL; |
| 28 ThreadPool* Dart::thread_pool_ = NULL; |
27 DebugInfo* Dart::pprof_symbol_generator_ = NULL; | 29 DebugInfo* Dart::pprof_symbol_generator_ = NULL; |
28 | 30 |
29 bool Dart::InitOnce(Dart_IsolateCreateCallback create, | 31 bool Dart::InitOnce(Dart_IsolateCreateCallback create, |
30 Dart_IsolateInterruptCallback interrupt) { | 32 Dart_IsolateInterruptCallback interrupt) { |
31 // TODO(iposva): Fix race condition here. | 33 // TODO(iposva): Fix race condition here. |
32 if (vm_isolate_ != NULL || !Flags::Initialized()) { | 34 if (vm_isolate_ != NULL || !Flags::Initialized()) { |
33 return false; | 35 return false; |
34 } | 36 } |
35 OS::InitOnce(); | 37 OS::InitOnce(); |
36 VirtualMemory::InitOnce(); | 38 VirtualMemory::InitOnce(); |
37 Isolate::InitOnce(); | 39 Isolate::InitOnce(); |
38 PortMap::InitOnce(); | 40 PortMap::InitOnce(); |
39 FreeListElement::InitOnce(); | 41 FreeListElement::InitOnce(); |
40 Api::InitOnce(); | 42 Api::InitOnce(); |
41 // Create the VM isolate and finish the VM initialization. | 43 // Create the VM isolate and finish the VM initialization. |
| 44 ASSERT(thread_pool_ == NULL); |
| 45 thread_pool_ = new ThreadPool(); |
42 { | 46 { |
43 ASSERT(vm_isolate_ == NULL); | 47 ASSERT(vm_isolate_ == NULL); |
44 ASSERT(Flags::Initialized()); | 48 ASSERT(Flags::Initialized()); |
45 vm_isolate_ = Isolate::Init("vm-isolate"); | 49 vm_isolate_ = Isolate::Init("vm-isolate"); |
46 Zone zone(vm_isolate_); | 50 Zone zone(vm_isolate_); |
47 HandleScope handle_scope(vm_isolate_); | 51 HandleScope handle_scope(vm_isolate_); |
48 Heap::Init(vm_isolate_); | 52 Heap::Init(vm_isolate_); |
49 ObjectStore::Init(vm_isolate_); | 53 ObjectStore::Init(vm_isolate_); |
50 Object::InitOnce(); | 54 Object::InitOnce(); |
51 StubCode::InitOnce(); | 55 StubCode::InitOnce(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 104 } |
101 | 105 |
102 | 106 |
103 void Dart::ShutdownIsolate() { | 107 void Dart::ShutdownIsolate() { |
104 Isolate* isolate = Isolate::Current(); | 108 Isolate* isolate = Isolate::Current(); |
105 isolate->Shutdown(); | 109 isolate->Shutdown(); |
106 delete isolate; | 110 delete isolate; |
107 } | 111 } |
108 | 112 |
109 } // namespace dart | 113 } // namespace dart |
OLD | NEW |