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/become.h" | 7 #include "vm/become.h" |
8 #include "vm/clustered_snapshot.h" | 8 #include "vm/clustered_snapshot.h" |
9 #include "vm/code_observers.h" | 9 #include "vm/code_observers.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 FLAG_verify_gc_contains = true; | 145 FLAG_verify_gc_contains = true; |
146 } | 146 } |
147 #endif | 147 #endif |
148 set_thread_exit_callback(thread_exit); | 148 set_thread_exit_callback(thread_exit); |
149 SetFileCallbacks(file_open, file_read, file_write, file_close); | 149 SetFileCallbacks(file_open, file_read, file_write, file_close); |
150 set_entropy_source_callback(entropy_source); | 150 set_entropy_source_callback(entropy_source); |
151 OS::InitOnce(); | 151 OS::InitOnce(); |
152 start_time_micros_ = OS::GetCurrentMonotonicMicros(); | 152 start_time_micros_ = OS::GetCurrentMonotonicMicros(); |
153 VirtualMemory::InitOnce(); | 153 VirtualMemory::InitOnce(); |
154 OSThread::InitOnce(); | 154 OSThread::InitOnce(); |
155 MallocHooks::InitOnce(); | |
156 if (FLAG_support_timeline) { | 155 if (FLAG_support_timeline) { |
157 Timeline::InitOnce(); | 156 Timeline::InitOnce(); |
158 } | 157 } |
159 NOT_IN_PRODUCT( | 158 NOT_IN_PRODUCT( |
160 TimelineDurationScope tds(Timeline::GetVMStream(), "Dart::InitOnce")); | 159 TimelineDurationScope tds(Timeline::GetVMStream(), "Dart::InitOnce")); |
161 Isolate::InitOnce(); | 160 Isolate::InitOnce(); |
162 PortMap::InitOnce(); | 161 PortMap::InitOnce(); |
163 FreeListElement::InitOnce(); | 162 FreeListElement::InitOnce(); |
164 ForwardingCorpse::InitOnce(); | 163 ForwardingCorpse::InitOnce(); |
165 Api::InitOnce(); | 164 Api::InitOnce(); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 #endif | 225 #endif |
227 } | 226 } |
228 if (instructions_snapshot == NULL) { | 227 if (instructions_snapshot == NULL) { |
229 return strdup("Missing instructions snapshot"); | 228 return strdup("Missing instructions snapshot"); |
230 } | 229 } |
231 } else if (Snapshot::IsFull(vm_snapshot_kind_)) { | 230 } else if (Snapshot::IsFull(vm_snapshot_kind_)) { |
232 #if defined(DART_PRECOMPILED_RUNTIME) | 231 #if defined(DART_PRECOMPILED_RUNTIME) |
233 return strdup("Precompiled runtime requires a precompiled snapshot"); | 232 return strdup("Precompiled runtime requires a precompiled snapshot"); |
234 #else | 233 #else |
235 StubCode::InitOnce(); | 234 StubCode::InitOnce(); |
235 // MallocHooks can't be initialized until StubCode has been. | |
Cutch
2017/02/15 08:21:00
maybe add why?
bkonyi
2017/02/16 00:28:28
Done.
| |
236 MallocHooks::InitOnce(); | |
236 #endif | 237 #endif |
237 } else { | 238 } else { |
238 return strdup("Invalid vm isolate snapshot seen"); | 239 return strdup("Invalid vm isolate snapshot seen"); |
239 } | 240 } |
240 FullSnapshotReader reader(snapshot, instructions_snapshot, T); | 241 FullSnapshotReader reader(snapshot, instructions_snapshot, T); |
241 const Error& error = Error::Handle(reader.ReadVMSnapshot()); | 242 const Error& error = Error::Handle(reader.ReadVMSnapshot()); |
242 if (!error.IsNull()) { | 243 if (!error.IsNull()) { |
243 // Must copy before leaving the zone. | 244 // Must copy before leaving the zone. |
244 return strdup(error.ToErrorCString()); | 245 return strdup(error.ToErrorCString()); |
245 } | 246 } |
(...skipping 18 matching lines...) Expand all Loading... | |
264 OS::Print("VM Isolate: Symbol table capacity : %" Pd "\n", capacity); | 265 OS::Print("VM Isolate: Symbol table capacity : %" Pd "\n", capacity); |
265 } | 266 } |
266 } else { | 267 } else { |
267 #if defined(DART_PRECOMPILED_RUNTIME) | 268 #if defined(DART_PRECOMPILED_RUNTIME) |
268 return strdup("Precompiled runtime requires a precompiled snapshot"); | 269 return strdup("Precompiled runtime requires a precompiled snapshot"); |
269 #elif !defined(DART_NO_SNAPSHOT) | 270 #elif !defined(DART_NO_SNAPSHOT) |
270 return strdup("Missing vm isolate snapshot"); | 271 return strdup("Missing vm isolate snapshot"); |
271 #else | 272 #else |
272 vm_snapshot_kind_ = Snapshot::kNone; | 273 vm_snapshot_kind_ = Snapshot::kNone; |
273 StubCode::InitOnce(); | 274 StubCode::InitOnce(); |
275 // Malloc hooks can't be initialized until StubCode has been. | |
276 MallocHooks::InitOnce(); | |
zra
2017/02/15 05:50:45
Maybe add a TODO to separate initialization of the
bkonyi
2017/02/16 00:28:28
Done.
| |
274 Symbols::InitOnce(vm_isolate_); | 277 Symbols::InitOnce(vm_isolate_); |
275 #endif | 278 #endif |
276 } | 279 } |
277 // We need to initialize the constants here for the vm isolate thread due to | 280 // We need to initialize the constants here for the vm isolate thread due to |
278 // bootstrapping issues. | 281 // bootstrapping issues. |
279 T->InitVMConstants(); | 282 T->InitVMConstants(); |
280 Scanner::InitOnce(); | 283 Scanner::InitOnce(); |
281 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 284 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
282 // Dart VM requires at least SSE2. | 285 // Dart VM requires at least SSE2. |
283 if (!TargetCPUFeatures::sse2_supported()) { | 286 if (!TargetCPUFeatures::sse2_supported()) { |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
742 return predefined_handles_->handles_.IsValidScopedHandle(address); | 745 return predefined_handles_->handles_.IsValidScopedHandle(address); |
743 } | 746 } |
744 | 747 |
745 | 748 |
746 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { | 749 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { |
747 ASSERT(predefined_handles_ != NULL); | 750 ASSERT(predefined_handles_ != NULL); |
748 return predefined_handles_->api_handles_.IsValidHandle(handle); | 751 return predefined_handles_->api_handles_.IsValidHandle(handle); |
749 } | 752 } |
750 | 753 |
751 } // namespace dart | 754 } // namespace dart |
OLD | NEW |