| 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 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1729 } | 1729 } |
| 1730 } | 1730 } |
| 1731 | 1731 |
| 1732 // Remove this isolate from the list *before* we start tearing it down, to | 1732 // Remove this isolate from the list *before* we start tearing it down, to |
| 1733 // avoid exposing it in a state of decay. | 1733 // avoid exposing it in a state of decay. |
| 1734 RemoveIsolateFromList(this); | 1734 RemoveIsolateFromList(this); |
| 1735 | 1735 |
| 1736 if (heap_ != NULL) { | 1736 if (heap_ != NULL) { |
| 1737 // Wait for any concurrent GC tasks to finish before shutting down. | 1737 // Wait for any concurrent GC tasks to finish before shutting down. |
| 1738 // TODO(koda): Support faster sweeper shutdown (e.g., after current page). | 1738 // TODO(koda): Support faster sweeper shutdown (e.g., after current page). |
| 1739 { | 1739 PageSpace* old_space = heap_->old_space(); |
| 1740 PageSpace* old_space = heap_->old_space(); | 1740 MonitorLocker ml(old_space->tasks_lock()); |
| 1741 MonitorLocker ml(old_space->tasks_lock()); | 1741 while (old_space->tasks() > 0) { |
| 1742 while (old_space->tasks() > 0) { | 1742 ml.Wait(); |
| 1743 ml.Wait(); | |
| 1744 } | |
| 1745 } | |
| 1746 | |
| 1747 // Wait for background finalization to finish before shutting down. | |
| 1748 { | |
| 1749 MonitorLocker ml(heap_->finalization_tasks_lock()); | |
| 1750 while (heap_->finalization_tasks() > 0) { | |
| 1751 ml.Wait(); | |
| 1752 } | |
| 1753 } | 1743 } |
| 1754 } | 1744 } |
| 1755 | 1745 |
| 1756 if (FLAG_check_reloaded && is_runnable() && | 1746 if (FLAG_check_reloaded && is_runnable() && |
| 1757 (this != Dart::vm_isolate()) && | 1747 (this != Dart::vm_isolate()) && |
| 1758 !ServiceIsolate::IsServiceIsolateDescendant(this)) { | 1748 !ServiceIsolate::IsServiceIsolateDescendant(this)) { |
| 1759 if (!HasAttemptedReload()) { | 1749 if (!HasAttemptedReload()) { |
| 1760 FATAL("Isolate did not reload before exiting and " | 1750 FATAL("Isolate did not reload before exiting and " |
| 1761 "--check-reloaded is enabled.\n"); | 1751 "--check-reloaded is enabled.\n"); |
| 1762 } | 1752 } |
| (...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2900 void IsolateSpawnState::DecrementSpawnCount() { | 2890 void IsolateSpawnState::DecrementSpawnCount() { |
| 2901 ASSERT(spawn_count_monitor_ != NULL); | 2891 ASSERT(spawn_count_monitor_ != NULL); |
| 2902 ASSERT(spawn_count_ != NULL); | 2892 ASSERT(spawn_count_ != NULL); |
| 2903 MonitorLocker ml(spawn_count_monitor_); | 2893 MonitorLocker ml(spawn_count_monitor_); |
| 2904 ASSERT(*spawn_count_ > 0); | 2894 ASSERT(*spawn_count_ > 0); |
| 2905 *spawn_count_ = *spawn_count_ - 1; | 2895 *spawn_count_ = *spawn_count_ - 1; |
| 2906 ml.Notify(); | 2896 ml.Notify(); |
| 2907 } | 2897 } |
| 2908 | 2898 |
| 2909 } // namespace dart | 2899 } // namespace dart |
| OLD | NEW |