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 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 ASSERT(thread->isolate() == isolate); | 1458 ASSERT(thread->isolate() == isolate); |
1459 StackZone zone(thread); | 1459 StackZone zone(thread); |
1460 HandleScope handle_scope(thread); | 1460 HandleScope handle_scope(thread); |
1461 // TODO(27003): Enable for precompiled. | 1461 // TODO(27003): Enable for precompiled. |
1462 #if defined(DEBUG) && !defined(DART_PRECOMPILED_RUNTIME) | 1462 #if defined(DEBUG) && !defined(DART_PRECOMPILED_RUNTIME) |
1463 if (!isolate->HasAttemptedReload()) { | 1463 if (!isolate->HasAttemptedReload()) { |
1464 // For this verification we need to stop the background compiler earlier. | 1464 // For this verification we need to stop the background compiler earlier. |
1465 // This would otherwise happen in Dart::ShowdownIsolate. | 1465 // This would otherwise happen in Dart::ShowdownIsolate. |
1466 isolate->StopBackgroundCompiler(); | 1466 isolate->StopBackgroundCompiler(); |
1467 isolate->heap()->CollectAllGarbage(); | 1467 isolate->heap()->CollectAllGarbage(); |
| 1468 HeapIterationScope iteration(thread); |
1468 VerifyCanonicalVisitor check_canonical(thread); | 1469 VerifyCanonicalVisitor check_canonical(thread); |
1469 isolate->heap()->IterateObjects(&check_canonical); | 1470 iteration.IterateObjects(&check_canonical); |
1470 } | 1471 } |
1471 #endif // DEBUG | 1472 #endif // DEBUG |
1472 const Error& error = Error::Handle(thread->sticky_error()); | 1473 const Error& error = Error::Handle(thread->sticky_error()); |
1473 if (!error.IsNull() && !error.IsUnwindError()) { | 1474 if (!error.IsNull() && !error.IsUnwindError()) { |
1474 OS::PrintErr("in ShutdownIsolate: %s\n", error.ToErrorCString()); | 1475 OS::PrintErr("in ShutdownIsolate: %s\n", error.ToErrorCString()); |
1475 } | 1476 } |
1476 Dart::RunShutdownCallback(); | 1477 Dart::RunShutdownCallback(); |
1477 } | 1478 } |
1478 // Shut the isolate down. | 1479 // Shut the isolate down. |
1479 Dart::ShutdownIsolate(isolate); | 1480 Dart::ShutdownIsolate(isolate); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1731 } | 1732 } |
1732 | 1733 |
1733 Dart_IsolateCreateCallback Isolate::create_callback_ = NULL; | 1734 Dart_IsolateCreateCallback Isolate::create_callback_ = NULL; |
1734 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; | 1735 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; |
1735 Dart_IsolateCleanupCallback Isolate::cleanup_callback_ = NULL; | 1736 Dart_IsolateCleanupCallback Isolate::cleanup_callback_ = NULL; |
1736 | 1737 |
1737 Monitor* Isolate::isolates_list_monitor_ = NULL; | 1738 Monitor* Isolate::isolates_list_monitor_ = NULL; |
1738 Isolate* Isolate::isolates_list_head_ = NULL; | 1739 Isolate* Isolate::isolates_list_head_ = NULL; |
1739 bool Isolate::creation_enabled_ = false; | 1740 bool Isolate::creation_enabled_ = false; |
1740 | 1741 |
1741 void Isolate::IterateObjectPointers(ObjectPointerVisitor* visitor, | |
1742 bool validate_frames) { | |
1743 HeapIterationScope heap_iteration_scope; | |
1744 VisitObjectPointers(visitor, validate_frames); | |
1745 } | |
1746 | |
1747 void Isolate::IterateStackPointers(ObjectPointerVisitor* visitor, | |
1748 bool validate_frames) { | |
1749 HeapIterationScope heap_iteration_scope; | |
1750 VisitStackPointers(visitor, validate_frames); | |
1751 } | |
1752 | |
1753 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, | 1742 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, |
1754 bool validate_frames) { | 1743 bool validate_frames) { |
1755 ASSERT(visitor != NULL); | 1744 ASSERT(visitor != NULL); |
1756 | 1745 |
1757 // Visit objects in the object store. | 1746 // Visit objects in the object store. |
1758 object_store()->VisitObjectPointers(visitor); | 1747 object_store()->VisitObjectPointers(visitor); |
1759 | 1748 |
1760 // Visit objects in the class table. | 1749 // Visit objects in the class table. |
1761 class_table()->VisitObjectPointers(visitor); | 1750 class_table()->VisitObjectPointers(visitor); |
1762 | 1751 |
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2853 void IsolateSpawnState::DecrementSpawnCount() { | 2842 void IsolateSpawnState::DecrementSpawnCount() { |
2854 ASSERT(spawn_count_monitor_ != NULL); | 2843 ASSERT(spawn_count_monitor_ != NULL); |
2855 ASSERT(spawn_count_ != NULL); | 2844 ASSERT(spawn_count_ != NULL); |
2856 MonitorLocker ml(spawn_count_monitor_); | 2845 MonitorLocker ml(spawn_count_monitor_); |
2857 ASSERT(*spawn_count_ > 0); | 2846 ASSERT(*spawn_count_ > 0); |
2858 *spawn_count_ = *spawn_count_ - 1; | 2847 *spawn_count_ = *spawn_count_ - 1; |
2859 ml.Notify(); | 2848 ml.Notify(); |
2860 } | 2849 } |
2861 | 2850 |
2862 } // namespace dart | 2851 } // namespace dart |
OLD | NEW |