| 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(); |
| 155 if (FLAG_support_timeline) { | 156 if (FLAG_support_timeline) { |
| 156 Timeline::InitOnce(); | 157 Timeline::InitOnce(); |
| 157 } | 158 } |
| 158 NOT_IN_PRODUCT( | 159 NOT_IN_PRODUCT( |
| 159 TimelineDurationScope tds(Timeline::GetVMStream(), "Dart::InitOnce")); | 160 TimelineDurationScope tds(Timeline::GetVMStream(), "Dart::InitOnce")); |
| 160 Isolate::InitOnce(); | 161 Isolate::InitOnce(); |
| 161 PortMap::InitOnce(); | 162 PortMap::InitOnce(); |
| 162 FreeListElement::InitOnce(); | 163 FreeListElement::InitOnce(); |
| 163 ForwardingCorpse::InitOnce(); | 164 ForwardingCorpse::InitOnce(); |
| 164 Api::InitOnce(); | 165 Api::InitOnce(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 #endif | 226 #endif |
| 226 } | 227 } |
| 227 if (instructions_snapshot == NULL) { | 228 if (instructions_snapshot == NULL) { |
| 228 return strdup("Missing instructions snapshot"); | 229 return strdup("Missing instructions snapshot"); |
| 229 } | 230 } |
| 230 } else if (Snapshot::IsFull(vm_snapshot_kind_)) { | 231 } else if (Snapshot::IsFull(vm_snapshot_kind_)) { |
| 231 #if defined(DART_PRECOMPILED_RUNTIME) | 232 #if defined(DART_PRECOMPILED_RUNTIME) |
| 232 return strdup("Precompiled runtime requires a precompiled snapshot"); | 233 return strdup("Precompiled runtime requires a precompiled snapshot"); |
| 233 #else | 234 #else |
| 234 StubCode::InitOnce(); | 235 StubCode::InitOnce(); |
| 235 // MallocHooks can't be initialized until StubCode has been since stack | |
| 236 // trace generation relies on stub methods that are generated in | |
| 237 // StubCode::InitOnce(). | |
| 238 // TODO(bkonyi) Split initialization for stack trace collection from the | |
| 239 // initialization for the actual malloc hooks to increase accuracy of | |
| 240 // memory consumption statistics. | |
| 241 MallocHooks::InitOnce(); | |
| 242 #endif | 236 #endif |
| 243 } else { | 237 } else { |
| 244 return strdup("Invalid vm isolate snapshot seen"); | 238 return strdup("Invalid vm isolate snapshot seen"); |
| 245 } | 239 } |
| 246 FullSnapshotReader reader(snapshot, instructions_snapshot, T); | 240 FullSnapshotReader reader(snapshot, instructions_snapshot, T); |
| 247 const Error& error = Error::Handle(reader.ReadVMSnapshot()); | 241 const Error& error = Error::Handle(reader.ReadVMSnapshot()); |
| 248 if (!error.IsNull()) { | 242 if (!error.IsNull()) { |
| 249 // Must copy before leaving the zone. | 243 // Must copy before leaving the zone. |
| 250 return strdup(error.ToErrorCString()); | 244 return strdup(error.ToErrorCString()); |
| 251 } | 245 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 270 OS::Print("VM Isolate: Symbol table capacity : %" Pd "\n", capacity); | 264 OS::Print("VM Isolate: Symbol table capacity : %" Pd "\n", capacity); |
| 271 } | 265 } |
| 272 } else { | 266 } else { |
| 273 #if defined(DART_PRECOMPILED_RUNTIME) | 267 #if defined(DART_PRECOMPILED_RUNTIME) |
| 274 return strdup("Precompiled runtime requires a precompiled snapshot"); | 268 return strdup("Precompiled runtime requires a precompiled snapshot"); |
| 275 #elif !defined(DART_NO_SNAPSHOT) | 269 #elif !defined(DART_NO_SNAPSHOT) |
| 276 return strdup("Missing vm isolate snapshot"); | 270 return strdup("Missing vm isolate snapshot"); |
| 277 #else | 271 #else |
| 278 vm_snapshot_kind_ = Snapshot::kNone; | 272 vm_snapshot_kind_ = Snapshot::kNone; |
| 279 StubCode::InitOnce(); | 273 StubCode::InitOnce(); |
| 280 // MallocHooks can't be initialized until StubCode has been since stack | |
| 281 // trace generation relies on stub methods that are generated in | |
| 282 // StubCode::InitOnce(). | |
| 283 // TODO(bkonyi) Split initialization for stack trace collection from the | |
| 284 // initialization for the actual malloc hooks to increase accuracy of | |
| 285 // memory consumption statistics. | |
| 286 MallocHooks::InitOnce(); | |
| 287 Symbols::InitOnce(vm_isolate_); | 274 Symbols::InitOnce(vm_isolate_); |
| 288 #endif | 275 #endif |
| 289 } | 276 } |
| 290 // We need to initialize the constants here for the vm isolate thread due to | 277 // We need to initialize the constants here for the vm isolate thread due to |
| 291 // bootstrapping issues. | 278 // bootstrapping issues. |
| 292 T->InitVMConstants(); | 279 T->InitVMConstants(); |
| 293 Scanner::InitOnce(); | 280 Scanner::InitOnce(); |
| 294 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 281 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
| 295 // Dart VM requires at least SSE2. | 282 // Dart VM requires at least SSE2. |
| 296 if (!TargetCPUFeatures::sse2_supported()) { | 283 if (!TargetCPUFeatures::sse2_supported()) { |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 return predefined_handles_->handles_.IsValidScopedHandle(address); | 745 return predefined_handles_->handles_.IsValidScopedHandle(address); |
| 759 } | 746 } |
| 760 | 747 |
| 761 | 748 |
| 762 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { | 749 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { |
| 763 ASSERT(predefined_handles_ != NULL); | 750 ASSERT(predefined_handles_ != NULL); |
| 764 return predefined_handles_->api_handles_.IsValidHandle(handle); | 751 return predefined_handles_->api_handles_.IsValidHandle(handle); |
| 765 } | 752 } |
| 766 | 753 |
| 767 } // namespace dart | 754 } // namespace dart |
| OLD | NEW |