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/dart.h" | 5 #include "vm/dart.h" |
6 | 6 |
7 #include "vm/code_observers.h" | 7 #include "vm/code_observers.h" |
8 #include "vm/dart_api_state.h" | 8 #include "vm/dart_api_state.h" |
9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
11 #include "vm/freelist.h" | 11 #include "vm/freelist.h" |
12 #include "vm/handles.h" | 12 #include "vm/handles.h" |
13 #include "vm/heap.h" | 13 #include "vm/heap.h" |
14 #include "vm/isolate.h" | 14 #include "vm/isolate.h" |
15 #include "vm/object.h" | 15 #include "vm/object.h" |
16 #include "vm/object_store.h" | 16 #include "vm/object_store.h" |
17 #include "vm/object_id_ring.h" | 17 #include "vm/object_id_ring.h" |
18 #include "vm/port.h" | 18 #include "vm/port.h" |
19 #include "vm/profiler.h" | 19 #include "vm/profiler.h" |
20 #include "vm/simulator.h" | 20 #include "vm/simulator.h" |
21 #include "vm/snapshot.h" | 21 #include "vm/snapshot.h" |
22 #include "vm/stub_code.h" | 22 #include "vm/stub_code.h" |
23 #include "vm/symbols.h" | 23 #include "vm/symbols.h" |
| 24 #include "vm/thread_interrupter.h" |
24 #include "vm/thread_pool.h" | 25 #include "vm/thread_pool.h" |
25 #include "vm/virtual_memory.h" | 26 #include "vm/virtual_memory.h" |
26 #include "vm/zone.h" | 27 #include "vm/zone.h" |
27 | 28 |
28 namespace dart { | 29 namespace dart { |
29 | 30 |
30 DEFINE_FLAG(bool, heap_profile_initialize, false, | 31 DEFINE_FLAG(bool, heap_profile_initialize, false, |
31 "Writes a heap profile on isolate initialization."); | 32 "Writes a heap profile on isolate initialization."); |
32 DECLARE_FLAG(bool, print_class_table); | 33 DECLARE_FLAG(bool, print_class_table); |
33 DECLARE_FLAG(bool, trace_isolates); | 34 DECLARE_FLAG(bool, trace_isolates); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 91 } |
91 Isolate::SetFileCallbacks(file_open, file_read, file_write, file_close); | 92 Isolate::SetFileCallbacks(file_open, file_read, file_write, file_close); |
92 Isolate::SetEntropySourceCallback(entropy_source); | 93 Isolate::SetEntropySourceCallback(entropy_source); |
93 OS::InitOnce(); | 94 OS::InitOnce(); |
94 VirtualMemory::InitOnce(); | 95 VirtualMemory::InitOnce(); |
95 Isolate::InitOnce(); | 96 Isolate::InitOnce(); |
96 PortMap::InitOnce(); | 97 PortMap::InitOnce(); |
97 FreeListElement::InitOnce(); | 98 FreeListElement::InitOnce(); |
98 Api::InitOnce(); | 99 Api::InitOnce(); |
99 CodeObservers::InitOnce(); | 100 CodeObservers::InitOnce(); |
100 ProfilerManager::InitOnce(); | 101 Profiler::InitOnce(); |
101 #if defined(USING_SIMULATOR) | 102 #if defined(USING_SIMULATOR) |
102 Simulator::InitOnce(); | 103 Simulator::InitOnce(); |
103 #endif | 104 #endif |
104 // Create the read-only handles area. | 105 // Create the read-only handles area. |
105 ASSERT(predefined_handles_ == NULL); | 106 ASSERT(predefined_handles_ == NULL); |
106 predefined_handles_ = new ReadOnlyHandles(); | 107 predefined_handles_ = new ReadOnlyHandles(); |
107 // Create the VM isolate and finish the VM initialization. | 108 // Create the VM isolate and finish the VM initialization. |
108 ASSERT(thread_pool_ == NULL); | 109 ASSERT(thread_pool_ == NULL); |
109 thread_pool_ = new ThreadPool(); | 110 thread_pool_ = new ThreadPool(); |
110 { | 111 { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 Isolate::SetCurrent(vm_isolate_); | 166 Isolate::SetCurrent(vm_isolate_); |
166 | 167 |
167 // There is a planned and known asymmetry here: We exit one scope for the VM | 168 // There is a planned and known asymmetry here: We exit one scope for the VM |
168 // isolate to account for the scope that was entered in Dart_InitOnce. | 169 // isolate to account for the scope that was entered in Dart_InitOnce. |
169 Dart_ExitScope(); | 170 Dart_ExitScope(); |
170 | 171 |
171 ShutdownIsolate(); | 172 ShutdownIsolate(); |
172 vm_isolate_ = NULL; | 173 vm_isolate_ = NULL; |
173 #endif | 174 #endif |
174 | 175 |
175 ProfilerManager::Shutdown(); | 176 Profiler::Shutdown(); |
176 CodeObservers::DeleteAll(); | 177 CodeObservers::DeleteAll(); |
177 | 178 |
178 return NULL; | 179 return NULL; |
179 } | 180 } |
180 | 181 |
181 | 182 |
182 Isolate* Dart::CreateIsolate(const char* name_prefix) { | 183 Isolate* Dart::CreateIsolate(const char* name_prefix) { |
183 // Create a new isolate. | 184 // Create a new isolate. |
184 Isolate* isolate = Isolate::Init(name_prefix); | 185 Isolate* isolate = Isolate::Init(name_prefix); |
185 ASSERT(isolate != NULL); | 186 ASSERT(isolate != NULL); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 return predefined_handles_->handles_.AllocateScopedHandle(); | 271 return predefined_handles_->handles_.AllocateScopedHandle(); |
271 } | 272 } |
272 | 273 |
273 | 274 |
274 bool Dart::IsReadOnlyHandle(uword address) { | 275 bool Dart::IsReadOnlyHandle(uword address) { |
275 ASSERT(predefined_handles_ != NULL); | 276 ASSERT(predefined_handles_ != NULL); |
276 return predefined_handles_->handles_.IsValidScopedHandle(address); | 277 return predefined_handles_->handles_.IsValidScopedHandle(address); |
277 } | 278 } |
278 | 279 |
279 } // namespace dart | 280 } // namespace dart |
OLD | NEW |