| 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" |
| 11 #include "vm/dart_api_state.h" | 11 #include "vm/dart_api_state.h" |
| 12 #include "vm/dart_entry.h" | 12 #include "vm/dart_entry.h" |
| 13 #include "vm/debugger.h" | 13 #include "vm/debugger.h" |
| 14 #include "vm/flags.h" | 14 #include "vm/flags.h" |
| 15 #include "vm/freelist.h" | 15 #include "vm/freelist.h" |
| 16 #include "vm/handles.h" | 16 #include "vm/handles.h" |
| 17 #include "vm/heap.h" | 17 #include "vm/heap.h" |
| 18 #include "vm/isolate.h" | 18 #include "vm/isolate.h" |
| 19 #include "vm/kernel_isolate.h" | 19 #include "vm/kernel_isolate.h" |
| 20 #include "vm/malloc_hooks.h" | 20 #include "vm/malloc_hooks.h" |
| 21 #include "vm/message_handler.h" | 21 #include "vm/message_handler.h" |
| 22 #include "vm/metrics.h" | 22 #include "vm/metrics.h" |
| 23 #include "vm/object.h" | 23 #include "vm/object.h" |
| 24 #include "vm/object_id_ring.h" |
| 24 #include "vm/object_store.h" | 25 #include "vm/object_store.h" |
| 25 #include "vm/object_id_ring.h" | |
| 26 #include "vm/port.h" | 26 #include "vm/port.h" |
| 27 #include "vm/profiler.h" | 27 #include "vm/profiler.h" |
| 28 #include "vm/service_isolate.h" | 28 #include "vm/service_isolate.h" |
| 29 #include "vm/simulator.h" | 29 #include "vm/simulator.h" |
| 30 #include "vm/snapshot.h" | 30 #include "vm/snapshot.h" |
| 31 #include "vm/store_buffer.h" | 31 #include "vm/store_buffer.h" |
| 32 #include "vm/stub_code.h" | 32 #include "vm/stub_code.h" |
| 33 #include "vm/symbols.h" | 33 #include "vm/symbols.h" |
| 34 #include "vm/thread_interrupter.h" | 34 #include "vm/thread_interrupter.h" |
| 35 #include "vm/thread_pool.h" | 35 #include "vm/thread_pool.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 ReadOnlyHandles() {} | 73 ReadOnlyHandles() {} |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 VMHandles handles_; | 76 VMHandles handles_; |
| 77 LocalHandles api_handles_; | 77 LocalHandles api_handles_; |
| 78 | 78 |
| 79 friend class Dart; | 79 friend class Dart; |
| 80 DISALLOW_COPY_AND_ASSIGN(ReadOnlyHandles); | 80 DISALLOW_COPY_AND_ASSIGN(ReadOnlyHandles); |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 | |
| 84 static void CheckOffsets() { | 83 static void CheckOffsets() { |
| 85 #define CHECK_OFFSET(expr, offset) \ | 84 #define CHECK_OFFSET(expr, offset) \ |
| 86 if ((expr) != (offset)) { \ | 85 if ((expr) != (offset)) { \ |
| 87 FATAL2("%s == %" Pd, #expr, (expr)); \ | 86 FATAL2("%s == %" Pd, #expr, (expr)); \ |
| 88 } | 87 } |
| 89 | 88 |
| 90 #if defined(TARGET_ARCH_ARM) | 89 #if defined(TARGET_ARCH_ARM) |
| 91 // These offsets are embedded in precompiled instructions. We need simarm | 90 // These offsets are embedded in precompiled instructions. We need simarm |
| 92 // (compiler) and arm (runtime) to agree. | 91 // (compiler) and arm (runtime) to agree. |
| 93 CHECK_OFFSET(Heap::TopOffset(Heap::kNew), 8); | 92 CHECK_OFFSET(Heap::TopOffset(Heap::kNew), 8); |
| 94 CHECK_OFFSET(Thread::stack_limit_offset(), 4); | 93 CHECK_OFFSET(Thread::stack_limit_offset(), 4); |
| 95 CHECK_OFFSET(Thread::object_null_offset(), 40); | 94 CHECK_OFFSET(Thread::object_null_offset(), 40); |
| 96 CHECK_OFFSET(SingleTargetCache::upper_limit_offset(), 14); | 95 CHECK_OFFSET(SingleTargetCache::upper_limit_offset(), 14); |
| 97 CHECK_OFFSET(Isolate::object_store_offset(), 28); | 96 CHECK_OFFSET(Isolate::object_store_offset(), 28); |
| 98 NOT_IN_PRODUCT(CHECK_OFFSET(sizeof(ClassHeapStats), 120)); | 97 NOT_IN_PRODUCT(CHECK_OFFSET(sizeof(ClassHeapStats), 120)); |
| 99 #endif | 98 #endif |
| 100 #if defined(TARGET_ARCH_ARM64) | 99 #if defined(TARGET_ARCH_ARM64) |
| 101 // These offsets are embedded in precompiled instructions. We need simarm64 | 100 // These offsets are embedded in precompiled instructions. We need simarm64 |
| 102 // (compiler) and arm64 (runtime) to agree. | 101 // (compiler) and arm64 (runtime) to agree. |
| 103 CHECK_OFFSET(Heap::TopOffset(Heap::kNew), 8); | 102 CHECK_OFFSET(Heap::TopOffset(Heap::kNew), 8); |
| 104 CHECK_OFFSET(Thread::stack_limit_offset(), 8); | 103 CHECK_OFFSET(Thread::stack_limit_offset(), 8); |
| 105 CHECK_OFFSET(Thread::object_null_offset(), 80); | 104 CHECK_OFFSET(Thread::object_null_offset(), 80); |
| 106 CHECK_OFFSET(SingleTargetCache::upper_limit_offset(), 26); | 105 CHECK_OFFSET(SingleTargetCache::upper_limit_offset(), 26); |
| 107 CHECK_OFFSET(Isolate::object_store_offset(), 56); | 106 CHECK_OFFSET(Isolate::object_store_offset(), 56); |
| 108 NOT_IN_PRODUCT(CHECK_OFFSET(sizeof(ClassHeapStats), 208)); | 107 NOT_IN_PRODUCT(CHECK_OFFSET(sizeof(ClassHeapStats), 208)); |
| 109 #endif | 108 #endif |
| 110 #undef CHECK_OFFSET | 109 #undef CHECK_OFFSET |
| 111 } | 110 } |
| 112 | 111 |
| 113 | |
| 114 char* Dart::InitOnce(const uint8_t* vm_isolate_snapshot, | 112 char* Dart::InitOnce(const uint8_t* vm_isolate_snapshot, |
| 115 const uint8_t* instructions_snapshot, | 113 const uint8_t* instructions_snapshot, |
| 116 Dart_IsolateCreateCallback create, | 114 Dart_IsolateCreateCallback create, |
| 117 Dart_IsolateShutdownCallback shutdown, | 115 Dart_IsolateShutdownCallback shutdown, |
| 118 Dart_IsolateCleanupCallback cleanup, | 116 Dart_IsolateCleanupCallback cleanup, |
| 119 Dart_ThreadExitCallback thread_exit, | 117 Dart_ThreadExitCallback thread_exit, |
| 120 Dart_FileOpenCallback file_open, | 118 Dart_FileOpenCallback file_open, |
| 121 Dart_FileReadCallback file_read, | 119 Dart_FileReadCallback file_read, |
| 122 Dart_FileWriteCallback file_write, | 120 Dart_FileWriteCallback file_write, |
| 123 Dart_FileCloseCallback file_close, | 121 Dart_FileCloseCallback file_close, |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 | 310 |
| 313 ServiceIsolate::Run(); | 311 ServiceIsolate::Run(); |
| 314 | 312 |
| 315 #ifndef DART_PRECOMPILED_RUNTIME | 313 #ifndef DART_PRECOMPILED_RUNTIME |
| 316 KernelIsolate::Run(); | 314 KernelIsolate::Run(); |
| 317 #endif // DART_PRECOMPILED_RUNTIME | 315 #endif // DART_PRECOMPILED_RUNTIME |
| 318 | 316 |
| 319 return NULL; | 317 return NULL; |
| 320 } | 318 } |
| 321 | 319 |
| 322 | |
| 323 // This waits until only the VM isolate and the service isolate remains in the | 320 // This waits until only the VM isolate and the service isolate remains in the |
| 324 // list, i.e. list length == 2. | 321 // list, i.e. list length == 2. |
| 325 void Dart::WaitForApplicationIsolateShutdown() { | 322 void Dart::WaitForApplicationIsolateShutdown() { |
| 326 ASSERT(!Isolate::creation_enabled_); | 323 ASSERT(!Isolate::creation_enabled_); |
| 327 MonitorLocker ml(Isolate::isolates_list_monitor_); | 324 MonitorLocker ml(Isolate::isolates_list_monitor_); |
| 328 while ((Isolate::isolates_list_head_ != NULL) && | 325 while ((Isolate::isolates_list_head_ != NULL) && |
| 329 (Isolate::isolates_list_head_->next_ != NULL) && | 326 (Isolate::isolates_list_head_->next_ != NULL) && |
| 330 (Isolate::isolates_list_head_->next_->next_ != NULL)) { | 327 (Isolate::isolates_list_head_->next_->next_ != NULL)) { |
| 331 ml.Wait(); | 328 ml.Wait(); |
| 332 } | 329 } |
| 333 ASSERT( | 330 ASSERT( |
| 334 ((Isolate::isolates_list_head_ == Dart::vm_isolate()) && | 331 ((Isolate::isolates_list_head_ == Dart::vm_isolate()) && |
| 335 ServiceIsolate::IsServiceIsolate(Isolate::isolates_list_head_->next_)) || | 332 ServiceIsolate::IsServiceIsolate(Isolate::isolates_list_head_->next_)) || |
| 336 ((Isolate::isolates_list_head_->next_ == Dart::vm_isolate()) && | 333 ((Isolate::isolates_list_head_->next_ == Dart::vm_isolate()) && |
| 337 ServiceIsolate::IsServiceIsolate(Isolate::isolates_list_head_))); | 334 ServiceIsolate::IsServiceIsolate(Isolate::isolates_list_head_))); |
| 338 } | 335 } |
| 339 | 336 |
| 340 | |
| 341 // This waits until only the VM isolate remains in the list. | 337 // This waits until only the VM isolate remains in the list. |
| 342 void Dart::WaitForIsolateShutdown() { | 338 void Dart::WaitForIsolateShutdown() { |
| 343 ASSERT(!Isolate::creation_enabled_); | 339 ASSERT(!Isolate::creation_enabled_); |
| 344 MonitorLocker ml(Isolate::isolates_list_monitor_); | 340 MonitorLocker ml(Isolate::isolates_list_monitor_); |
| 345 while ((Isolate::isolates_list_head_ != NULL) && | 341 while ((Isolate::isolates_list_head_ != NULL) && |
| 346 (Isolate::isolates_list_head_->next_ != NULL)) { | 342 (Isolate::isolates_list_head_->next_ != NULL)) { |
| 347 ml.Wait(); | 343 ml.Wait(); |
| 348 } | 344 } |
| 349 ASSERT(Isolate::isolates_list_head_ == Dart::vm_isolate()); | 345 ASSERT(Isolate::isolates_list_head_ == Dart::vm_isolate()); |
| 350 } | 346 } |
| 351 | 347 |
| 352 | |
| 353 const char* Dart::Cleanup() { | 348 const char* Dart::Cleanup() { |
| 354 ASSERT(Isolate::Current() == NULL); | 349 ASSERT(Isolate::Current() == NULL); |
| 355 if (vm_isolate_ == NULL) { | 350 if (vm_isolate_ == NULL) { |
| 356 return "VM already terminated."; | 351 return "VM already terminated."; |
| 357 } | 352 } |
| 358 | 353 |
| 359 if (FLAG_trace_shutdown) { | 354 if (FLAG_trace_shutdown) { |
| 360 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Starting shutdown\n", | 355 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Starting shutdown\n", |
| 361 UptimeMillis()); | 356 UptimeMillis()); |
| 362 } | 357 } |
| 363 | 358 |
| 364 if (FLAG_profiler) { | 359 if (FLAG_profiler) { |
| 365 // Shut down profiling. | 360 // Shut down profiling. |
| 366 if (FLAG_trace_shutdown) { | 361 if (FLAG_trace_shutdown) { |
| 367 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down profiling\n", | 362 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down profiling\n", |
| 368 UptimeMillis()); | 363 UptimeMillis()); |
| 369 } | 364 } |
| 370 Profiler::Shutdown(); | 365 Profiler::Shutdown(); |
| 371 } | 366 } |
| 372 | 367 |
| 373 | |
| 374 { | 368 { |
| 375 // Set the VM isolate as current isolate when shutting down | 369 // Set the VM isolate as current isolate when shutting down |
| 376 // Metrics so that we can use a StackZone. | 370 // Metrics so that we can use a StackZone. |
| 377 if (FLAG_trace_shutdown) { | 371 if (FLAG_trace_shutdown) { |
| 378 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Entering vm isolate\n", | 372 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Entering vm isolate\n", |
| 379 UptimeMillis()); | 373 UptimeMillis()); |
| 380 } | 374 } |
| 381 bool result = Thread::EnterIsolate(vm_isolate_); | 375 bool result = Thread::EnterIsolate(vm_isolate_); |
| 382 ASSERT(result); | 376 ASSERT(result); |
| 383 Metric::Cleanup(); | 377 Metric::Cleanup(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 } | 475 } |
| 482 Timeline::Shutdown(); | 476 Timeline::Shutdown(); |
| 483 } | 477 } |
| 484 if (FLAG_trace_shutdown) { | 478 if (FLAG_trace_shutdown) { |
| 485 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Done\n", UptimeMillis()); | 479 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Done\n", UptimeMillis()); |
| 486 } | 480 } |
| 487 MallocHooks::TearDown(); | 481 MallocHooks::TearDown(); |
| 488 return NULL; | 482 return NULL; |
| 489 } | 483 } |
| 490 | 484 |
| 491 | |
| 492 Isolate* Dart::CreateIsolate(const char* name_prefix, | 485 Isolate* Dart::CreateIsolate(const char* name_prefix, |
| 493 const Dart_IsolateFlags& api_flags) { | 486 const Dart_IsolateFlags& api_flags) { |
| 494 // Create a new isolate. | 487 // Create a new isolate. |
| 495 Isolate* isolate = Isolate::Init(name_prefix, api_flags); | 488 Isolate* isolate = Isolate::Init(name_prefix, api_flags); |
| 496 return isolate; | 489 return isolate; |
| 497 } | 490 } |
| 498 | 491 |
| 499 | |
| 500 static bool IsSnapshotCompatible(Snapshot::Kind vm_kind, | 492 static bool IsSnapshotCompatible(Snapshot::Kind vm_kind, |
| 501 Snapshot::Kind isolate_kind) { | 493 Snapshot::Kind isolate_kind) { |
| 502 if (vm_kind == isolate_kind) return true; | 494 if (vm_kind == isolate_kind) return true; |
| 503 if (vm_kind == Snapshot::kFull && isolate_kind == Snapshot::kFullJIT) | 495 if (vm_kind == Snapshot::kFull && isolate_kind == Snapshot::kFullJIT) |
| 504 return true; | 496 return true; |
| 505 return Snapshot::IsFull(isolate_kind); | 497 return Snapshot::IsFull(isolate_kind); |
| 506 } | 498 } |
| 507 | 499 |
| 508 | |
| 509 RawError* Dart::InitializeIsolate(const uint8_t* snapshot_data, | 500 RawError* Dart::InitializeIsolate(const uint8_t* snapshot_data, |
| 510 const uint8_t* snapshot_instructions, | 501 const uint8_t* snapshot_instructions, |
| 511 intptr_t snapshot_length, | 502 intptr_t snapshot_length, |
| 512 kernel::Program* kernel_program, | 503 kernel::Program* kernel_program, |
| 513 void* data) { | 504 void* data) { |
| 514 // Initialize the new isolate. | 505 // Initialize the new isolate. |
| 515 Thread* T = Thread::Current(); | 506 Thread* T = Thread::Current(); |
| 516 Isolate* I = T->isolate(); | 507 Isolate* I = T->isolate(); |
| 517 NOT_IN_PRODUCT(TimelineDurationScope tds(T, Timeline::GetIsolateStream(), | 508 NOT_IN_PRODUCT(TimelineDurationScope tds(T, Timeline::GetIsolateStream(), |
| 518 "InitializeIsolate"); | 509 "InitializeIsolate"); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 const UserTag& default_tag = UserTag::Handle(UserTag::DefaultTag()); | 628 const UserTag& default_tag = UserTag::Handle(UserTag::DefaultTag()); |
| 638 I->set_current_tag(default_tag); | 629 I->set_current_tag(default_tag); |
| 639 | 630 |
| 640 if (FLAG_keep_code) { | 631 if (FLAG_keep_code) { |
| 641 I->set_deoptimized_code_array( | 632 I->set_deoptimized_code_array( |
| 642 GrowableObjectArray::Handle(GrowableObjectArray::New())); | 633 GrowableObjectArray::Handle(GrowableObjectArray::New())); |
| 643 } | 634 } |
| 644 return Error::null(); | 635 return Error::null(); |
| 645 } | 636 } |
| 646 | 637 |
| 647 | |
| 648 const char* Dart::FeaturesString(Isolate* isolate, Snapshot::Kind kind) { | 638 const char* Dart::FeaturesString(Isolate* isolate, Snapshot::Kind kind) { |
| 649 TextBuffer buffer(64); | 639 TextBuffer buffer(64); |
| 650 | 640 |
| 651 // Different fields are included for DEBUG/RELEASE/PRODUCT. | 641 // Different fields are included for DEBUG/RELEASE/PRODUCT. |
| 652 #if defined(DEBUG) | 642 #if defined(DEBUG) |
| 653 buffer.AddString("debug"); | 643 buffer.AddString("debug"); |
| 654 #elif defined(PRODUCT) | 644 #elif defined(PRODUCT) |
| 655 buffer.AddString("product"); | 645 buffer.AddString("product"); |
| 656 #else | 646 #else |
| 657 buffer.AddString("release"); | 647 buffer.AddString("release"); |
| 658 #endif | 648 #endif |
| 659 | 649 |
| 660 if (Snapshot::IncludesCode(kind)) { | 650 if (Snapshot::IncludesCode(kind)) { |
| 661 if (FLAG_support_debugger) { | 651 if (FLAG_support_debugger) { |
| 662 buffer.AddString(" support-debugger"); | 652 buffer.AddString(" support-debugger"); |
| 663 } | 653 } |
| 664 | 654 |
| 665 // Checked mode affects deopt ids. | 655 // Checked mode affects deopt ids. |
| 666 #define ADD_FLAG(name, isolate_flag, flag) \ | 656 #define ADD_FLAG(name, isolate_flag, flag) \ |
| 667 do { \ | 657 do { \ |
| 668 const bool name = (isolate != NULL) ? isolate->name() : flag; \ | 658 const bool name = (isolate != NULL) ? isolate->name() : flag; \ |
| 669 buffer.AddString(name ? (" " #name) : (" no-" #name)); \ | 659 buffer.AddString(name ? (" " #name) : (" no-" #name)); \ |
| 670 } while (0); | 660 } while (0); |
| 671 ADD_FLAG(type_checks, enable_type_checks, FLAG_enable_type_checks); | 661 ADD_FLAG(type_checks, enable_type_checks, FLAG_enable_type_checks); |
| 672 ADD_FLAG(asserts, enable_asserts, FLAG_enable_asserts); | 662 ADD_FLAG(asserts, enable_asserts, FLAG_enable_asserts); |
| 673 ADD_FLAG(error_on_bad_type, enable_error_on_bad_type, | 663 ADD_FLAG(error_on_bad_type, enable_error_on_bad_type, |
| 674 FLAG_error_on_bad_type); | 664 FLAG_error_on_bad_type); |
| 675 ADD_FLAG(error_on_bad_override, enable_error_on_bad_override, | 665 ADD_FLAG(error_on_bad_override, enable_error_on_bad_override, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 706 #endif | 696 #endif |
| 707 } | 697 } |
| 708 | 698 |
| 709 if (FLAG_precompiled_mode && FLAG_dwarf_stack_traces) { | 699 if (FLAG_precompiled_mode && FLAG_dwarf_stack_traces) { |
| 710 buffer.AddString(" dwarf-stack-traces"); | 700 buffer.AddString(" dwarf-stack-traces"); |
| 711 } | 701 } |
| 712 | 702 |
| 713 return buffer.Steal(); | 703 return buffer.Steal(); |
| 714 } | 704 } |
| 715 | 705 |
| 716 | |
| 717 void Dart::RunShutdownCallback() { | 706 void Dart::RunShutdownCallback() { |
| 718 Isolate* isolate = Isolate::Current(); | 707 Isolate* isolate = Isolate::Current(); |
| 719 void* callback_data = isolate->init_callback_data(); | 708 void* callback_data = isolate->init_callback_data(); |
| 720 Dart_IsolateShutdownCallback callback = Isolate::ShutdownCallback(); | 709 Dart_IsolateShutdownCallback callback = Isolate::ShutdownCallback(); |
| 721 if (callback != NULL) { | 710 if (callback != NULL) { |
| 722 (callback)(callback_data); | 711 (callback)(callback_data); |
| 723 } | 712 } |
| 724 } | 713 } |
| 725 | 714 |
| 726 | |
| 727 void Dart::ShutdownIsolate(Isolate* isolate) { | 715 void Dart::ShutdownIsolate(Isolate* isolate) { |
| 728 ASSERT(Isolate::Current() == NULL); | 716 ASSERT(Isolate::Current() == NULL); |
| 729 // We need to enter the isolate in order to shut it down. | 717 // We need to enter the isolate in order to shut it down. |
| 730 bool result = Thread::EnterIsolate(isolate); | 718 bool result = Thread::EnterIsolate(isolate); |
| 731 ASSERT(result); | 719 ASSERT(result); |
| 732 ShutdownIsolate(); | 720 ShutdownIsolate(); |
| 733 // Since the isolate is shutdown and deleted, there is no need to | 721 // Since the isolate is shutdown and deleted, there is no need to |
| 734 // exit the isolate here. | 722 // exit the isolate here. |
| 735 ASSERT(Isolate::Current() == NULL); | 723 ASSERT(Isolate::Current() == NULL); |
| 736 } | 724 } |
| 737 | 725 |
| 738 | |
| 739 void Dart::ShutdownIsolate() { | 726 void Dart::ShutdownIsolate() { |
| 740 Isolate* isolate = Isolate::Current(); | 727 Isolate* isolate = Isolate::Current(); |
| 741 isolate->Shutdown(); | 728 isolate->Shutdown(); |
| 742 delete isolate; | 729 delete isolate; |
| 743 } | 730 } |
| 744 | 731 |
| 745 | |
| 746 int64_t Dart::UptimeMicros() { | 732 int64_t Dart::UptimeMicros() { |
| 747 return OS::GetCurrentMonotonicMicros() - Dart::start_time_micros_; | 733 return OS::GetCurrentMonotonicMicros() - Dart::start_time_micros_; |
| 748 } | 734 } |
| 749 | 735 |
| 750 | |
| 751 uword Dart::AllocateReadOnlyHandle() { | 736 uword Dart::AllocateReadOnlyHandle() { |
| 752 ASSERT(Isolate::Current() == Dart::vm_isolate()); | 737 ASSERT(Isolate::Current() == Dart::vm_isolate()); |
| 753 ASSERT(predefined_handles_ != NULL); | 738 ASSERT(predefined_handles_ != NULL); |
| 754 return predefined_handles_->handles_.AllocateScopedHandle(); | 739 return predefined_handles_->handles_.AllocateScopedHandle(); |
| 755 } | 740 } |
| 756 | 741 |
| 757 | |
| 758 LocalHandle* Dart::AllocateReadOnlyApiHandle() { | 742 LocalHandle* Dart::AllocateReadOnlyApiHandle() { |
| 759 ASSERT(Isolate::Current() == Dart::vm_isolate()); | 743 ASSERT(Isolate::Current() == Dart::vm_isolate()); |
| 760 ASSERT(predefined_handles_ != NULL); | 744 ASSERT(predefined_handles_ != NULL); |
| 761 return predefined_handles_->api_handles_.AllocateHandle(); | 745 return predefined_handles_->api_handles_.AllocateHandle(); |
| 762 } | 746 } |
| 763 | 747 |
| 764 | |
| 765 bool Dart::IsReadOnlyHandle(uword address) { | 748 bool Dart::IsReadOnlyHandle(uword address) { |
| 766 ASSERT(predefined_handles_ != NULL); | 749 ASSERT(predefined_handles_ != NULL); |
| 767 return predefined_handles_->handles_.IsValidScopedHandle(address); | 750 return predefined_handles_->handles_.IsValidScopedHandle(address); |
| 768 } | 751 } |
| 769 | 752 |
| 770 | |
| 771 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { | 753 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { |
| 772 ASSERT(predefined_handles_ != NULL); | 754 ASSERT(predefined_handles_ != NULL); |
| 773 return predefined_handles_->api_handles_.IsValidHandle(handle); | 755 return predefined_handles_->api_handles_.IsValidHandle(handle); |
| 774 } | 756 } |
| 775 | 757 |
| 776 } // namespace dart | 758 } // namespace dart |
| OLD | NEW |