| 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 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(); | 
| 236 #endif | 242 #endif | 
| 237       } else { | 243       } else { | 
| 238         return strdup("Invalid vm isolate snapshot seen"); | 244         return strdup("Invalid vm isolate snapshot seen"); | 
| 239       } | 245       } | 
| 240       FullSnapshotReader reader(snapshot, instructions_snapshot, T); | 246       FullSnapshotReader reader(snapshot, instructions_snapshot, T); | 
| 241       const Error& error = Error::Handle(reader.ReadVMSnapshot()); | 247       const Error& error = Error::Handle(reader.ReadVMSnapshot()); | 
| 242       if (!error.IsNull()) { | 248       if (!error.IsNull()) { | 
| 243         // Must copy before leaving the zone. | 249         // Must copy before leaving the zone. | 
| 244         return strdup(error.ToErrorCString()); | 250         return strdup(error.ToErrorCString()); | 
| 245       } | 251       } | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 264         OS::Print("VM Isolate: Symbol table capacity : %" Pd "\n", capacity); | 270         OS::Print("VM Isolate: Symbol table capacity : %" Pd "\n", capacity); | 
| 265       } | 271       } | 
| 266     } else { | 272     } else { | 
| 267 #if defined(DART_PRECOMPILED_RUNTIME) | 273 #if defined(DART_PRECOMPILED_RUNTIME) | 
| 268       return strdup("Precompiled runtime requires a precompiled snapshot"); | 274       return strdup("Precompiled runtime requires a precompiled snapshot"); | 
| 269 #elif !defined(DART_NO_SNAPSHOT) | 275 #elif !defined(DART_NO_SNAPSHOT) | 
| 270       return strdup("Missing vm isolate snapshot"); | 276       return strdup("Missing vm isolate snapshot"); | 
| 271 #else | 277 #else | 
| 272       vm_snapshot_kind_ = Snapshot::kNone; | 278       vm_snapshot_kind_ = Snapshot::kNone; | 
| 273       StubCode::InitOnce(); | 279       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(); | 
| 274       Symbols::InitOnce(vm_isolate_); | 287       Symbols::InitOnce(vm_isolate_); | 
| 275 #endif | 288 #endif | 
| 276     } | 289     } | 
| 277     // We need to initialize the constants here for the vm isolate thread due to | 290     // We need to initialize the constants here for the vm isolate thread due to | 
| 278     // bootstrapping issues. | 291     // bootstrapping issues. | 
| 279     T->InitVMConstants(); | 292     T->InitVMConstants(); | 
| 280     Scanner::InitOnce(); | 293     Scanner::InitOnce(); | 
| 281 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 294 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 
| 282     // Dart VM requires at least SSE2. | 295     // Dart VM requires at least SSE2. | 
| 283     if (!TargetCPUFeatures::sse2_supported()) { | 296     if (!TargetCPUFeatures::sse2_supported()) { | 
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 745   return predefined_handles_->handles_.IsValidScopedHandle(address); | 758   return predefined_handles_->handles_.IsValidScopedHandle(address); | 
| 746 } | 759 } | 
| 747 | 760 | 
| 748 | 761 | 
| 749 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { | 762 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { | 
| 750   ASSERT(predefined_handles_ != NULL); | 763   ASSERT(predefined_handles_ != NULL); | 
| 751   return predefined_handles_->api_handles_.IsValidHandle(handle); | 764   return predefined_handles_->api_handles_.IsValidHandle(handle); | 
| 752 } | 765 } | 
| 753 | 766 | 
| 754 }  // namespace dart | 767 }  // namespace dart | 
| OLD | NEW | 
|---|