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" |
| 11 #include "vm/class_finalizer.h" |
11 #include "vm/code_observers.h" | 12 #include "vm/code_observers.h" |
| 13 #include "vm/compiler.h" |
12 #include "vm/compiler_stats.h" | 14 #include "vm/compiler_stats.h" |
13 #include "vm/coverage.h" | 15 #include "vm/coverage.h" |
14 #include "vm/dart_api_message.h" | 16 #include "vm/dart_api_message.h" |
15 #include "vm/dart_api_state.h" | 17 #include "vm/dart_api_state.h" |
16 #include "vm/dart_entry.h" | 18 #include "vm/dart_entry.h" |
17 #include "vm/debugger.h" | 19 #include "vm/debugger.h" |
18 #include "vm/deopt_instructions.h" | 20 #include "vm/deopt_instructions.h" |
19 #include "vm/heap.h" | 21 #include "vm/heap.h" |
20 #include "vm/lockers.h" | 22 #include "vm/lockers.h" |
21 #include "vm/log.h" | 23 #include "vm/log.h" |
22 #include "vm/message_handler.h" | 24 #include "vm/message_handler.h" |
23 #include "vm/object_id_ring.h" | 25 #include "vm/object_id_ring.h" |
24 #include "vm/object_store.h" | 26 #include "vm/object_store.h" |
25 #include "vm/object.h" | 27 #include "vm/object.h" |
26 #include "vm/os_thread.h" | 28 #include "vm/os_thread.h" |
27 #include "vm/parser.h" | |
28 #include "vm/port.h" | 29 #include "vm/port.h" |
29 #include "vm/profiler.h" | 30 #include "vm/profiler.h" |
30 #include "vm/reusable_handles.h" | 31 #include "vm/reusable_handles.h" |
31 #include "vm/service.h" | 32 #include "vm/service.h" |
32 #include "vm/service_event.h" | 33 #include "vm/service_event.h" |
33 #include "vm/service_isolate.h" | 34 #include "vm/service_isolate.h" |
34 #include "vm/simulator.h" | 35 #include "vm/simulator.h" |
35 #include "vm/stack_frame.h" | 36 #include "vm/stack_frame.h" |
36 #include "vm/store_buffer.h" | 37 #include "vm/store_buffer.h" |
37 #include "vm/stub_code.h" | 38 #include "vm/stub_code.h" |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 stack_base_(0), | 740 stack_base_(0), |
740 stack_overflow_flags_(0), | 741 stack_overflow_flags_(0), |
741 stack_overflow_count_(0), | 742 stack_overflow_count_(0), |
742 message_handler_(NULL), | 743 message_handler_(NULL), |
743 spawn_state_(NULL), | 744 spawn_state_(NULL), |
744 is_runnable_(false), | 745 is_runnable_(false), |
745 gc_prologue_callback_(NULL), | 746 gc_prologue_callback_(NULL), |
746 gc_epilogue_callback_(NULL), | 747 gc_epilogue_callback_(NULL), |
747 defer_finalization_count_(0), | 748 defer_finalization_count_(0), |
748 deopt_context_(NULL), | 749 deopt_context_(NULL), |
| 750 compile_optimized_task_(NULL), |
749 compiler_stats_(NULL), | 751 compiler_stats_(NULL), |
750 is_service_isolate_(false), | 752 is_service_isolate_(false), |
751 stacktrace_(NULL), | 753 stacktrace_(NULL), |
752 stack_frame_index_(-1), | 754 stack_frame_index_(-1), |
753 last_allocationprofile_accumulator_reset_timestamp_(0), | 755 last_allocationprofile_accumulator_reset_timestamp_(0), |
754 last_allocationprofile_gc_timestamp_(0), | 756 last_allocationprofile_gc_timestamp_(0), |
755 object_id_ring_(NULL), | 757 object_id_ring_(NULL), |
756 trace_buffer_(NULL), | 758 trace_buffer_(NULL), |
757 profiler_data_(NULL), | 759 profiler_data_(NULL), |
758 tag_table_(GrowableObjectArray::null()), | 760 tag_table_(GrowableObjectArray::null()), |
759 current_tag_(UserTag::null()), | 761 current_tag_(UserTag::null()), |
760 default_tag_(UserTag::null()), | 762 default_tag_(UserTag::null()), |
761 collected_closures_(GrowableObjectArray::null()), | 763 collected_closures_(GrowableObjectArray::null()), |
762 deoptimized_code_array_(GrowableObjectArray::null()), | 764 deoptimized_code_array_(GrowableObjectArray::null()), |
| 765 background_compilation_queue_(GrowableObjectArray::null()), |
763 pending_service_extension_calls_(GrowableObjectArray::null()), | 766 pending_service_extension_calls_(GrowableObjectArray::null()), |
764 registered_service_extension_handlers_(GrowableObjectArray::null()), | 767 registered_service_extension_handlers_(GrowableObjectArray::null()), |
765 metrics_list_head_(NULL), | 768 metrics_list_head_(NULL), |
766 compilation_allowed_(true), | 769 compilation_allowed_(true), |
767 cha_(NULL), | 770 cha_(NULL), |
768 next_(NULL), | 771 next_(NULL), |
769 pause_loop_monitor_(NULL), | 772 pause_loop_monitor_(NULL), |
770 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) | 773 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) |
771 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) | 774 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) |
772 reusable_handles_() { | 775 reusable_handles_() { |
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1684 | 1687 |
1685 #if defined(DEBUG) | 1688 #if defined(DEBUG) |
1686 // No concurrent sweeper tasks should be running at this point. | 1689 // No concurrent sweeper tasks should be running at this point. |
1687 if (heap_ != NULL) { | 1690 if (heap_ != NULL) { |
1688 PageSpace* old_space = heap_->old_space(); | 1691 PageSpace* old_space = heap_->old_space(); |
1689 MonitorLocker ml(old_space->tasks_lock()); | 1692 MonitorLocker ml(old_space->tasks_lock()); |
1690 ASSERT(old_space->tasks() == 0); | 1693 ASSERT(old_space->tasks() == 0); |
1691 } | 1694 } |
1692 #endif | 1695 #endif |
1693 | 1696 |
| 1697 CompileOptimizedTask::Stop(compile_optimized_task_); |
| 1698 |
1694 // TODO(5411455): For now just make sure there are no current isolates | 1699 // TODO(5411455): For now just make sure there are no current isolates |
1695 // as we are shutting down the isolate. | 1700 // as we are shutting down the isolate. |
1696 Thread::ExitIsolate(); | 1701 Thread::ExitIsolate(); |
1697 // All threads should have exited by now. | 1702 // All threads should have exited by now. |
1698 thread_registry()->CheckNotScheduled(this); | 1703 thread_registry()->CheckNotScheduled(this); |
1699 Profiler::ShutdownProfilingForIsolate(this); | 1704 Profiler::ShutdownProfilingForIsolate(this); |
1700 } | 1705 } |
1701 | 1706 |
1702 | 1707 |
1703 void Isolate::ReclaimTimelineBlocks() { | 1708 void Isolate::ReclaimTimelineBlocks() { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1759 | 1764 |
1760 // Visit the default tag which is stored in the isolate. | 1765 // Visit the default tag which is stored in the isolate. |
1761 visitor->VisitPointer(reinterpret_cast<RawObject**>(&default_tag_)); | 1766 visitor->VisitPointer(reinterpret_cast<RawObject**>(&default_tag_)); |
1762 | 1767 |
1763 // Visit the tag table which is stored in the isolate. | 1768 // Visit the tag table which is stored in the isolate. |
1764 visitor->VisitPointer(reinterpret_cast<RawObject**>(&tag_table_)); | 1769 visitor->VisitPointer(reinterpret_cast<RawObject**>(&tag_table_)); |
1765 | 1770 |
1766 // Visit array of closures pending precompilation. | 1771 // Visit array of closures pending precompilation. |
1767 visitor->VisitPointer(reinterpret_cast<RawObject**>(&collected_closures_)); | 1772 visitor->VisitPointer(reinterpret_cast<RawObject**>(&collected_closures_)); |
1768 | 1773 |
| 1774 visitor->VisitPointer(reinterpret_cast<RawObject**>( |
| 1775 &background_compilation_queue_)); |
| 1776 |
1769 // Visit the deoptimized code array which is stored in the isolate. | 1777 // Visit the deoptimized code array which is stored in the isolate. |
1770 visitor->VisitPointer( | 1778 visitor->VisitPointer( |
1771 reinterpret_cast<RawObject**>(&deoptimized_code_array_)); | 1779 reinterpret_cast<RawObject**>(&deoptimized_code_array_)); |
1772 | 1780 |
1773 // Visit the pending service extension calls. | 1781 // Visit the pending service extension calls. |
1774 visitor->VisitPointer( | 1782 visitor->VisitPointer( |
1775 reinterpret_cast<RawObject**>(&pending_service_extension_calls_)); | 1783 reinterpret_cast<RawObject**>(&pending_service_extension_calls_)); |
1776 | 1784 |
1777 // Visit the registered service extension handlers. | 1785 // Visit the registered service extension handlers. |
1778 visitor->VisitPointer( | 1786 visitor->VisitPointer( |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1978 void Isolate::set_collected_closures(const GrowableObjectArray& value) { | 1986 void Isolate::set_collected_closures(const GrowableObjectArray& value) { |
1979 collected_closures_ = value.raw(); | 1987 collected_closures_ = value.raw(); |
1980 } | 1988 } |
1981 | 1989 |
1982 | 1990 |
1983 void Isolate::set_deoptimized_code_array(const GrowableObjectArray& value) { | 1991 void Isolate::set_deoptimized_code_array(const GrowableObjectArray& value) { |
1984 deoptimized_code_array_ = value.raw(); | 1992 deoptimized_code_array_ = value.raw(); |
1985 } | 1993 } |
1986 | 1994 |
1987 | 1995 |
| 1996 void Isolate::set_background_compilation_queue( |
| 1997 const GrowableObjectArray& value) { |
| 1998 background_compilation_queue_ = value.raw(); |
| 1999 } |
| 2000 |
| 2001 |
1988 void Isolate::TrackDeoptimizedCode(const Code& code) { | 2002 void Isolate::TrackDeoptimizedCode(const Code& code) { |
1989 ASSERT(!code.IsNull()); | 2003 ASSERT(!code.IsNull()); |
1990 const GrowableObjectArray& deoptimized_code = | 2004 const GrowableObjectArray& deoptimized_code = |
1991 GrowableObjectArray::Handle(deoptimized_code_array()); | 2005 GrowableObjectArray::Handle(deoptimized_code_array()); |
1992 if (deoptimized_code.IsNull()) { | 2006 if (deoptimized_code.IsNull()) { |
1993 // Not tracking deoptimized code. | 2007 // Not tracking deoptimized code. |
1994 return; | 2008 return; |
1995 } | 2009 } |
1996 // TODO(johnmccutchan): Scan this array and the isolate's profile before | 2010 // TODO(johnmccutchan): Scan this array and the isolate's profile before |
1997 // old space GC and remove the keep_code flag. | 2011 // old space GC and remove the keep_code flag. |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2576 serialized_message_, serialized_message_len_); | 2590 serialized_message_, serialized_message_len_); |
2577 } | 2591 } |
2578 | 2592 |
2579 | 2593 |
2580 void IsolateSpawnState::Cleanup() { | 2594 void IsolateSpawnState::Cleanup() { |
2581 SwitchIsolateScope switch_scope(I); | 2595 SwitchIsolateScope switch_scope(I); |
2582 Dart::ShutdownIsolate(); | 2596 Dart::ShutdownIsolate(); |
2583 } | 2597 } |
2584 | 2598 |
2585 } // namespace dart | 2599 } // namespace dart |
OLD | NEW |