OLD | NEW |
1 // Copyright (c) 2011, 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/flags.h" | 9 #include "vm/flags.h" |
9 #include "vm/freelist.h" | 10 #include "vm/freelist.h" |
10 #include "vm/handles.h" | 11 #include "vm/handles.h" |
11 #include "vm/heap.h" | 12 #include "vm/heap.h" |
12 #include "vm/isolate.h" | 13 #include "vm/isolate.h" |
13 #include "vm/object.h" | 14 #include "vm/object.h" |
14 #include "vm/object_store.h" | 15 #include "vm/object_store.h" |
15 #include "vm/port.h" | 16 #include "vm/port.h" |
16 #include "vm/snapshot.h" | 17 #include "vm/snapshot.h" |
17 #include "vm/stub_code.h" | 18 #include "vm/stub_code.h" |
18 #include "vm/virtual_memory.h" | 19 #include "vm/virtual_memory.h" |
19 #include "vm/zone.h" | 20 #include "vm/zone.h" |
20 | 21 |
21 namespace dart { | 22 namespace dart { |
22 | 23 |
23 Isolate* Dart::vm_isolate_ = NULL; | 24 Isolate* Dart::vm_isolate_ = NULL; |
24 DebugInfo* Dart::pprof_symbol_generator_ = NULL; | 25 DebugInfo* Dart::pprof_symbol_generator_ = NULL; |
25 | 26 |
26 bool Dart::InitOnce(Dart_IsolateCreateCallback create, | 27 bool Dart::InitOnce(Dart_IsolateCreateCallback create, |
27 Dart_IsolateInterruptCallback interrupt) { | 28 Dart_IsolateInterruptCallback interrupt) { |
28 // TODO(iposva): Fix race condition here. | 29 // TODO(iposva): Fix race condition here. |
29 if (vm_isolate_ != NULL || !Flags::Initialized()) { | 30 if (vm_isolate_ != NULL || !Flags::Initialized()) { |
30 return false; | 31 return false; |
31 } | 32 } |
32 OS::InitOnce(); | 33 OS::InitOnce(); |
33 VirtualMemory::InitOnce(); | 34 VirtualMemory::InitOnce(); |
34 Isolate::InitOnce(); | 35 Isolate::InitOnce(); |
35 PortMap::InitOnce(); | 36 PortMap::InitOnce(); |
36 FreeListElement::InitOnce(); | 37 FreeListElement::InitOnce(); |
| 38 Api::InitOnce(); |
37 // Create the VM isolate and finish the VM initialization. | 39 // Create the VM isolate and finish the VM initialization. |
38 { | 40 { |
39 ASSERT(vm_isolate_ == NULL); | 41 ASSERT(vm_isolate_ == NULL); |
40 ASSERT(Flags::Initialized()); | 42 ASSERT(Flags::Initialized()); |
41 vm_isolate_ = Isolate::Init("vm-isolate"); | 43 vm_isolate_ = Isolate::Init("vm-isolate"); |
42 Zone zone(vm_isolate_); | 44 Zone zone(vm_isolate_); |
43 HandleScope handle_scope(vm_isolate_); | 45 HandleScope handle_scope(vm_isolate_); |
44 Heap::Init(vm_isolate_); | 46 Heap::Init(vm_isolate_); |
45 ObjectStore::Init(vm_isolate_); | 47 ObjectStore::Init(vm_isolate_); |
46 Object::InitOnce(); | 48 Object::InitOnce(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 95 } |
94 | 96 |
95 | 97 |
96 void Dart::ShutdownIsolate() { | 98 void Dart::ShutdownIsolate() { |
97 Isolate* isolate = Isolate::Current(); | 99 Isolate* isolate = Isolate::Current(); |
98 isolate->Shutdown(); | 100 isolate->Shutdown(); |
99 delete isolate; | 101 delete isolate; |
100 } | 102 } |
101 | 103 |
102 } // namespace dart | 104 } // namespace dart |
OLD | NEW |