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/json.h" | 10 #include "platform/json.h" |
(...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 | 1639 |
1640 // Dump all timing data for the isolate. | 1640 // Dump all timing data for the isolate. |
1641 if (FLAG_timing) { | 1641 if (FLAG_timing) { |
1642 TimelinePauseTrace tpt; | 1642 TimelinePauseTrace tpt; |
1643 tpt.Print(); | 1643 tpt.Print(); |
1644 } | 1644 } |
1645 | 1645 |
1646 // Finalize any weak persistent handles with a non-null referent. | 1646 // Finalize any weak persistent handles with a non-null referent. |
1647 FinalizeWeakPersistentHandlesVisitor visitor; | 1647 FinalizeWeakPersistentHandlesVisitor visitor; |
1648 api_state()->weak_persistent_handles().VisitHandles(&visitor); | 1648 api_state()->weak_persistent_handles().VisitHandles(&visitor); |
1649 api_state()->prologue_weak_persistent_handles().VisitHandles(&visitor); | |
1650 | 1649 |
1651 if (FLAG_trace_isolates) { | 1650 if (FLAG_trace_isolates) { |
1652 heap()->PrintSizes(); | 1651 heap()->PrintSizes(); |
1653 MegamorphicCacheTable::PrintSizes(this); | 1652 MegamorphicCacheTable::PrintSizes(this); |
1654 Symbols::DumpStats(); | 1653 Symbols::DumpStats(); |
1655 OS::Print("[-] Stopping isolate:\n" | 1654 OS::Print("[-] Stopping isolate:\n" |
1656 "\tisolate: %s\n", name()); | 1655 "\tisolate: %s\n", name()); |
1657 } | 1656 } |
1658 if (FLAG_print_metrics) { | 1657 if (FLAG_print_metrics) { |
1659 LogBlock lb; | 1658 LogBlock lb; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1748 Dart_FileReadCallback Isolate::file_read_callback_ = NULL; | 1747 Dart_FileReadCallback Isolate::file_read_callback_ = NULL; |
1749 Dart_FileWriteCallback Isolate::file_write_callback_ = NULL; | 1748 Dart_FileWriteCallback Isolate::file_write_callback_ = NULL; |
1750 Dart_FileCloseCallback Isolate::file_close_callback_ = NULL; | 1749 Dart_FileCloseCallback Isolate::file_close_callback_ = NULL; |
1751 Dart_EntropySource Isolate::entropy_source_callback_ = NULL; | 1750 Dart_EntropySource Isolate::entropy_source_callback_ = NULL; |
1752 | 1751 |
1753 Monitor* Isolate::isolates_list_monitor_ = NULL; | 1752 Monitor* Isolate::isolates_list_monitor_ = NULL; |
1754 Isolate* Isolate::isolates_list_head_ = NULL; | 1753 Isolate* Isolate::isolates_list_head_ = NULL; |
1755 bool Isolate::creation_enabled_ = false; | 1754 bool Isolate::creation_enabled_ = false; |
1756 | 1755 |
1757 void Isolate::IterateObjectPointers(ObjectPointerVisitor* visitor, | 1756 void Isolate::IterateObjectPointers(ObjectPointerVisitor* visitor, |
1758 bool visit_prologue_weak_handles, | |
1759 bool validate_frames) { | 1757 bool validate_frames) { |
1760 HeapIterationScope heap_iteration_scope; | 1758 HeapIterationScope heap_iteration_scope; |
1761 VisitObjectPointers(visitor, visit_prologue_weak_handles, validate_frames); | 1759 VisitObjectPointers(visitor, validate_frames); |
1762 } | 1760 } |
1763 | 1761 |
1764 | 1762 |
1765 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, | 1763 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, |
1766 bool visit_prologue_weak_handles, | |
1767 bool validate_frames) { | 1764 bool validate_frames) { |
1768 ASSERT(visitor != NULL); | 1765 ASSERT(visitor != NULL); |
1769 | 1766 |
1770 // Visit objects in the object store. | 1767 // Visit objects in the object store. |
1771 object_store()->VisitObjectPointers(visitor); | 1768 object_store()->VisitObjectPointers(visitor); |
1772 | 1769 |
1773 // Visit objects in the class table. | 1770 // Visit objects in the class table. |
1774 class_table()->VisitObjectPointers(visitor); | 1771 class_table()->VisitObjectPointers(visitor); |
1775 | 1772 |
1776 // Visit objects in per isolate stubs. | 1773 // Visit objects in per isolate stubs. |
1777 StubCode::VisitObjectPointers(visitor); | 1774 StubCode::VisitObjectPointers(visitor); |
1778 | 1775 |
1779 // Visit the dart api state for all local and persistent handles. | 1776 // Visit the dart api state for all local and persistent handles. |
1780 if (api_state() != NULL) { | 1777 if (api_state() != NULL) { |
1781 api_state()->VisitObjectPointers(visitor, visit_prologue_weak_handles); | 1778 api_state()->VisitObjectPointers(visitor); |
1782 } | 1779 } |
1783 | 1780 |
1784 // Visit the current tag which is stored in the isolate. | 1781 // Visit the current tag which is stored in the isolate. |
1785 visitor->VisitPointer(reinterpret_cast<RawObject**>(¤t_tag_)); | 1782 visitor->VisitPointer(reinterpret_cast<RawObject**>(¤t_tag_)); |
1786 | 1783 |
1787 // Visit the default tag which is stored in the isolate. | 1784 // Visit the default tag which is stored in the isolate. |
1788 visitor->VisitPointer(reinterpret_cast<RawObject**>(&default_tag_)); | 1785 visitor->VisitPointer(reinterpret_cast<RawObject**>(&default_tag_)); |
1789 | 1786 |
1790 // Visit the tag table which is stored in the isolate. | 1787 // Visit the tag table which is stored in the isolate. |
1791 visitor->VisitPointer(reinterpret_cast<RawObject**>(&tag_table_)); | 1788 visitor->VisitPointer(reinterpret_cast<RawObject**>(&tag_table_)); |
(...skipping 20 matching lines...) Expand all Loading... |
1812 // Visit objects that are being used for deoptimization. | 1809 // Visit objects that are being used for deoptimization. |
1813 if (deopt_context() != NULL) { | 1810 if (deopt_context() != NULL) { |
1814 deopt_context()->VisitObjectPointers(visitor); | 1811 deopt_context()->VisitObjectPointers(visitor); |
1815 } | 1812 } |
1816 | 1813 |
1817 // Visit objects in thread registry (e.g., Dart stack, handles in zones). | 1814 // Visit objects in thread registry (e.g., Dart stack, handles in zones). |
1818 thread_registry()->VisitObjectPointers(visitor, validate_frames); | 1815 thread_registry()->VisitObjectPointers(visitor, validate_frames); |
1819 } | 1816 } |
1820 | 1817 |
1821 | 1818 |
1822 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor, | 1819 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor) { |
1823 bool visit_prologue_weak_handles) { | |
1824 if (api_state() != NULL) { | 1820 if (api_state() != NULL) { |
1825 api_state()->VisitWeakHandles(visitor, visit_prologue_weak_handles); | 1821 api_state()->VisitWeakHandles(visitor); |
1826 } | 1822 } |
1827 } | 1823 } |
1828 | 1824 |
1829 | |
1830 void Isolate::VisitPrologueWeakPersistentHandles(HandleVisitor* visitor) { | |
1831 if (api_state() != NULL) { | |
1832 api_state()->VisitPrologueWeakHandles(visitor); | |
1833 } | |
1834 } | |
1835 | |
1836 | 1825 |
1837 static const char* ExceptionPauseInfoToServiceEnum(Dart_ExceptionPauseInfo pi) { | 1826 static const char* ExceptionPauseInfoToServiceEnum(Dart_ExceptionPauseInfo pi) { |
1838 switch (pi) { | 1827 switch (pi) { |
1839 case kPauseOnAllExceptions: | 1828 case kPauseOnAllExceptions: |
1840 return "All"; | 1829 return "All"; |
1841 case kNoPauseOnExceptions: | 1830 case kNoPauseOnExceptions: |
1842 return "None"; | 1831 return "None"; |
1843 case kPauseOnUnhandledExceptions: | 1832 case kPauseOnUnhandledExceptions: |
1844 return "Unhandled"; | 1833 return "Unhandled"; |
1845 default: | 1834 default: |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2569 } | 2558 } |
2570 | 2559 |
2571 | 2560 |
2572 RawInstance* IsolateSpawnState::BuildMessage(Thread* thread) { | 2561 RawInstance* IsolateSpawnState::BuildMessage(Thread* thread) { |
2573 return DeserializeObject(thread, | 2562 return DeserializeObject(thread, |
2574 serialized_message_, serialized_message_len_); | 2563 serialized_message_, serialized_message_len_); |
2575 } | 2564 } |
2576 | 2565 |
2577 | 2566 |
2578 } // namespace dart | 2567 } // namespace dart |
OLD | NEW |