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/dart_api_state.h" | 7 #include "vm/dart_api_state.h" |
8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
9 #include "vm/freelist.h" | 9 #include "vm/freelist.h" |
10 #include "vm/handles.h" | 10 #include "vm/handles.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 PortMap::InitOnce(); | 61 PortMap::InitOnce(); |
62 FreeListElement::InitOnce(); | 62 FreeListElement::InitOnce(); |
63 Api::InitOnce(); | 63 Api::InitOnce(); |
64 // Create the VM isolate and finish the VM initialization. | 64 // Create the VM isolate and finish the VM initialization. |
65 ASSERT(thread_pool_ == NULL); | 65 ASSERT(thread_pool_ == NULL); |
66 thread_pool_ = new ThreadPool(); | 66 thread_pool_ = new ThreadPool(); |
67 { | 67 { |
68 ASSERT(vm_isolate_ == NULL); | 68 ASSERT(vm_isolate_ == NULL); |
69 ASSERT(Flags::Initialized()); | 69 ASSERT(Flags::Initialized()); |
70 vm_isolate_ = Isolate::Init("vm-isolate"); | 70 vm_isolate_ = Isolate::Init("vm-isolate"); |
71 Zone zone(vm_isolate_); | 71 StackZone zone(vm_isolate_); |
72 HandleScope handle_scope(vm_isolate_); | 72 HandleScope handle_scope(vm_isolate_); |
73 Heap::Init(vm_isolate_); | 73 Heap::Init(vm_isolate_); |
74 ObjectStore::Init(vm_isolate_); | 74 ObjectStore::Init(vm_isolate_); |
75 Object::InitOnce(); | 75 Object::InitOnce(); |
76 StubCode::InitOnce(); | 76 StubCode::InitOnce(); |
77 Scanner::InitOnce(); | 77 Scanner::InitOnce(); |
78 Symbols::InitOnce(vm_isolate_); | 78 Symbols::InitOnce(vm_isolate_); |
79 CPUFeatures::InitOnce(); | 79 CPUFeatures::InitOnce(); |
80 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 80 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
81 // Dart VM requires at least SSE3. | 81 // Dart VM requires at least SSE3. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 } | 125 } |
126 } | 126 } |
127 } | 127 } |
128 | 128 |
129 | 129 |
130 RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) { | 130 RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) { |
131 // Initialize the new isolate. | 131 // Initialize the new isolate. |
132 TIMERSCOPE(time_isolate_initialization); | 132 TIMERSCOPE(time_isolate_initialization); |
133 Isolate* isolate = Isolate::Current(); | 133 Isolate* isolate = Isolate::Current(); |
134 ASSERT(isolate != NULL); | 134 ASSERT(isolate != NULL); |
135 Zone zone(isolate); | 135 StackZone zone(isolate); |
136 HandleScope handle_scope(isolate); | 136 HandleScope handle_scope(isolate); |
137 Heap::Init(isolate); | 137 Heap::Init(isolate); |
138 ObjectStore::Init(isolate); | 138 ObjectStore::Init(isolate); |
139 | 139 |
140 if (snapshot_buffer == NULL) { | 140 if (snapshot_buffer == NULL) { |
141 const Error& error = Error::Handle(Object::Init(isolate)); | 141 const Error& error = Error::Handle(Object::Init(isolate)); |
142 if (!error.IsNull()) { | 142 if (!error.IsNull()) { |
143 return error.raw(); | 143 return error.raw(); |
144 } | 144 } |
145 } else { | 145 } else { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 isolate->Shutdown(); | 183 isolate->Shutdown(); |
184 delete isolate; | 184 delete isolate; |
185 | 185 |
186 Dart_IsolateShutdownCallback callback = Isolate::ShutdownCallback(); | 186 Dart_IsolateShutdownCallback callback = Isolate::ShutdownCallback(); |
187 if (callback != NULL) { | 187 if (callback != NULL) { |
188 (callback)(callback_data); | 188 (callback)(callback_data); |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 } // namespace dart | 192 } // namespace dart |
OLD | NEW |