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" |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 symbols_mutex_(new Mutex()), | 769 symbols_mutex_(new Mutex()), |
770 type_canonicalization_mutex_(new Mutex()), | 770 type_canonicalization_mutex_(new Mutex()), |
771 constant_canonicalization_mutex_(new Mutex()), | 771 constant_canonicalization_mutex_(new Mutex()), |
772 message_handler_(NULL), | 772 message_handler_(NULL), |
773 spawn_state_(NULL), | 773 spawn_state_(NULL), |
774 is_runnable_(false), | 774 is_runnable_(false), |
775 gc_prologue_callback_(NULL), | 775 gc_prologue_callback_(NULL), |
776 gc_epilogue_callback_(NULL), | 776 gc_epilogue_callback_(NULL), |
777 defer_finalization_count_(0), | 777 defer_finalization_count_(0), |
778 deopt_context_(NULL), | 778 deopt_context_(NULL), |
779 compiler_stats_(NULL), | |
780 is_service_isolate_(false), | 779 is_service_isolate_(false), |
781 stacktrace_(NULL), | 780 stacktrace_(NULL), |
782 stack_frame_index_(-1), | 781 stack_frame_index_(-1), |
783 last_allocationprofile_accumulator_reset_timestamp_(0), | 782 last_allocationprofile_accumulator_reset_timestamp_(0), |
784 last_allocationprofile_gc_timestamp_(0), | 783 last_allocationprofile_gc_timestamp_(0), |
785 object_id_ring_(NULL), | 784 object_id_ring_(NULL), |
786 tag_table_(GrowableObjectArray::null()), | 785 tag_table_(GrowableObjectArray::null()), |
787 deoptimized_code_array_(GrowableObjectArray::null()), | 786 deoptimized_code_array_(GrowableObjectArray::null()), |
788 sticky_error_(Error::null()), | 787 sticky_error_(Error::null()), |
789 background_compiler_(NULL), | 788 background_compiler_(NULL), |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 if (FLAG_support_service) { | 838 if (FLAG_support_service) { |
840 delete object_id_ring_; | 839 delete object_id_ring_; |
841 } | 840 } |
842 object_id_ring_ = NULL; | 841 object_id_ring_ = NULL; |
843 delete pause_loop_monitor_; | 842 delete pause_loop_monitor_; |
844 pause_loop_monitor_ = NULL; | 843 pause_loop_monitor_ = NULL; |
845 delete boxed_field_list_mutex_; | 844 delete boxed_field_list_mutex_; |
846 boxed_field_list_mutex_ = NULL; | 845 boxed_field_list_mutex_ = NULL; |
847 ASSERT(spawn_count_ == 0); | 846 ASSERT(spawn_count_ == 0); |
848 delete spawn_count_monitor_; | 847 delete spawn_count_monitor_; |
849 if (compiler_stats_ != NULL) { | |
850 delete compiler_stats_; | |
851 compiler_stats_ = NULL; | |
852 } | |
853 delete safepoint_handler_; | 848 delete safepoint_handler_; |
854 delete thread_registry_; | 849 delete thread_registry_; |
855 } | 850 } |
856 | 851 |
857 | 852 |
858 void Isolate::InitOnce() { | 853 void Isolate::InitOnce() { |
859 create_callback_ = NULL; | 854 create_callback_ = NULL; |
860 isolates_list_monitor_ = new Monitor(); | 855 isolates_list_monitor_ = new Monitor(); |
861 ASSERT(isolates_list_monitor_ != NULL); | 856 ASSERT(isolates_list_monitor_ != NULL); |
862 EnableIsolateCreation(); | 857 EnableIsolateCreation(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 result->debugger_ = new Debugger(); | 911 result->debugger_ = new Debugger(); |
917 result->debugger_->Initialize(result); | 912 result->debugger_->Initialize(result); |
918 } | 913 } |
919 if (FLAG_trace_isolates) { | 914 if (FLAG_trace_isolates) { |
920 if (name_prefix == NULL || strcmp(name_prefix, "vm-isolate") != 0) { | 915 if (name_prefix == NULL || strcmp(name_prefix, "vm-isolate") != 0) { |
921 OS::Print("[+] Starting isolate:\n" | 916 OS::Print("[+] Starting isolate:\n" |
922 "\tisolate: %s\n", result->name()); | 917 "\tisolate: %s\n", result->name()); |
923 } | 918 } |
924 } | 919 } |
925 | 920 |
926 if (FLAG_support_compiler_stats) { | |
927 result->compiler_stats_ = new CompilerStats(result); | |
928 if (FLAG_compiler_benchmark) { | |
929 result->compiler_stats_->EnableBenchmark(); | |
930 } | |
931 } | |
932 | |
933 if (FLAG_support_service) { | 921 if (FLAG_support_service) { |
934 ObjectIdRing::Init(result); | 922 ObjectIdRing::Init(result); |
935 } | 923 } |
936 | 924 |
937 // Add to isolate list. Shutdown and delete the isolate on failure. | 925 // Add to isolate list. Shutdown and delete the isolate on failure. |
938 if (!AddIsolateToList(result)) { | 926 if (!AddIsolateToList(result)) { |
939 result->LowLevelShutdown(); | 927 result->LowLevelShutdown(); |
940 Thread::ExitIsolate(); | 928 Thread::ExitIsolate(); |
941 delete result; | 929 delete result; |
942 return NULL; | 930 return NULL; |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1564 // Write out the coverage data if collection has been enabled. | 1552 // Write out the coverage data if collection has been enabled. |
1565 if ((this != Dart::vm_isolate()) && | 1553 if ((this != Dart::vm_isolate()) && |
1566 !ServiceIsolate::IsServiceIsolateDescendant(this)) { | 1554 !ServiceIsolate::IsServiceIsolateDescendant(this)) { |
1567 CodeCoverage::Write(thread); | 1555 CodeCoverage::Write(thread); |
1568 } | 1556 } |
1569 | 1557 |
1570 // Write compiler stats data if enabled. | 1558 // Write compiler stats data if enabled. |
1571 if (FLAG_support_compiler_stats && FLAG_compiler_stats | 1559 if (FLAG_support_compiler_stats && FLAG_compiler_stats |
1572 && !ServiceIsolate::IsServiceIsolateDescendant(this) | 1560 && !ServiceIsolate::IsServiceIsolateDescendant(this) |
1573 && (this != Dart::vm_isolate())) { | 1561 && (this != Dart::vm_isolate())) { |
1574 OS::Print("%s", compiler_stats()->PrintToZone()); | 1562 OS::Print("%s", aggregate_compiler_stats()->PrintToZone()); |
1575 } | 1563 } |
1576 } | 1564 } |
1577 | 1565 |
1578 // Remove this isolate from the list *before* we start tearing it down, to | 1566 // Remove this isolate from the list *before* we start tearing it down, to |
1579 // avoid exposing it in a state of decay. | 1567 // avoid exposing it in a state of decay. |
1580 RemoveIsolateFromList(this); | 1568 RemoveIsolateFromList(this); |
1581 | 1569 |
1582 if (heap_ != NULL) { | 1570 if (heap_ != NULL) { |
1583 // Wait for any concurrent GC tasks to finish before shutting down. | 1571 // Wait for any concurrent GC tasks to finish before shutting down. |
1584 // TODO(koda): Support faster sweeper shutdown (e.g., after current page). | 1572 // TODO(koda): Support faster sweeper shutdown (e.g., after current page). |
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2649 void IsolateSpawnState::DecrementSpawnCount() { | 2637 void IsolateSpawnState::DecrementSpawnCount() { |
2650 ASSERT(spawn_count_monitor_ != NULL); | 2638 ASSERT(spawn_count_monitor_ != NULL); |
2651 ASSERT(spawn_count_ != NULL); | 2639 ASSERT(spawn_count_ != NULL); |
2652 MonitorLocker ml(spawn_count_monitor_); | 2640 MonitorLocker ml(spawn_count_monitor_); |
2653 ASSERT(*spawn_count_ > 0); | 2641 ASSERT(*spawn_count_ > 0); |
2654 *spawn_count_ = *spawn_count_ - 1; | 2642 *spawn_count_ = *spawn_count_ - 1; |
2655 ml.Notify(); | 2643 ml.Notify(); |
2656 } | 2644 } |
2657 | 2645 |
2658 } // namespace dart | 2646 } // namespace dart |
OLD | NEW |