| 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/isolate.h" | 5 #include "vm/isolate.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/text_buffer.h" | 10 #include "platform/text_buffer.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 NoOOBMessageScope::NoOOBMessageScope(Thread* thread) : StackResource(thread) { | 137 NoOOBMessageScope::NoOOBMessageScope(Thread* thread) : StackResource(thread) { |
| 138 thread->DeferOOBMessageInterrupts(); | 138 thread->DeferOOBMessageInterrupts(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 NoOOBMessageScope::~NoOOBMessageScope() { | 141 NoOOBMessageScope::~NoOOBMessageScope() { |
| 142 thread()->RestoreOOBMessageInterrupts(); | 142 thread()->RestoreOOBMessageInterrupts(); |
| 143 } | 143 } |
| 144 | 144 |
| 145 NoReloadScope::NoReloadScope(Isolate* isolate, Thread* thread) | 145 NoReloadScope::NoReloadScope(Isolate* isolate, Thread* thread) |
| 146 : StackResource(thread), isolate_(isolate) { | 146 : StackResource(thread), isolate_(isolate) { |
| 147 #if !defined(PRODUCT) | 147 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
| 148 ASSERT(isolate_ != NULL); | 148 ASSERT(isolate_ != NULL); |
| 149 AtomicOperations::FetchAndIncrement(&(isolate_->no_reload_scope_depth_)); | 149 AtomicOperations::FetchAndIncrement(&(isolate_->no_reload_scope_depth_)); |
| 150 ASSERT(AtomicOperations::LoadRelaxed(&(isolate_->no_reload_scope_depth_)) >= | 150 ASSERT(AtomicOperations::LoadRelaxed(&(isolate_->no_reload_scope_depth_)) >= |
| 151 0); | 151 0); |
| 152 #endif // !defined(PRODUCT) | 152 #endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
| 153 } | 153 } |
| 154 | 154 |
| 155 NoReloadScope::~NoReloadScope() { | 155 NoReloadScope::~NoReloadScope() { |
| 156 #if !defined(PRODUCT) | 156 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
| 157 AtomicOperations::FetchAndDecrement(&(isolate_->no_reload_scope_depth_)); | 157 AtomicOperations::FetchAndDecrement(&(isolate_->no_reload_scope_depth_)); |
| 158 ASSERT(AtomicOperations::LoadRelaxed(&(isolate_->no_reload_scope_depth_)) >= | 158 ASSERT(AtomicOperations::LoadRelaxed(&(isolate_->no_reload_scope_depth_)) >= |
| 159 0); | 159 0); |
| 160 #endif // !defined(PRODUCT) | 160 #endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
| 161 } | 161 } |
| 162 | 162 |
| 163 void Isolate::RegisterClass(const Class& cls) { | 163 void Isolate::RegisterClass(const Class& cls) { |
| 164 #if !defined(PRODUCT) | 164 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
| 165 if (IsReloading()) { | 165 if (IsReloading()) { |
| 166 reload_context()->RegisterClass(cls); | 166 reload_context()->RegisterClass(cls); |
| 167 return; | 167 return; |
| 168 } | 168 } |
| 169 #endif // !defined(PRODUCT) | 169 #endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
| 170 class_table()->Register(cls); | 170 class_table()->Register(cls); |
| 171 } | 171 } |
| 172 | 172 |
| 173 void Isolate::RegisterClassAt(intptr_t index, const Class& cls) { | 173 void Isolate::RegisterClassAt(intptr_t index, const Class& cls) { |
| 174 class_table()->RegisterAt(index, cls); | 174 class_table()->RegisterAt(index, cls); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void Isolate::ValidateClassTable() { | 177 void Isolate::ValidateClassTable() { |
| 178 class_table()->Validate(); | 178 class_table()->Validate(); |
| 179 } | 179 } |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 lib ^= libs.At(i); | 1041 lib ^= libs.At(i); |
| 1042 // If this library was loaded with Dart_LoadLibrary, it was marked | 1042 // If this library was loaded with Dart_LoadLibrary, it was marked |
| 1043 // as 'load in progres'. Set the status to 'loaded'. | 1043 // as 'load in progres'. Set the status to 'loaded'. |
| 1044 if (lib.LoadInProgress()) { | 1044 if (lib.LoadInProgress()) { |
| 1045 lib.SetLoaded(); | 1045 lib.SetLoaded(); |
| 1046 } | 1046 } |
| 1047 } | 1047 } |
| 1048 TokenStream::CloseSharedTokenList(this); | 1048 TokenStream::CloseSharedTokenList(this); |
| 1049 } | 1049 } |
| 1050 | 1050 |
| 1051 #if !defined(PRODUCT) | 1051 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
| 1052 bool Isolate::CanReload() const { | 1052 bool Isolate::CanReload() const { |
| 1053 return !ServiceIsolate::IsServiceIsolateDescendant(this) && is_runnable() && | 1053 return !ServiceIsolate::IsServiceIsolateDescendant(this) && is_runnable() && |
| 1054 !IsReloading() && | 1054 !IsReloading() && |
| 1055 (AtomicOperations::LoadRelaxed(&no_reload_scope_depth_) == 0) && | 1055 (AtomicOperations::LoadRelaxed(&no_reload_scope_depth_) == 0) && |
| 1056 IsolateCreationEnabled(); | 1056 IsolateCreationEnabled(); |
| 1057 } | 1057 } |
| 1058 | 1058 |
| 1059 bool Isolate::ReloadSources(JSONStream* js, | 1059 bool Isolate::ReloadSources(JSONStream* js, |
| 1060 bool force_reload, | 1060 bool force_reload, |
| 1061 const char* root_script_url, | 1061 const char* root_script_url, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1073 } | 1073 } |
| 1074 | 1074 |
| 1075 void Isolate::DeleteReloadContext() { | 1075 void Isolate::DeleteReloadContext() { |
| 1076 // Another thread may be in the middle of GetClassForHeapWalkAt. | 1076 // Another thread may be in the middle of GetClassForHeapWalkAt. |
| 1077 Thread* thread = Thread::Current(); | 1077 Thread* thread = Thread::Current(); |
| 1078 SafepointOperationScope safepoint_scope(thread); | 1078 SafepointOperationScope safepoint_scope(thread); |
| 1079 | 1079 |
| 1080 delete reload_context_; | 1080 delete reload_context_; |
| 1081 reload_context_ = NULL; | 1081 reload_context_ = NULL; |
| 1082 } | 1082 } |
| 1083 #endif // !defined(PRODUCT) | 1083 #endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
| 1084 | 1084 |
| 1085 void Isolate::DoneFinalizing() { | 1085 void Isolate::DoneFinalizing() { |
| 1086 #if !defined(PRODUCT) | 1086 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
| 1087 if (IsReloading()) { | 1087 if (IsReloading()) { |
| 1088 reload_context_->FinalizeLoading(); | 1088 reload_context_->FinalizeLoading(); |
| 1089 } | 1089 } |
| 1090 #endif // !defined(PRODUCT) | 1090 #endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
| 1091 } | 1091 } |
| 1092 | 1092 |
| 1093 bool Isolate::MakeRunnable() { | 1093 bool Isolate::MakeRunnable() { |
| 1094 ASSERT(Isolate::Current() == NULL); | 1094 ASSERT(Isolate::Current() == NULL); |
| 1095 | 1095 |
| 1096 MutexLocker ml(mutex_); | 1096 MutexLocker ml(mutex_); |
| 1097 // Check if we are in a valid state to make the isolate runnable. | 1097 // Check if we are in a valid state to make the isolate runnable. |
| 1098 if (is_runnable() == true) { | 1098 if (is_runnable() == true) { |
| 1099 return false; // Already runnable. | 1099 return false; // Already runnable. |
| 1100 } | 1100 } |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1461 #if defined(DEBUG) && !defined(DART_PRECOMPILED_RUNTIME) | 1461 #if defined(DEBUG) && !defined(DART_PRECOMPILED_RUNTIME) |
| 1462 if (!isolate->HasAttemptedReload()) { | 1462 if (!isolate->HasAttemptedReload()) { |
| 1463 // For this verification we need to stop the background compiler earlier. | 1463 // For this verification we need to stop the background compiler earlier. |
| 1464 // This would otherwise happen in Dart::ShowdownIsolate. | 1464 // This would otherwise happen in Dart::ShowdownIsolate. |
| 1465 isolate->StopBackgroundCompiler(); | 1465 isolate->StopBackgroundCompiler(); |
| 1466 isolate->heap()->CollectAllGarbage(); | 1466 isolate->heap()->CollectAllGarbage(); |
| 1467 HeapIterationScope iteration(thread); | 1467 HeapIterationScope iteration(thread); |
| 1468 VerifyCanonicalVisitor check_canonical(thread); | 1468 VerifyCanonicalVisitor check_canonical(thread); |
| 1469 iteration.IterateObjects(&check_canonical); | 1469 iteration.IterateObjects(&check_canonical); |
| 1470 } | 1470 } |
| 1471 #endif // DEBUG | 1471 #endif // defined(DEBUG) && !defined(DART_PRECOMPILED_RUNTIME) |
| 1472 const Error& error = Error::Handle(thread->sticky_error()); | 1472 const Error& error = Error::Handle(thread->sticky_error()); |
| 1473 if (!error.IsNull() && !error.IsUnwindError()) { | 1473 if (!error.IsNull() && !error.IsUnwindError()) { |
| 1474 OS::PrintErr("in ShutdownIsolate: %s\n", error.ToErrorCString()); | 1474 OS::PrintErr("in ShutdownIsolate: %s\n", error.ToErrorCString()); |
| 1475 } | 1475 } |
| 1476 Dart::RunShutdownCallback(); | 1476 Dart::RunShutdownCallback(); |
| 1477 } | 1477 } |
| 1478 // Shut the isolate down. | 1478 // Shut the isolate down. |
| 1479 Dart::ShutdownIsolate(isolate); | 1479 Dart::ShutdownIsolate(isolate); |
| 1480 } | 1480 } |
| 1481 | 1481 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1630 #endif // !defined(PRODUCT) | 1630 #endif // !defined(PRODUCT) |
| 1631 } | 1631 } |
| 1632 | 1632 |
| 1633 void Isolate::StopBackgroundCompiler() { | 1633 void Isolate::StopBackgroundCompiler() { |
| 1634 // Wait until all background compilation has finished. | 1634 // Wait until all background compilation has finished. |
| 1635 if (background_compiler_ != NULL) { | 1635 if (background_compiler_ != NULL) { |
| 1636 BackgroundCompiler::Stop(this); | 1636 BackgroundCompiler::Stop(this); |
| 1637 } | 1637 } |
| 1638 } | 1638 } |
| 1639 | 1639 |
| 1640 #if !defined(PRODUCT) | 1640 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
| 1641 void Isolate::MaybeIncreaseReloadEveryNStackOverflowChecks() { | 1641 void Isolate::MaybeIncreaseReloadEveryNStackOverflowChecks() { |
| 1642 if (FLAG_reload_every_back_off) { | 1642 if (FLAG_reload_every_back_off) { |
| 1643 if (reload_every_n_stack_overflow_checks_ < 5000) { | 1643 if (reload_every_n_stack_overflow_checks_ < 5000) { |
| 1644 reload_every_n_stack_overflow_checks_ += 99; | 1644 reload_every_n_stack_overflow_checks_ += 99; |
| 1645 } else { | 1645 } else { |
| 1646 reload_every_n_stack_overflow_checks_ *= 2; | 1646 reload_every_n_stack_overflow_checks_ *= 2; |
| 1647 } | 1647 } |
| 1648 // Cap the value. | 1648 // Cap the value. |
| 1649 if (reload_every_n_stack_overflow_checks_ > 1000000) { | 1649 if (reload_every_n_stack_overflow_checks_ > 1000000) { |
| 1650 reload_every_n_stack_overflow_checks_ = 1000000; | 1650 reload_every_n_stack_overflow_checks_ = 1000000; |
| 1651 } | 1651 } |
| 1652 } | 1652 } |
| 1653 } | 1653 } |
| 1654 #endif // !defined(PRODUCT) | 1654 #endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
| 1655 | 1655 |
| 1656 void Isolate::Shutdown() { | 1656 void Isolate::Shutdown() { |
| 1657 ASSERT(this == Isolate::Current()); | 1657 ASSERT(this == Isolate::Current()); |
| 1658 StopBackgroundCompiler(); | 1658 StopBackgroundCompiler(); |
| 1659 | 1659 |
| 1660 #if defined(DEBUG) | 1660 #if defined(DEBUG) |
| 1661 if (heap_ != NULL && FLAG_verify_on_transition) { | 1661 if (heap_ != NULL && FLAG_verify_on_transition) { |
| 1662 // The VM isolate keeps all objects marked. | 1662 // The VM isolate keeps all objects marked. |
| 1663 heap_->Verify(this == Dart::vm_isolate() ? kRequireMarked : kForbidMarked); | 1663 heap_->Verify(this == Dart::vm_isolate() ? kRequireMarked : kForbidMarked); |
| 1664 } | 1664 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1690 if (heap_ != NULL) { | 1690 if (heap_ != NULL) { |
| 1691 // Wait for any concurrent GC tasks to finish before shutting down. | 1691 // Wait for any concurrent GC tasks to finish before shutting down. |
| 1692 // TODO(koda): Support faster sweeper shutdown (e.g., after current page). | 1692 // TODO(koda): Support faster sweeper shutdown (e.g., after current page). |
| 1693 PageSpace* old_space = heap_->old_space(); | 1693 PageSpace* old_space = heap_->old_space(); |
| 1694 MonitorLocker ml(old_space->tasks_lock()); | 1694 MonitorLocker ml(old_space->tasks_lock()); |
| 1695 while (old_space->tasks() > 0) { | 1695 while (old_space->tasks() > 0) { |
| 1696 ml.Wait(); | 1696 ml.Wait(); |
| 1697 } | 1697 } |
| 1698 } | 1698 } |
| 1699 | 1699 |
| 1700 #if !defined(PRODUCT) | 1700 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
| 1701 if (FLAG_check_reloaded && is_runnable() && (this != Dart::vm_isolate()) && | 1701 if (FLAG_check_reloaded && is_runnable() && (this != Dart::vm_isolate()) && |
| 1702 !ServiceIsolate::IsServiceIsolateDescendant(this)) { | 1702 !ServiceIsolate::IsServiceIsolateDescendant(this)) { |
| 1703 if (!HasAttemptedReload()) { | 1703 if (!HasAttemptedReload()) { |
| 1704 FATAL( | 1704 FATAL( |
| 1705 "Isolate did not reload before exiting and " | 1705 "Isolate did not reload before exiting and " |
| 1706 "--check-reloaded is enabled.\n"); | 1706 "--check-reloaded is enabled.\n"); |
| 1707 } | 1707 } |
| 1708 } | 1708 } |
| 1709 #endif // !defined(PRODUCT) | 1709 #endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
| 1710 | 1710 |
| 1711 // Then, proceed with low-level teardown. | 1711 // Then, proceed with low-level teardown. |
| 1712 LowLevelShutdown(); | 1712 LowLevelShutdown(); |
| 1713 | 1713 |
| 1714 #if defined(DEBUG) | 1714 #if defined(DEBUG) |
| 1715 // No concurrent sweeper tasks should be running at this point. | 1715 // No concurrent sweeper tasks should be running at this point. |
| 1716 if (heap_ != NULL) { | 1716 if (heap_ != NULL) { |
| 1717 PageSpace* old_space = heap_->old_space(); | 1717 PageSpace* old_space = heap_->old_space(); |
| 1718 MonitorLocker ml(old_space->tasks_lock()); | 1718 MonitorLocker ml(old_space->tasks_lock()); |
| 1719 ASSERT(old_space->tasks() == 0); | 1719 ASSERT(old_space->tasks() == 0); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1787 | 1787 |
| 1788 // Visit the boxed_field_list_. | 1788 // Visit the boxed_field_list_. |
| 1789 // 'boxed_field_list_' access via mutator and background compilation threads | 1789 // 'boxed_field_list_' access via mutator and background compilation threads |
| 1790 // is guarded with a monitor. This means that we can visit it only | 1790 // is guarded with a monitor. This means that we can visit it only |
| 1791 // when at safepoint or the field_list_mutex_ lock has been taken. | 1791 // when at safepoint or the field_list_mutex_ lock has been taken. |
| 1792 visitor->VisitPointer(reinterpret_cast<RawObject**>(&boxed_field_list_)); | 1792 visitor->VisitPointer(reinterpret_cast<RawObject**>(&boxed_field_list_)); |
| 1793 | 1793 |
| 1794 #if !defined(PRODUCT) | 1794 #if !defined(PRODUCT) |
| 1795 // Visit objects in the debugger. | 1795 // Visit objects in the debugger. |
| 1796 debugger()->VisitObjectPointers(visitor); | 1796 debugger()->VisitObjectPointers(visitor); |
| 1797 | 1797 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 1798 // Visit objects that are being used for isolate reload. | 1798 // Visit objects that are being used for isolate reload. |
| 1799 if (reload_context() != NULL) { | 1799 if (reload_context() != NULL) { |
| 1800 reload_context()->VisitObjectPointers(visitor); | 1800 reload_context()->VisitObjectPointers(visitor); |
| 1801 } | 1801 } |
| 1802 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 1802 if (ServiceIsolate::IsServiceIsolate(this)) { | 1803 if (ServiceIsolate::IsServiceIsolate(this)) { |
| 1803 ServiceIsolate::VisitObjectPointers(visitor); | 1804 ServiceIsolate::VisitObjectPointers(visitor); |
| 1804 } | 1805 } |
| 1805 #endif // !defined(PRODUCT) | 1806 #endif // !defined(PRODUCT) |
| 1806 | 1807 |
| 1807 #if !defined(DART_PRECOMPILED_RUNTIME) | 1808 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 1808 // Visit objects that are being used for deoptimization. | 1809 // Visit objects that are being used for deoptimization. |
| 1809 if (deopt_context() != NULL) { | 1810 if (deopt_context() != NULL) { |
| 1810 deopt_context()->VisitObjectPointers(visitor); | 1811 deopt_context()->VisitObjectPointers(visitor); |
| 1811 } | 1812 } |
| 1812 #endif | 1813 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 1813 | 1814 |
| 1814 VisitStackPointers(visitor, validate_frames); | 1815 VisitStackPointers(visitor, validate_frames); |
| 1815 } | 1816 } |
| 1816 | 1817 |
| 1817 void Isolate::VisitStackPointers(ObjectPointerVisitor* visitor, | 1818 void Isolate::VisitStackPointers(ObjectPointerVisitor* visitor, |
| 1818 bool validate_frames) { | 1819 bool validate_frames) { |
| 1819 // Visit objects in all threads (e.g., Dart stack, handles in zones). | 1820 // Visit objects in all threads (e.g., Dart stack, handles in zones). |
| 1820 thread_registry()->VisitObjectPointers(visitor, validate_frames); | 1821 thread_registry()->VisitObjectPointers(visitor, validate_frames); |
| 1821 } | 1822 } |
| 1822 | 1823 |
| 1823 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor) { | 1824 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor) { |
| 1824 if (api_state() != NULL) { | 1825 if (api_state() != NULL) { |
| 1825 api_state()->VisitWeakHandles(visitor); | 1826 api_state()->VisitWeakHandles(visitor); |
| 1826 } | 1827 } |
| 1827 } | 1828 } |
| 1828 | 1829 |
| 1829 void Isolate::PrepareForGC() { | 1830 void Isolate::PrepareForGC() { |
| 1830 thread_registry()->PrepareForGC(); | 1831 thread_registry()->PrepareForGC(); |
| 1831 } | 1832 } |
| 1832 | 1833 |
| 1833 RawClass* Isolate::GetClassForHeapWalkAt(intptr_t cid) { | 1834 RawClass* Isolate::GetClassForHeapWalkAt(intptr_t cid) { |
| 1834 RawClass* raw_class = NULL; | 1835 RawClass* raw_class = NULL; |
| 1835 #ifndef PRODUCT | 1836 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
| 1836 if (IsReloading()) { | 1837 if (IsReloading()) { |
| 1837 raw_class = reload_context()->GetClassForHeapWalkAt(cid); | 1838 raw_class = reload_context()->GetClassForHeapWalkAt(cid); |
| 1838 } else { | 1839 } else { |
| 1839 raw_class = class_table()->At(cid); | 1840 raw_class = class_table()->At(cid); |
| 1840 } | 1841 } |
| 1841 #else | 1842 #else |
| 1842 raw_class = class_table()->At(cid); | 1843 raw_class = class_table()->At(cid); |
| 1843 #endif // !PRODUCT | 1844 #endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
| 1844 ASSERT(raw_class != NULL); | 1845 ASSERT(raw_class != NULL); |
| 1845 ASSERT(remapping_cids() || raw_class->ptr()->id_ == cid); | 1846 ASSERT(remapping_cids() || raw_class->ptr()->id_ == cid); |
| 1846 return raw_class; | 1847 return raw_class; |
| 1847 } | 1848 } |
| 1848 | 1849 |
| 1849 void Isolate::AddPendingDeopt(uword fp, uword pc) { | 1850 void Isolate::AddPendingDeopt(uword fp, uword pc) { |
| 1850 // GrowableArray::Add is not atomic and may be interrupt by a profiler | 1851 // GrowableArray::Add is not atomic and may be interrupt by a profiler |
| 1851 // stack walk. | 1852 // stack walk. |
| 1852 MallocGrowableArray<PendingLazyDeopt>* old_pending_deopts = pending_deopts_; | 1853 MallocGrowableArray<PendingLazyDeopt>* old_pending_deopts = pending_deopts_; |
| 1853 MallocGrowableArray<PendingLazyDeopt>* new_pending_deopts = | 1854 MallocGrowableArray<PendingLazyDeopt>* new_pending_deopts = |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1918 jsobj.AddPropertyTimeMillis("startTime", start_time); | 1919 jsobj.AddPropertyTimeMillis("startTime", start_time); |
| 1919 { | 1920 { |
| 1920 JSONObject jsheap(&jsobj, "_heaps"); | 1921 JSONObject jsheap(&jsobj, "_heaps"); |
| 1921 heap()->PrintToJSONObject(Heap::kNew, &jsheap); | 1922 heap()->PrintToJSONObject(Heap::kNew, &jsheap); |
| 1922 heap()->PrintToJSONObject(Heap::kOld, &jsheap); | 1923 heap()->PrintToJSONObject(Heap::kOld, &jsheap); |
| 1923 } | 1924 } |
| 1924 | 1925 |
| 1925 jsobj.AddProperty("runnable", is_runnable()); | 1926 jsobj.AddProperty("runnable", is_runnable()); |
| 1926 jsobj.AddProperty("livePorts", message_handler()->live_ports()); | 1927 jsobj.AddProperty("livePorts", message_handler()->live_ports()); |
| 1927 jsobj.AddProperty("pauseOnExit", message_handler()->should_pause_on_exit()); | 1928 jsobj.AddProperty("pauseOnExit", message_handler()->should_pause_on_exit()); |
| 1929 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 1928 jsobj.AddProperty("_isReloading", IsReloading()); | 1930 jsobj.AddProperty("_isReloading", IsReloading()); |
| 1931 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 1929 | 1932 |
| 1930 if (!is_runnable()) { | 1933 if (!is_runnable()) { |
| 1931 // Isolate is not yet runnable. | 1934 // Isolate is not yet runnable. |
| 1932 ASSERT((debugger() == NULL) || (debugger()->PauseEvent() == NULL)); | 1935 ASSERT((debugger() == NULL) || (debugger()->PauseEvent() == NULL)); |
| 1933 ServiceEvent pause_event(this, ServiceEvent::kNone); | 1936 ServiceEvent pause_event(this, ServiceEvent::kNone); |
| 1934 jsobj.AddProperty("pauseEvent", &pause_event); | 1937 jsobj.AddProperty("pauseEvent", &pause_event); |
| 1935 } else if (message_handler()->is_paused_on_start() || | 1938 } else if (message_handler()->is_paused_on_start() || |
| 1936 message_handler()->should_pause_on_start()) { | 1939 message_handler()->should_pause_on_start()) { |
| 1937 ASSERT((debugger() == NULL) || (debugger()->PauseEvent() == NULL)); | 1940 ASSERT((debugger() == NULL) || (debugger()->PauseEvent() == NULL)); |
| 1938 ServiceEvent pause_event(this, ServiceEvent::kPauseStart); | 1941 ServiceEvent pause_event(this, ServiceEvent::kPauseStart); |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2300 // until we are told to resume. | 2303 // until we are told to resume. |
| 2301 if (pause_loop_monitor_ == NULL) { | 2304 if (pause_loop_monitor_ == NULL) { |
| 2302 pause_loop_monitor_ = new Monitor(); | 2305 pause_loop_monitor_ = new Monitor(); |
| 2303 } | 2306 } |
| 2304 Dart_EnterScope(); | 2307 Dart_EnterScope(); |
| 2305 MonitorLocker ml(pause_loop_monitor_); | 2308 MonitorLocker ml(pause_loop_monitor_); |
| 2306 | 2309 |
| 2307 Dart_MessageNotifyCallback saved_notify_callback = message_notify_callback(); | 2310 Dart_MessageNotifyCallback saved_notify_callback = message_notify_callback(); |
| 2308 set_message_notify_callback(Isolate::WakePauseEventHandler); | 2311 set_message_notify_callback(Isolate::WakePauseEventHandler); |
| 2309 | 2312 |
| 2313 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 2310 const bool had_isolate_reload_context = reload_context() != NULL; | 2314 const bool had_isolate_reload_context = reload_context() != NULL; |
| 2311 const int64_t start_time_micros = | 2315 const int64_t start_time_micros = |
| 2312 !had_isolate_reload_context ? 0 : reload_context()->start_time_micros(); | 2316 !had_isolate_reload_context ? 0 : reload_context()->start_time_micros(); |
| 2317 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 2313 bool resume = false; | 2318 bool resume = false; |
| 2314 while (true) { | 2319 while (true) { |
| 2315 // Handle all available vm service messages, up to a resume | 2320 // Handle all available vm service messages, up to a resume |
| 2316 // request. | 2321 // request. |
| 2317 while (!resume && Dart_HasServiceMessages()) { | 2322 while (!resume && Dart_HasServiceMessages()) { |
| 2318 ml.Exit(); | 2323 ml.Exit(); |
| 2319 resume = Dart_HandleServiceMessages(); | 2324 resume = Dart_HandleServiceMessages(); |
| 2320 ml.Enter(); | 2325 ml.Enter(); |
| 2321 } | 2326 } |
| 2322 if (resume) { | 2327 if (resume) { |
| 2323 break; | 2328 break; |
| 2324 } | 2329 } |
| 2325 | 2330 |
| 2331 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 2326 if (had_isolate_reload_context && (reload_context() == NULL)) { | 2332 if (had_isolate_reload_context && (reload_context() == NULL)) { |
| 2327 if (FLAG_trace_reload) { | 2333 if (FLAG_trace_reload) { |
| 2328 const int64_t reload_time_micros = | 2334 const int64_t reload_time_micros = |
| 2329 OS::GetCurrentMonotonicMicros() - start_time_micros; | 2335 OS::GetCurrentMonotonicMicros() - start_time_micros; |
| 2330 double reload_millis = MicrosecondsToMilliseconds(reload_time_micros); | 2336 double reload_millis = MicrosecondsToMilliseconds(reload_time_micros); |
| 2331 OS::Print("Reloading has finished! (%.2f ms)\n", reload_millis); | 2337 OS::Print("Reloading has finished! (%.2f ms)\n", reload_millis); |
| 2332 } | 2338 } |
| 2333 break; | 2339 break; |
| 2334 } | 2340 } |
| 2341 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 2335 | 2342 |
| 2336 // Wait for more service messages. | 2343 // Wait for more service messages. |
| 2337 Monitor::WaitResult res = ml.Wait(); | 2344 Monitor::WaitResult res = ml.Wait(); |
| 2338 ASSERT(res == Monitor::kNotified); | 2345 ASSERT(res == Monitor::kNotified); |
| 2339 } | 2346 } |
| 2340 set_message_notify_callback(saved_notify_callback); | 2347 set_message_notify_callback(saved_notify_callback); |
| 2341 Dart_ExitScope(); | 2348 Dart_ExitScope(); |
| 2342 } | 2349 } |
| 2343 #endif // !PRODUCT | 2350 #endif // !PRODUCT |
| 2344 | 2351 |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2832 void IsolateSpawnState::DecrementSpawnCount() { | 2839 void IsolateSpawnState::DecrementSpawnCount() { |
| 2833 ASSERT(spawn_count_monitor_ != NULL); | 2840 ASSERT(spawn_count_monitor_ != NULL); |
| 2834 ASSERT(spawn_count_ != NULL); | 2841 ASSERT(spawn_count_ != NULL); |
| 2835 MonitorLocker ml(spawn_count_monitor_); | 2842 MonitorLocker ml(spawn_count_monitor_); |
| 2836 ASSERT(*spawn_count_ > 0); | 2843 ASSERT(*spawn_count_ > 0); |
| 2837 *spawn_count_ = *spawn_count_ - 1; | 2844 *spawn_count_ = *spawn_count_ - 1; |
| 2838 ml.Notify(); | 2845 ml.Notify(); |
| 2839 } | 2846 } |
| 2840 | 2847 |
| 2841 } // namespace dart | 2848 } // namespace dart |
| OLD | NEW |