OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/flags.h" | 8 #include "vm/flags.h" |
9 #include "vm/handles.h" | 9 #include "vm/handles.h" |
10 #include "vm/heap.h" | 10 #include "vm/heap.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 bool Dart::InitOnce(int argc, const char** argv, | 26 bool Dart::InitOnce(int argc, const char** argv, |
27 Dart_IsolateInitCallback callback) { | 27 Dart_IsolateInitCallback callback) { |
28 // TODO(iposva): Fix race condition here. | 28 // TODO(iposva): Fix race condition here. |
29 if (vm_isolate_ != NULL) { | 29 if (vm_isolate_ != NULL) { |
30 return false; | 30 return false; |
31 } | 31 } |
32 OS::InitOnce(); | 32 OS::InitOnce(); |
33 Flags::ProcessCommandLineFlags(argc, argv); | 33 Flags::ProcessCommandLineFlags(argc, argv); |
34 VirtualMemory::InitOnce(); | 34 VirtualMemory::InitOnce(); |
35 Isolate::InitOnce(); | 35 Isolate::InitOnce(); |
| 36 PortMap::InitOnce(); |
36 // Create the VM isolate and finish the VM initialization. | 37 // Create the VM isolate and finish the VM initialization. |
37 { | 38 { |
38 ASSERT(vm_isolate_ == NULL); | 39 ASSERT(vm_isolate_ == NULL); |
39 vm_isolate_ = Isolate::Init(); | 40 vm_isolate_ = Isolate::Init(); |
40 Zone zone(vm_isolate_); | 41 Zone zone(vm_isolate_); |
41 HandleScope handle_scope(vm_isolate_); | 42 HandleScope handle_scope(vm_isolate_); |
42 Heap::Init(vm_isolate_); | 43 Heap::Init(vm_isolate_); |
43 ObjectStore::Init(vm_isolate_); | 44 ObjectStore::Init(vm_isolate_); |
44 Object::InitOnce(); | 45 Object::InitOnce(); |
45 StubCode::InitOnce(); | 46 StubCode::InitOnce(); |
46 PortMap::InitOnce(); | |
47 Scanner::InitOnce(); | 47 Scanner::InitOnce(); |
48 } | 48 } |
49 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread. | 49 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread. |
50 Isolate::SetInitCallback(callback); | 50 Isolate::SetInitCallback(callback); |
51 return true; | 51 return true; |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 Isolate* Dart::CreateIsolate() { | 55 Isolate* Dart::CreateIsolate() { |
56 // Create and initialize a new isolate. | 56 // Create and initialize a new isolate. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 93 } |
94 | 94 |
95 | 95 |
96 void Dart::ShutdownIsolate() { | 96 void Dart::ShutdownIsolate() { |
97 Isolate* isolate = Isolate::Current(); | 97 Isolate* isolate = Isolate::Current(); |
98 isolate->Shutdown(); | 98 isolate->Shutdown(); |
99 delete isolate; | 99 delete isolate; |
100 } | 100 } |
101 | 101 |
102 } // namespace dart | 102 } // namespace dart |
OLD | NEW |