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" |
11 #include "vm/class_finalizer.h" | 11 #include "vm/class_finalizer.h" |
12 #include "vm/code_observers.h" | 12 #include "vm/code_observers.h" |
13 #include "vm/compiler.h" | 13 #include "vm/compiler.h" |
14 #include "vm/compiler_stats.h" | 14 #include "vm/compiler_stats.h" |
15 #include "vm/coverage.h" | 15 #include "vm/coverage.h" |
16 #include "vm/dart_api_message.h" | 16 #include "vm/dart_api_message.h" |
17 #include "vm/dart_api_state.h" | 17 #include "vm/dart_api_state.h" |
18 #include "vm/dart_entry.h" | 18 #include "vm/dart_entry.h" |
19 #include "vm/debugger.h" | 19 #include "vm/debugger.h" |
20 #include "vm/deopt_instructions.h" | 20 #include "vm/deopt_instructions.h" |
| 21 #include "vm/flags.h" |
21 #include "vm/heap.h" | 22 #include "vm/heap.h" |
22 #include "vm/lockers.h" | 23 #include "vm/lockers.h" |
23 #include "vm/log.h" | 24 #include "vm/log.h" |
24 #include "vm/message_handler.h" | 25 #include "vm/message_handler.h" |
25 #include "vm/object_id_ring.h" | 26 #include "vm/object_id_ring.h" |
26 #include "vm/object_store.h" | 27 #include "vm/object_store.h" |
27 #include "vm/object.h" | 28 #include "vm/object.h" |
28 #include "vm/os_thread.h" | 29 #include "vm/os_thread.h" |
29 #include "vm/port.h" | 30 #include "vm/port.h" |
30 #include "vm/profiler.h" | 31 #include "vm/profiler.h" |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 gc_epilogue_callback_(NULL), | 814 gc_epilogue_callback_(NULL), |
814 defer_finalization_count_(0), | 815 defer_finalization_count_(0), |
815 deopt_context_(NULL), | 816 deopt_context_(NULL), |
816 compiler_stats_(NULL), | 817 compiler_stats_(NULL), |
817 is_service_isolate_(false), | 818 is_service_isolate_(false), |
818 stacktrace_(NULL), | 819 stacktrace_(NULL), |
819 stack_frame_index_(-1), | 820 stack_frame_index_(-1), |
820 last_allocationprofile_accumulator_reset_timestamp_(0), | 821 last_allocationprofile_accumulator_reset_timestamp_(0), |
821 last_allocationprofile_gc_timestamp_(0), | 822 last_allocationprofile_gc_timestamp_(0), |
822 object_id_ring_(NULL), | 823 object_id_ring_(NULL), |
823 trace_buffer_(NULL), | |
824 tag_table_(GrowableObjectArray::null()), | 824 tag_table_(GrowableObjectArray::null()), |
825 deoptimized_code_array_(GrowableObjectArray::null()), | 825 deoptimized_code_array_(GrowableObjectArray::null()), |
826 background_compiler_(NULL), | 826 background_compiler_(NULL), |
827 pending_service_extension_calls_(GrowableObjectArray::null()), | 827 pending_service_extension_calls_(GrowableObjectArray::null()), |
828 registered_service_extension_handlers_(GrowableObjectArray::null()), | 828 registered_service_extension_handlers_(GrowableObjectArray::null()), |
829 metrics_list_head_(NULL), | 829 metrics_list_head_(NULL), |
830 compilation_allowed_(true), | 830 compilation_allowed_(true), |
831 all_classes_finalized_(false), | 831 all_classes_finalized_(false), |
832 next_(NULL), | 832 next_(NULL), |
833 pause_loop_monitor_(NULL), | 833 pause_loop_monitor_(NULL), |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 result->debugger_ = new Debugger(); | 952 result->debugger_ = new Debugger(); |
953 result->debugger_->Initialize(result); | 953 result->debugger_->Initialize(result); |
954 } | 954 } |
955 if (FLAG_trace_isolates) { | 955 if (FLAG_trace_isolates) { |
956 if (name_prefix == NULL || strcmp(name_prefix, "vm-isolate") != 0) { | 956 if (name_prefix == NULL || strcmp(name_prefix, "vm-isolate") != 0) { |
957 OS::Print("[+] Starting isolate:\n" | 957 OS::Print("[+] Starting isolate:\n" |
958 "\tisolate: %s\n", result->name()); | 958 "\tisolate: %s\n", result->name()); |
959 } | 959 } |
960 } | 960 } |
961 | 961 |
962 result->compiler_stats_ = new CompilerStats(result); | 962 if (FLAG_support_compiler_stats) { |
963 if (FLAG_compiler_benchmark) { | 963 result->compiler_stats_ = new CompilerStats(result); |
964 result->compiler_stats_->EnableBenchmark(); | 964 if (FLAG_compiler_benchmark) { |
| 965 result->compiler_stats_->EnableBenchmark(); |
| 966 } |
965 } | 967 } |
966 | 968 |
967 if (FLAG_support_service) { | 969 if (FLAG_support_service) { |
968 ObjectIdRing::Init(result); | 970 ObjectIdRing::Init(result); |
969 } | 971 } |
970 | 972 |
971 // Add to isolate list. Shutdown and delete the isolate on failure. | 973 // Add to isolate list. Shutdown and delete the isolate on failure. |
972 if (!AddIsolateToList(result)) { | 974 if (!AddIsolateToList(result)) { |
973 result->LowLevelShutdown(); | 975 result->LowLevelShutdown(); |
974 Thread::ExitIsolate(); | 976 Thread::ExitIsolate(); |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 StackZone stack_zone(thread); | 1768 StackZone stack_zone(thread); |
1767 HandleScope handle_scope(thread); | 1769 HandleScope handle_scope(thread); |
1768 | 1770 |
1769 // Write out the coverage data if collection has been enabled. | 1771 // Write out the coverage data if collection has been enabled. |
1770 if ((this != Dart::vm_isolate()) && | 1772 if ((this != Dart::vm_isolate()) && |
1771 !ServiceIsolate::IsServiceIsolateDescendant(this)) { | 1773 !ServiceIsolate::IsServiceIsolateDescendant(this)) { |
1772 CodeCoverage::Write(thread); | 1774 CodeCoverage::Write(thread); |
1773 } | 1775 } |
1774 | 1776 |
1775 // Write compiler stats data if enabled. | 1777 // Write compiler stats data if enabled. |
1776 if (FLAG_compiler_stats | 1778 if (FLAG_support_compiler_stats && FLAG_compiler_stats |
1777 && !ServiceIsolate::IsServiceIsolateDescendant(this) | 1779 && !ServiceIsolate::IsServiceIsolateDescendant(this) |
1778 && (this != Dart::vm_isolate())) { | 1780 && (this != Dart::vm_isolate())) { |
1779 OS::Print("%s", compiler_stats()->PrintToZone()); | 1781 OS::Print("%s", compiler_stats()->PrintToZone()); |
1780 } | 1782 } |
1781 } | 1783 } |
1782 | 1784 |
1783 // Remove this isolate from the list *before* we start tearing it down, to | 1785 // Remove this isolate from the list *before* we start tearing it down, to |
1784 // avoid exposing it in a state of decay. | 1786 // avoid exposing it in a state of decay. |
1785 RemoveIsolateFromList(this); | 1787 RemoveIsolateFromList(this); |
1786 | 1788 |
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2818 void IsolateSpawnState::DecrementSpawnCount() { | 2820 void IsolateSpawnState::DecrementSpawnCount() { |
2819 ASSERT(spawn_count_monitor_ != NULL); | 2821 ASSERT(spawn_count_monitor_ != NULL); |
2820 ASSERT(spawn_count_ != NULL); | 2822 ASSERT(spawn_count_ != NULL); |
2821 MonitorLocker ml(spawn_count_monitor_); | 2823 MonitorLocker ml(spawn_count_monitor_); |
2822 ASSERT(*spawn_count_ > 0); | 2824 ASSERT(*spawn_count_ > 0); |
2823 *spawn_count_ = *spawn_count_ - 1; | 2825 *spawn_count_ = *spawn_count_ - 1; |
2824 ml.Notify(); | 2826 ml.Notify(); |
2825 } | 2827 } |
2826 | 2828 |
2827 } // namespace dart | 2829 } // namespace dart |
OLD | NEW |