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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 stack_base_(0), | 735 stack_base_(0), |
735 stack_overflow_flags_(0), | 736 stack_overflow_flags_(0), |
736 stack_overflow_count_(0), | 737 stack_overflow_count_(0), |
737 message_handler_(NULL), | 738 message_handler_(NULL), |
738 spawn_state_(NULL), | 739 spawn_state_(NULL), |
739 is_runnable_(false), | 740 is_runnable_(false), |
740 gc_prologue_callback_(NULL), | 741 gc_prologue_callback_(NULL), |
741 gc_epilogue_callback_(NULL), | 742 gc_epilogue_callback_(NULL), |
742 defer_finalization_count_(0), | 743 defer_finalization_count_(0), |
743 deopt_context_(NULL), | 744 deopt_context_(NULL), |
| 745 compile_optimized_task_(NULL), |
744 compiler_stats_(NULL), | 746 compiler_stats_(NULL), |
745 is_service_isolate_(false), | 747 is_service_isolate_(false), |
746 stacktrace_(NULL), | 748 stacktrace_(NULL), |
747 stack_frame_index_(-1), | 749 stack_frame_index_(-1), |
748 last_allocationprofile_accumulator_reset_timestamp_(0), | 750 last_allocationprofile_accumulator_reset_timestamp_(0), |
749 last_allocationprofile_gc_timestamp_(0), | 751 last_allocationprofile_gc_timestamp_(0), |
750 object_id_ring_(NULL), | 752 object_id_ring_(NULL), |
751 trace_buffer_(NULL), | 753 trace_buffer_(NULL), |
752 profiler_data_(NULL), | 754 profiler_data_(NULL), |
753 tag_table_(GrowableObjectArray::null()), | 755 tag_table_(GrowableObjectArray::null()), |
754 current_tag_(UserTag::null()), | 756 current_tag_(UserTag::null()), |
755 default_tag_(UserTag::null()), | 757 default_tag_(UserTag::null()), |
756 collected_closures_(GrowableObjectArray::null()), | 758 collected_closures_(GrowableObjectArray::null()), |
757 deoptimized_code_array_(GrowableObjectArray::null()), | 759 deoptimized_code_array_(GrowableObjectArray::null()), |
| 760 background_compilation_queue_(GrowableObjectArray::null()), |
758 pending_service_extension_calls_(GrowableObjectArray::null()), | 761 pending_service_extension_calls_(GrowableObjectArray::null()), |
759 registered_service_extension_handlers_(GrowableObjectArray::null()), | 762 registered_service_extension_handlers_(GrowableObjectArray::null()), |
760 metrics_list_head_(NULL), | 763 metrics_list_head_(NULL), |
761 compilation_allowed_(true), | 764 compilation_allowed_(true), |
762 cha_(NULL), | 765 cha_(NULL), |
763 next_(NULL), | 766 next_(NULL), |
764 pause_loop_monitor_(NULL), | 767 pause_loop_monitor_(NULL), |
765 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) | 768 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) |
766 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) | 769 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) |
767 reusable_handles_() { | 770 reusable_handles_() { |
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1676 | 1679 |
1677 #if defined(DEBUG) | 1680 #if defined(DEBUG) |
1678 // No concurrent sweeper tasks should be running at this point. | 1681 // No concurrent sweeper tasks should be running at this point. |
1679 if (heap_ != NULL) { | 1682 if (heap_ != NULL) { |
1680 PageSpace* old_space = heap_->old_space(); | 1683 PageSpace* old_space = heap_->old_space(); |
1681 MonitorLocker ml(old_space->tasks_lock()); | 1684 MonitorLocker ml(old_space->tasks_lock()); |
1682 ASSERT(old_space->tasks() == 0); | 1685 ASSERT(old_space->tasks() == 0); |
1683 } | 1686 } |
1684 #endif | 1687 #endif |
1685 | 1688 |
| 1689 CompileOptimizedTask::Stop(compile_optimized_task_); |
| 1690 |
1686 // TODO(5411455): For now just make sure there are no current isolates | 1691 // TODO(5411455): For now just make sure there are no current isolates |
1687 // as we are shutting down the isolate. | 1692 // as we are shutting down the isolate. |
1688 Thread::ExitIsolate(); | 1693 Thread::ExitIsolate(); |
1689 // All threads should have exited by now. | 1694 // All threads should have exited by now. |
1690 thread_registry()->CheckNotScheduled(this); | 1695 thread_registry()->CheckNotScheduled(this); |
1691 Profiler::ShutdownProfilingForIsolate(this); | 1696 Profiler::ShutdownProfilingForIsolate(this); |
1692 } | 1697 } |
1693 | 1698 |
1694 | 1699 |
1695 void Isolate::ReclaimTimelineBlocks() { | 1700 void Isolate::ReclaimTimelineBlocks() { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1751 | 1756 |
1752 // Visit the default tag which is stored in the isolate. | 1757 // Visit the default tag which is stored in the isolate. |
1753 visitor->VisitPointer(reinterpret_cast<RawObject**>(&default_tag_)); | 1758 visitor->VisitPointer(reinterpret_cast<RawObject**>(&default_tag_)); |
1754 | 1759 |
1755 // Visit the tag table which is stored in the isolate. | 1760 // Visit the tag table which is stored in the isolate. |
1756 visitor->VisitPointer(reinterpret_cast<RawObject**>(&tag_table_)); | 1761 visitor->VisitPointer(reinterpret_cast<RawObject**>(&tag_table_)); |
1757 | 1762 |
1758 // Visit array of closures pending precompilation. | 1763 // Visit array of closures pending precompilation. |
1759 visitor->VisitPointer(reinterpret_cast<RawObject**>(&collected_closures_)); | 1764 visitor->VisitPointer(reinterpret_cast<RawObject**>(&collected_closures_)); |
1760 | 1765 |
| 1766 visitor->VisitPointer(reinterpret_cast<RawObject**>( |
| 1767 &background_compilation_queue_)); |
| 1768 |
1761 // Visit the deoptimized code array which is stored in the isolate. | 1769 // Visit the deoptimized code array which is stored in the isolate. |
1762 visitor->VisitPointer( | 1770 visitor->VisitPointer( |
1763 reinterpret_cast<RawObject**>(&deoptimized_code_array_)); | 1771 reinterpret_cast<RawObject**>(&deoptimized_code_array_)); |
1764 | 1772 |
1765 // Visit the pending service extension calls. | 1773 // Visit the pending service extension calls. |
1766 visitor->VisitPointer( | 1774 visitor->VisitPointer( |
1767 reinterpret_cast<RawObject**>(&pending_service_extension_calls_)); | 1775 reinterpret_cast<RawObject**>(&pending_service_extension_calls_)); |
1768 | 1776 |
1769 // Visit the registered service extension handlers. | 1777 // Visit the registered service extension handlers. |
1770 visitor->VisitPointer( | 1778 visitor->VisitPointer( |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1960 void Isolate::set_collected_closures(const GrowableObjectArray& value) { | 1968 void Isolate::set_collected_closures(const GrowableObjectArray& value) { |
1961 collected_closures_ = value.raw(); | 1969 collected_closures_ = value.raw(); |
1962 } | 1970 } |
1963 | 1971 |
1964 | 1972 |
1965 void Isolate::set_deoptimized_code_array(const GrowableObjectArray& value) { | 1973 void Isolate::set_deoptimized_code_array(const GrowableObjectArray& value) { |
1966 deoptimized_code_array_ = value.raw(); | 1974 deoptimized_code_array_ = value.raw(); |
1967 } | 1975 } |
1968 | 1976 |
1969 | 1977 |
| 1978 void Isolate::set_background_compilation_queue( |
| 1979 const GrowableObjectArray& value) { |
| 1980 background_compilation_queue_ = value.raw(); |
| 1981 } |
| 1982 |
| 1983 |
1970 void Isolate::TrackDeoptimizedCode(const Code& code) { | 1984 void Isolate::TrackDeoptimizedCode(const Code& code) { |
1971 ASSERT(!code.IsNull()); | 1985 ASSERT(!code.IsNull()); |
1972 const GrowableObjectArray& deoptimized_code = | 1986 const GrowableObjectArray& deoptimized_code = |
1973 GrowableObjectArray::Handle(deoptimized_code_array()); | 1987 GrowableObjectArray::Handle(deoptimized_code_array()); |
1974 if (deoptimized_code.IsNull()) { | 1988 if (deoptimized_code.IsNull()) { |
1975 // Not tracking deoptimized code. | 1989 // Not tracking deoptimized code. |
1976 return; | 1990 return; |
1977 } | 1991 } |
1978 // TODO(johnmccutchan): Scan this array and the isolate's profile before | 1992 // TODO(johnmccutchan): Scan this array and the isolate's profile before |
1979 // old space GC and remove the keep_code flag. | 1993 // old space GC and remove the keep_code flag. |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2558 serialized_message_, serialized_message_len_); | 2572 serialized_message_, serialized_message_len_); |
2559 } | 2573 } |
2560 | 2574 |
2561 | 2575 |
2562 void IsolateSpawnState::Cleanup() { | 2576 void IsolateSpawnState::Cleanup() { |
2563 SwitchIsolateScope switch_scope(I); | 2577 SwitchIsolateScope switch_scope(I); |
2564 Dart::ShutdownIsolate(); | 2578 Dart::ShutdownIsolate(); |
2565 } | 2579 } |
2566 | 2580 |
2567 } // namespace dart | 2581 } // namespace dart |
OLD | NEW |