| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "vm/visitor.h" | 48 #include "vm/visitor.h" |
| 49 | 49 |
| 50 | 50 |
| 51 namespace dart { | 51 namespace dart { |
| 52 | 52 |
| 53 DECLARE_FLAG(bool, print_metrics); | 53 DECLARE_FLAG(bool, print_metrics); |
| 54 DECLARE_FLAG(bool, timing); | 54 DECLARE_FLAG(bool, timing); |
| 55 DECLARE_FLAG(bool, trace_service); | 55 DECLARE_FLAG(bool, trace_service); |
| 56 DECLARE_FLAG(bool, trace_reload); | 56 DECLARE_FLAG(bool, trace_reload); |
| 57 DECLARE_FLAG(bool, warn_on_pause_with_no_debugger); | 57 DECLARE_FLAG(bool, warn_on_pause_with_no_debugger); |
| 58 DECLARE_FLAG(bool, check_reloaded); |
| 58 | 59 |
| 59 NOT_IN_PRODUCT( | 60 NOT_IN_PRODUCT( |
| 60 static void CheckedModeHandler(bool value) { | 61 static void CheckedModeHandler(bool value) { |
| 61 FLAG_enable_asserts = value; | 62 FLAG_enable_asserts = value; |
| 62 FLAG_enable_type_checks = value; | 63 FLAG_enable_type_checks = value; |
| 63 } | 64 } |
| 64 | 65 |
| 65 // --enable-checked-mode and --checked both enable checked mode which is | 66 // --enable-checked-mode and --checked both enable checked mode which is |
| 66 // equivalent to setting --enable-asserts and --enable-type-checks. | 67 // equivalent to setting --enable-asserts and --enable-type-checks. |
| 67 DEFINE_FLAG_HANDLER(CheckedModeHandler, | 68 DEFINE_FLAG_HANDLER(CheckedModeHandler, |
| (...skipping 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1689 | 1690 |
| 1690 // Wait for background finalization to finish before shutting down. | 1691 // Wait for background finalization to finish before shutting down. |
| 1691 { | 1692 { |
| 1692 MonitorLocker ml(heap_->finalization_tasks_lock()); | 1693 MonitorLocker ml(heap_->finalization_tasks_lock()); |
| 1693 while (heap_->finalization_tasks() > 0) { | 1694 while (heap_->finalization_tasks() > 0) { |
| 1694 ml.Wait(); | 1695 ml.Wait(); |
| 1695 } | 1696 } |
| 1696 } | 1697 } |
| 1697 } | 1698 } |
| 1698 | 1699 |
| 1700 if (FLAG_check_reloaded && |
| 1701 (this != Dart::vm_isolate()) && |
| 1702 !ServiceIsolate::IsServiceIsolateDescendant(this)) { |
| 1703 if (!HasAttemptedReload()) { |
| 1704 FATAL("Isolate did not reload before exiting and " |
| 1705 "--check-reloaded is enabled.\n"); |
| 1706 } |
| 1707 } |
| 1708 |
| 1699 // Then, proceed with low-level teardown. | 1709 // Then, proceed with low-level teardown. |
| 1700 LowLevelShutdown(); | 1710 LowLevelShutdown(); |
| 1701 | 1711 |
| 1702 #if defined(DEBUG) | 1712 #if defined(DEBUG) |
| 1703 // No concurrent sweeper tasks should be running at this point. | 1713 // No concurrent sweeper tasks should be running at this point. |
| 1704 if (heap_ != NULL) { | 1714 if (heap_ != NULL) { |
| 1705 PageSpace* old_space = heap_->old_space(); | 1715 PageSpace* old_space = heap_->old_space(); |
| 1706 MonitorLocker ml(old_space->tasks_lock()); | 1716 MonitorLocker ml(old_space->tasks_lock()); |
| 1707 ASSERT(old_space->tasks() == 0); | 1717 ASSERT(old_space->tasks() == 0); |
| 1708 } | 1718 } |
| (...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2821 void IsolateSpawnState::DecrementSpawnCount() { | 2831 void IsolateSpawnState::DecrementSpawnCount() { |
| 2822 ASSERT(spawn_count_monitor_ != NULL); | 2832 ASSERT(spawn_count_monitor_ != NULL); |
| 2823 ASSERT(spawn_count_ != NULL); | 2833 ASSERT(spawn_count_ != NULL); |
| 2824 MonitorLocker ml(spawn_count_monitor_); | 2834 MonitorLocker ml(spawn_count_monitor_); |
| 2825 ASSERT(*spawn_count_ > 0); | 2835 ASSERT(*spawn_count_ > 0); |
| 2826 *spawn_count_ = *spawn_count_ - 1; | 2836 *spawn_count_ = *spawn_count_ - 1; |
| 2827 ml.Notify(); | 2837 ml.Notify(); |
| 2828 } | 2838 } |
| 2829 | 2839 |
| 2830 } // namespace dart | 2840 } // namespace dart |
| OLD | NEW |