Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(523)

Side by Side Diff: runtime/vm/isolate.cc

Issue 1386503002: Initial design for background compilation (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address Comments Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/isolate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 stack_base_(0), 739 stack_base_(0),
739 stack_overflow_flags_(0), 740 stack_overflow_flags_(0),
740 stack_overflow_count_(0), 741 stack_overflow_count_(0),
741 message_handler_(NULL), 742 message_handler_(NULL),
742 spawn_state_(NULL), 743 spawn_state_(NULL),
743 is_runnable_(false), 744 is_runnable_(false),
744 gc_prologue_callback_(NULL), 745 gc_prologue_callback_(NULL),
745 gc_epilogue_callback_(NULL), 746 gc_epilogue_callback_(NULL),
746 defer_finalization_count_(0), 747 defer_finalization_count_(0),
747 deopt_context_(NULL), 748 deopt_context_(NULL),
749 background_compiler_(NULL),
748 compiler_stats_(NULL), 750 compiler_stats_(NULL),
749 is_service_isolate_(false), 751 is_service_isolate_(false),
750 stacktrace_(NULL), 752 stacktrace_(NULL),
751 stack_frame_index_(-1), 753 stack_frame_index_(-1),
752 last_allocationprofile_accumulator_reset_timestamp_(0), 754 last_allocationprofile_accumulator_reset_timestamp_(0),
753 last_allocationprofile_gc_timestamp_(0), 755 last_allocationprofile_gc_timestamp_(0),
754 object_id_ring_(NULL), 756 object_id_ring_(NULL),
755 trace_buffer_(NULL), 757 trace_buffer_(NULL),
756 profiler_data_(NULL), 758 profiler_data_(NULL),
757 tag_table_(GrowableObjectArray::null()), 759 tag_table_(GrowableObjectArray::null()),
758 collected_closures_(GrowableObjectArray::null()), 760 collected_closures_(GrowableObjectArray::null()),
759 deoptimized_code_array_(GrowableObjectArray::null()), 761 deoptimized_code_array_(GrowableObjectArray::null()),
762 background_compilation_queue_(GrowableObjectArray::null()),
760 pending_service_extension_calls_(GrowableObjectArray::null()), 763 pending_service_extension_calls_(GrowableObjectArray::null()),
761 registered_service_extension_handlers_(GrowableObjectArray::null()), 764 registered_service_extension_handlers_(GrowableObjectArray::null()),
762 metrics_list_head_(NULL), 765 metrics_list_head_(NULL),
763 compilation_allowed_(true), 766 compilation_allowed_(true),
764 cha_(NULL), 767 cha_(NULL),
765 next_(NULL), 768 next_(NULL),
766 pause_loop_monitor_(NULL), 769 pause_loop_monitor_(NULL),
767 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) 770 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS)
768 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) 771 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT)
769 reusable_handles_() { 772 reusable_handles_() {
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 1681
1679 #if defined(DEBUG) 1682 #if defined(DEBUG)
1680 // No concurrent sweeper tasks should be running at this point. 1683 // No concurrent sweeper tasks should be running at this point.
1681 if (heap_ != NULL) { 1684 if (heap_ != NULL) {
1682 PageSpace* old_space = heap_->old_space(); 1685 PageSpace* old_space = heap_->old_space();
1683 MonitorLocker ml(old_space->tasks_lock()); 1686 MonitorLocker ml(old_space->tasks_lock());
1684 ASSERT(old_space->tasks() == 0); 1687 ASSERT(old_space->tasks() == 0);
1685 } 1688 }
1686 #endif 1689 #endif
1687 1690
1691 BackgroundCompiler::Stop(background_compiler_);
1692
1688 // TODO(5411455): For now just make sure there are no current isolates 1693 // TODO(5411455): For now just make sure there are no current isolates
1689 // as we are shutting down the isolate. 1694 // as we are shutting down the isolate.
1690 Thread::ExitIsolate(); 1695 Thread::ExitIsolate();
1691 // All threads should have exited by now. 1696 // All threads should have exited by now.
1692 thread_registry()->CheckNotScheduled(this); 1697 thread_registry()->CheckNotScheduled(this);
1693 Profiler::ShutdownProfilingForIsolate(this); 1698 Profiler::ShutdownProfilingForIsolate(this);
1694 } 1699 }
1695 1700
1696 1701
1697 void Isolate::ReclaimTimelineBlocks() { 1702 void Isolate::ReclaimTimelineBlocks() {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 1758
1754 // Visit the default tag which is stored in the isolate. 1759 // Visit the default tag which is stored in the isolate.
1755 visitor->VisitPointer(reinterpret_cast<RawObject**>(&default_tag_)); 1760 visitor->VisitPointer(reinterpret_cast<RawObject**>(&default_tag_));
1756 1761
1757 // Visit the tag table which is stored in the isolate. 1762 // Visit the tag table which is stored in the isolate.
1758 visitor->VisitPointer(reinterpret_cast<RawObject**>(&tag_table_)); 1763 visitor->VisitPointer(reinterpret_cast<RawObject**>(&tag_table_));
1759 1764
1760 // Visit array of closures pending precompilation. 1765 // Visit array of closures pending precompilation.
1761 visitor->VisitPointer(reinterpret_cast<RawObject**>(&collected_closures_)); 1766 visitor->VisitPointer(reinterpret_cast<RawObject**>(&collected_closures_));
1762 1767
1768 visitor->VisitPointer(reinterpret_cast<RawObject**>(
1769 &background_compilation_queue_));
1770
1763 // Visit the deoptimized code array which is stored in the isolate. 1771 // Visit the deoptimized code array which is stored in the isolate.
1764 visitor->VisitPointer( 1772 visitor->VisitPointer(
1765 reinterpret_cast<RawObject**>(&deoptimized_code_array_)); 1773 reinterpret_cast<RawObject**>(&deoptimized_code_array_));
1766 1774
1767 // Visit the pending service extension calls. 1775 // Visit the pending service extension calls.
1768 visitor->VisitPointer( 1776 visitor->VisitPointer(
1769 reinterpret_cast<RawObject**>(&pending_service_extension_calls_)); 1777 reinterpret_cast<RawObject**>(&pending_service_extension_calls_));
1770 1778
1771 // Visit the registered service extension handlers. 1779 // Visit the registered service extension handlers.
1772 visitor->VisitPointer( 1780 visitor->VisitPointer(
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1962 void Isolate::set_collected_closures(const GrowableObjectArray& value) { 1970 void Isolate::set_collected_closures(const GrowableObjectArray& value) {
1963 collected_closures_ = value.raw(); 1971 collected_closures_ = value.raw();
1964 } 1972 }
1965 1973
1966 1974
1967 void Isolate::set_deoptimized_code_array(const GrowableObjectArray& value) { 1975 void Isolate::set_deoptimized_code_array(const GrowableObjectArray& value) {
1968 deoptimized_code_array_ = value.raw(); 1976 deoptimized_code_array_ = value.raw();
1969 } 1977 }
1970 1978
1971 1979
1980 void Isolate::set_background_compilation_queue(
1981 const GrowableObjectArray& value) {
1982 background_compilation_queue_ = value.raw();
1983 }
1984
1985
1972 void Isolate::TrackDeoptimizedCode(const Code& code) { 1986 void Isolate::TrackDeoptimizedCode(const Code& code) {
1973 ASSERT(!code.IsNull()); 1987 ASSERT(!code.IsNull());
1974 const GrowableObjectArray& deoptimized_code = 1988 const GrowableObjectArray& deoptimized_code =
1975 GrowableObjectArray::Handle(deoptimized_code_array()); 1989 GrowableObjectArray::Handle(deoptimized_code_array());
1976 if (deoptimized_code.IsNull()) { 1990 if (deoptimized_code.IsNull()) {
1977 // Not tracking deoptimized code. 1991 // Not tracking deoptimized code.
1978 return; 1992 return;
1979 } 1993 }
1980 // TODO(johnmccutchan): Scan this array and the isolate's profile before 1994 // TODO(johnmccutchan): Scan this array and the isolate's profile before
1981 // old space GC and remove the keep_code flag. 1995 // old space GC and remove the keep_code flag.
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
2560 serialized_message_, serialized_message_len_); 2574 serialized_message_, serialized_message_len_);
2561 } 2575 }
2562 2576
2563 2577
2564 void IsolateSpawnState::Cleanup() { 2578 void IsolateSpawnState::Cleanup() {
2565 SwitchIsolateScope switch_scope(I); 2579 SwitchIsolateScope switch_scope(I);
2566 Dart::ShutdownIsolate(); 2580 Dart::ShutdownIsolate();
2567 } 2581 }
2568 2582
2569 } // namespace dart 2583 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698