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::InitOnce(); | |
zra
2017/02/08 17:42:55
What's the reason for moving this around? If it's
bkonyi
2017/02/09 21:22:46
The stack trace collection relies on StubCode bein
| |
236 #endif | 236 #endif |
237 } else { | 237 } else { |
238 return strdup("Invalid vm isolate snapshot seen"); | 238 return strdup("Invalid vm isolate snapshot seen"); |
239 } | 239 } |
240 FullSnapshotReader reader(snapshot, instructions_snapshot, T); | 240 FullSnapshotReader reader(snapshot, instructions_snapshot, T); |
241 const Error& error = Error::Handle(reader.ReadVMSnapshot()); | 241 const Error& error = Error::Handle(reader.ReadVMSnapshot()); |
242 if (!error.IsNull()) { | 242 if (!error.IsNull()) { |
243 // Must copy before leaving the zone. | 243 // Must copy before leaving the zone. |
244 return strdup(error.ToErrorCString()); | 244 return strdup(error.ToErrorCString()); |
245 } | 245 } |
(...skipping 18 matching lines...) Expand all Loading... | |
264 OS::Print("VM Isolate: Symbol table capacity : %" Pd "\n", capacity); | 264 OS::Print("VM Isolate: Symbol table capacity : %" Pd "\n", capacity); |
265 } | 265 } |
266 } else { | 266 } else { |
267 #if defined(DART_PRECOMPILED_RUNTIME) | 267 #if defined(DART_PRECOMPILED_RUNTIME) |
268 return strdup("Precompiled runtime requires a precompiled snapshot"); | 268 return strdup("Precompiled runtime requires a precompiled snapshot"); |
269 #elif !defined(DART_NO_SNAPSHOT) | 269 #elif !defined(DART_NO_SNAPSHOT) |
270 return strdup("Missing vm isolate snapshot"); | 270 return strdup("Missing vm isolate snapshot"); |
271 #else | 271 #else |
272 vm_snapshot_kind_ = Snapshot::kNone; | 272 vm_snapshot_kind_ = Snapshot::kNone; |
273 StubCode::InitOnce(); | 273 StubCode::InitOnce(); |
274 MallocHooks::InitOnce(); | |
274 Symbols::InitOnce(vm_isolate_); | 275 Symbols::InitOnce(vm_isolate_); |
275 #endif | 276 #endif |
276 } | 277 } |
277 // We need to initialize the constants here for the vm isolate thread due to | 278 // We need to initialize the constants here for the vm isolate thread due to |
278 // bootstrapping issues. | 279 // bootstrapping issues. |
279 T->InitVMConstants(); | 280 T->InitVMConstants(); |
280 Scanner::InitOnce(); | 281 Scanner::InitOnce(); |
281 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 282 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
282 // Dart VM requires at least SSE2. | 283 // Dart VM requires at least SSE2. |
283 if (!TargetCPUFeatures::sse2_supported()) { | 284 if (!TargetCPUFeatures::sse2_supported()) { |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
742 return predefined_handles_->handles_.IsValidScopedHandle(address); | 743 return predefined_handles_->handles_.IsValidScopedHandle(address); |
743 } | 744 } |
744 | 745 |
745 | 746 |
746 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { | 747 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { |
747 ASSERT(predefined_handles_ != NULL); | 748 ASSERT(predefined_handles_ != NULL); |
748 return predefined_handles_->api_handles_.IsValidHandle(handle); | 749 return predefined_handles_->api_handles_.IsValidHandle(handle); |
749 } | 750 } |
750 | 751 |
751 } // namespace dart | 752 } // namespace dart |
OLD | NEW |