| 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 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 deopt_context_(NULL), | 806 deopt_context_(NULL), |
| 807 is_service_isolate_(false), | 807 is_service_isolate_(false), |
| 808 stacktrace_(NULL), | 808 stacktrace_(NULL), |
| 809 stack_frame_index_(-1), | 809 stack_frame_index_(-1), |
| 810 last_allocationprofile_accumulator_reset_timestamp_(0), | 810 last_allocationprofile_accumulator_reset_timestamp_(0), |
| 811 last_allocationprofile_gc_timestamp_(0), | 811 last_allocationprofile_gc_timestamp_(0), |
| 812 object_id_ring_(NULL), | 812 object_id_ring_(NULL), |
| 813 tag_table_(GrowableObjectArray::null()), | 813 tag_table_(GrowableObjectArray::null()), |
| 814 deoptimized_code_array_(GrowableObjectArray::null()), | 814 deoptimized_code_array_(GrowableObjectArray::null()), |
| 815 sticky_error_(Error::null()), | 815 sticky_error_(Error::null()), |
| 816 sticky_reload_error_(Error::null()), |
| 816 background_compiler_(NULL), | 817 background_compiler_(NULL), |
| 817 background_compiler_disabled_depth_(0), | 818 background_compiler_disabled_depth_(0), |
| 818 pending_service_extension_calls_(GrowableObjectArray::null()), | 819 pending_service_extension_calls_(GrowableObjectArray::null()), |
| 819 registered_service_extension_handlers_(GrowableObjectArray::null()), | 820 registered_service_extension_handlers_(GrowableObjectArray::null()), |
| 820 metrics_list_head_(NULL), | 821 metrics_list_head_(NULL), |
| 821 compilation_allowed_(true), | 822 compilation_allowed_(true), |
| 822 all_classes_finalized_(false), | 823 all_classes_finalized_(false), |
| 823 next_(NULL), | 824 next_(NULL), |
| 824 pause_loop_monitor_(NULL), | 825 pause_loop_monitor_(NULL), |
| 825 loading_invalidation_gen_(kInvalidGen), | 826 loading_invalidation_gen_(kInvalidGen), |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 | 1060 |
| 1060 #ifndef PRODUCT | 1061 #ifndef PRODUCT |
| 1061 void Isolate::ReportReloadError(const Error& error) { | 1062 void Isolate::ReportReloadError(const Error& error) { |
| 1062 ASSERT(IsReloading()); | 1063 ASSERT(IsReloading()); |
| 1063 reload_context_->AbortReload(error); | 1064 reload_context_->AbortReload(error); |
| 1064 delete reload_context_; | 1065 delete reload_context_; |
| 1065 reload_context_ = NULL; | 1066 reload_context_ = NULL; |
| 1066 } | 1067 } |
| 1067 | 1068 |
| 1068 | 1069 |
| 1069 void Isolate::OnStackReload() { | |
| 1070 ReloadSources(); | |
| 1071 } | |
| 1072 | |
| 1073 | |
| 1074 void Isolate::ReloadSources(bool test_mode) { | 1070 void Isolate::ReloadSources(bool test_mode) { |
| 1075 ASSERT(!IsReloading()); | 1071 ASSERT(!IsReloading()); |
| 1076 has_attempted_reload_ = true; | 1072 has_attempted_reload_ = true; |
| 1077 reload_context_ = new IsolateReloadContext(this, test_mode); | 1073 reload_context_ = new IsolateReloadContext(this, test_mode); |
| 1078 reload_context_->StartReload(); | 1074 reload_context_->StartReload(); |
| 1079 } | 1075 } |
| 1080 | 1076 |
| 1081 #endif | 1077 #endif |
| 1082 | 1078 |
| 1083 | 1079 |
| 1084 void Isolate::DoneFinalizing() { | 1080 void Isolate::DoneFinalizing() { |
| 1085 NOT_IN_PRODUCT( | 1081 NOT_IN_PRODUCT( |
| 1086 if (IsReloading()) { | 1082 if (IsReloading()) { |
| 1087 reload_context_->FinishReload(); | 1083 reload_context_->FinishReload(); |
| 1088 if (reload_context_->has_error() && reload_context_->test_mode()) { | 1084 if (reload_context_->has_error() && reload_context_->test_mode()) { |
| 1089 // If the reload has an error and we are in test mode keep the reload | 1085 // If the reload has an error and we are in test mode keep the reload |
| 1090 // context on the isolate so that it can be used by unit tests. | 1086 // context on the isolate so that it can be used by unit tests. |
| 1091 return; | 1087 return; |
| 1092 } | 1088 } |
| 1089 if (reload_context_->has_error()) { |
| 1090 // Remember the reload error. |
| 1091 sticky_reload_error_ = reload_context_->error(); |
| 1092 } |
| 1093 if (!reload_context_->has_error()) { | 1093 if (!reload_context_->has_error()) { |
| 1094 reload_context_->ReportSuccess(); | 1094 reload_context_->ReportSuccess(); |
| 1095 } | 1095 } |
| 1096 delete reload_context_; | 1096 delete reload_context_; |
| 1097 reload_context_ = NULL; | 1097 reload_context_ = NULL; |
| 1098 } | 1098 } |
| 1099 ) | 1099 ) |
| 1100 } | 1100 } |
| 1101 | 1101 |
| 1102 | 1102 |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1745 background_compiler()->VisitPointers(visitor); | 1745 background_compiler()->VisitPointers(visitor); |
| 1746 } | 1746 } |
| 1747 | 1747 |
| 1748 // Visit the deoptimized code array which is stored in the isolate. | 1748 // Visit the deoptimized code array which is stored in the isolate. |
| 1749 visitor->VisitPointer( | 1749 visitor->VisitPointer( |
| 1750 reinterpret_cast<RawObject**>(&deoptimized_code_array_)); | 1750 reinterpret_cast<RawObject**>(&deoptimized_code_array_)); |
| 1751 | 1751 |
| 1752 visitor->VisitPointer( | 1752 visitor->VisitPointer( |
| 1753 reinterpret_cast<RawObject**>(&sticky_error_)); | 1753 reinterpret_cast<RawObject**>(&sticky_error_)); |
| 1754 | 1754 |
| 1755 visitor->VisitPointer( |
| 1756 reinterpret_cast<RawObject**>(&sticky_reload_error_)); |
| 1757 |
| 1755 // Visit the pending service extension calls. | 1758 // Visit the pending service extension calls. |
| 1756 visitor->VisitPointer( | 1759 visitor->VisitPointer( |
| 1757 reinterpret_cast<RawObject**>(&pending_service_extension_calls_)); | 1760 reinterpret_cast<RawObject**>(&pending_service_extension_calls_)); |
| 1758 | 1761 |
| 1759 // Visit the registered service extension handlers. | 1762 // Visit the registered service extension handlers. |
| 1760 visitor->VisitPointer( | 1763 visitor->VisitPointer( |
| 1761 reinterpret_cast<RawObject**>(®istered_service_extension_handlers_)); | 1764 reinterpret_cast<RawObject**>(®istered_service_extension_handlers_)); |
| 1762 | 1765 |
| 1763 // Visit the boxed_field_list_. | 1766 // Visit the boxed_field_list_. |
| 1764 // 'boxed_field_list_' access via mutator and background compilation threads | 1767 // 'boxed_field_list_' access via mutator and background compilation threads |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1998 // old space GC and remove the keep_code flag. | 2001 // old space GC and remove the keep_code flag. |
| 1999 deoptimized_code.Add(code); | 2002 deoptimized_code.Add(code); |
| 2000 } | 2003 } |
| 2001 | 2004 |
| 2002 | 2005 |
| 2003 void Isolate::clear_sticky_error() { | 2006 void Isolate::clear_sticky_error() { |
| 2004 sticky_error_ = Error::null(); | 2007 sticky_error_ = Error::null(); |
| 2005 } | 2008 } |
| 2006 | 2009 |
| 2007 | 2010 |
| 2011 void Isolate::clear_sticky_reload_error() { |
| 2012 sticky_reload_error_ = Error::null(); |
| 2013 } |
| 2014 |
| 2015 |
| 2008 void Isolate::set_pending_service_extension_calls( | 2016 void Isolate::set_pending_service_extension_calls( |
| 2009 const GrowableObjectArray& value) { | 2017 const GrowableObjectArray& value) { |
| 2010 pending_service_extension_calls_ = value.raw(); | 2018 pending_service_extension_calls_ = value.raw(); |
| 2011 } | 2019 } |
| 2012 | 2020 |
| 2013 | 2021 |
| 2014 void Isolate::set_registered_service_extension_handlers( | 2022 void Isolate::set_registered_service_extension_handlers( |
| 2015 const GrowableObjectArray& value) { | 2023 const GrowableObjectArray& value) { |
| 2016 registered_service_extension_handlers_ = value.raw(); | 2024 registered_service_extension_handlers_ = value.raw(); |
| 2017 } | 2025 } |
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2797 void IsolateSpawnState::DecrementSpawnCount() { | 2805 void IsolateSpawnState::DecrementSpawnCount() { |
| 2798 ASSERT(spawn_count_monitor_ != NULL); | 2806 ASSERT(spawn_count_monitor_ != NULL); |
| 2799 ASSERT(spawn_count_ != NULL); | 2807 ASSERT(spawn_count_ != NULL); |
| 2800 MonitorLocker ml(spawn_count_monitor_); | 2808 MonitorLocker ml(spawn_count_monitor_); |
| 2801 ASSERT(*spawn_count_ > 0); | 2809 ASSERT(*spawn_count_ > 0); |
| 2802 *spawn_count_ = *spawn_count_ - 1; | 2810 *spawn_count_ = *spawn_count_ - 1; |
| 2803 ml.Notify(); | 2811 ml.Notify(); |
| 2804 } | 2812 } |
| 2805 | 2813 |
| 2806 } // namespace dart | 2814 } // namespace dart |
| OLD | NEW |