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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 deopt_context_(NULL), | 820 deopt_context_(NULL), |
821 is_service_isolate_(false), | 821 is_service_isolate_(false), |
822 stacktrace_(NULL), | 822 stacktrace_(NULL), |
823 stack_frame_index_(-1), | 823 stack_frame_index_(-1), |
824 last_allocationprofile_accumulator_reset_timestamp_(0), | 824 last_allocationprofile_accumulator_reset_timestamp_(0), |
825 last_allocationprofile_gc_timestamp_(0), | 825 last_allocationprofile_gc_timestamp_(0), |
826 object_id_ring_(NULL), | 826 object_id_ring_(NULL), |
827 tag_table_(GrowableObjectArray::null()), | 827 tag_table_(GrowableObjectArray::null()), |
828 deoptimized_code_array_(GrowableObjectArray::null()), | 828 deoptimized_code_array_(GrowableObjectArray::null()), |
829 sticky_error_(Error::null()), | 829 sticky_error_(Error::null()), |
830 sticky_reload_error_(Error::null()), | |
831 background_compiler_(NULL), | 830 background_compiler_(NULL), |
832 background_compiler_disabled_depth_(0), | 831 background_compiler_disabled_depth_(0), |
833 pending_service_extension_calls_(GrowableObjectArray::null()), | 832 pending_service_extension_calls_(GrowableObjectArray::null()), |
834 registered_service_extension_handlers_(GrowableObjectArray::null()), | 833 registered_service_extension_handlers_(GrowableObjectArray::null()), |
835 metrics_list_head_(NULL), | 834 metrics_list_head_(NULL), |
836 compilation_allowed_(true), | 835 compilation_allowed_(true), |
837 all_classes_finalized_(false), | 836 all_classes_finalized_(false), |
838 next_(NULL), | 837 next_(NULL), |
839 pause_loop_monitor_(NULL), | 838 pause_loop_monitor_(NULL), |
840 loading_invalidation_gen_(kInvalidGen), | 839 loading_invalidation_gen_(kInvalidGen), |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 } | 1088 } |
1090 | 1089 |
1091 | 1090 |
1092 #ifndef PRODUCT | 1091 #ifndef PRODUCT |
1093 void Isolate::ReportReloadError(const Error& error) { | 1092 void Isolate::ReportReloadError(const Error& error) { |
1094 ASSERT(IsReloading()); | 1093 ASSERT(IsReloading()); |
1095 reload_context_->AbortReload(error); | 1094 reload_context_->AbortReload(error); |
1096 } | 1095 } |
1097 | 1096 |
1098 | 1097 |
1099 void Isolate::ReloadSources(bool force_reload, | 1098 bool Isolate::ReloadSources(JSONStream* js, |
| 1099 bool force_reload, |
1100 bool dont_delete_reload_context) { | 1100 bool dont_delete_reload_context) { |
1101 // TODO(asiva): Add verification of canonical objects. | 1101 // TODO(asiva): Add verification of canonical objects. |
1102 ASSERT(!IsReloading()); | 1102 ASSERT(!IsReloading()); |
1103 has_attempted_reload_ = true; | 1103 has_attempted_reload_ = true; |
1104 reload_context_ = new IsolateReloadContext(this); | 1104 reload_context_ = new IsolateReloadContext(this, js); |
1105 reload_context_->StartReload(force_reload); | 1105 reload_context_->StartReload(force_reload); |
| 1106 bool success = !reload_context_->has_error(); |
1106 // TODO(asiva): Add verification of canonical objects. | 1107 // TODO(asiva): Add verification of canonical objects. |
1107 if (dont_delete_reload_context) { | 1108 if (dont_delete_reload_context) { |
1108 // Unit tests use the reload context later. Caller is responsible | 1109 // Unit tests use the reload context later. Caller is responsible |
1109 // for deleting the context. | 1110 // for deleting the context. |
1110 return; | 1111 return success; |
1111 } | 1112 } |
1112 DeleteReloadContext(); | 1113 DeleteReloadContext(); |
| 1114 return success; |
1113 } | 1115 } |
1114 | 1116 |
1115 | 1117 |
1116 void Isolate::DeleteReloadContext() { | 1118 void Isolate::DeleteReloadContext() { |
1117 delete reload_context_; | 1119 delete reload_context_; |
1118 reload_context_ = NULL; | 1120 reload_context_ = NULL; |
1119 } | 1121 } |
1120 #endif // !PRODUCT | 1122 #endif // !PRODUCT |
1121 | 1123 |
1122 | 1124 |
1123 void Isolate::DoneFinalizing() { | 1125 void Isolate::DoneFinalizing() { |
1124 NOT_IN_PRODUCT( | 1126 NOT_IN_PRODUCT( |
1125 if (IsReloading()) { | 1127 if (IsReloading()) { |
1126 reload_context_->FinishReload(); | 1128 reload_context_->FinishReload(); |
1127 if (reload_context_->has_error()) { | |
1128 // Remember the reload error. | |
1129 sticky_reload_error_ = reload_context_->error(); | |
1130 } else { | |
1131 reload_context_->ReportSuccess(); | |
1132 } | |
1133 } | 1129 } |
1134 ) | 1130 ) |
1135 } | 1131 } |
1136 | 1132 |
1137 | 1133 |
1138 | 1134 |
1139 bool Isolate::MakeRunnable() { | 1135 bool Isolate::MakeRunnable() { |
1140 ASSERT(Isolate::Current() == NULL); | 1136 ASSERT(Isolate::Current() == NULL); |
1141 | 1137 |
1142 MutexLocker ml(mutex_); | 1138 MutexLocker ml(mutex_); |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1824 background_compiler()->VisitPointers(visitor); | 1820 background_compiler()->VisitPointers(visitor); |
1825 } | 1821 } |
1826 | 1822 |
1827 // Visit the deoptimized code array which is stored in the isolate. | 1823 // Visit the deoptimized code array which is stored in the isolate. |
1828 visitor->VisitPointer( | 1824 visitor->VisitPointer( |
1829 reinterpret_cast<RawObject**>(&deoptimized_code_array_)); | 1825 reinterpret_cast<RawObject**>(&deoptimized_code_array_)); |
1830 | 1826 |
1831 visitor->VisitPointer( | 1827 visitor->VisitPointer( |
1832 reinterpret_cast<RawObject**>(&sticky_error_)); | 1828 reinterpret_cast<RawObject**>(&sticky_error_)); |
1833 | 1829 |
1834 visitor->VisitPointer( | |
1835 reinterpret_cast<RawObject**>(&sticky_reload_error_)); | |
1836 | |
1837 // Visit the pending service extension calls. | 1830 // Visit the pending service extension calls. |
1838 visitor->VisitPointer( | 1831 visitor->VisitPointer( |
1839 reinterpret_cast<RawObject**>(&pending_service_extension_calls_)); | 1832 reinterpret_cast<RawObject**>(&pending_service_extension_calls_)); |
1840 | 1833 |
1841 // Visit the registered service extension handlers. | 1834 // Visit the registered service extension handlers. |
1842 visitor->VisitPointer( | 1835 visitor->VisitPointer( |
1843 reinterpret_cast<RawObject**>(®istered_service_extension_handlers_)); | 1836 reinterpret_cast<RawObject**>(®istered_service_extension_handlers_)); |
1844 | 1837 |
1845 // Visit the boxed_field_list_. | 1838 // Visit the boxed_field_list_. |
1846 // 'boxed_field_list_' access via mutator and background compilation threads | 1839 // 'boxed_field_list_' access via mutator and background compilation threads |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2087 // old space GC and remove the keep_code flag. | 2080 // old space GC and remove the keep_code flag. |
2088 deoptimized_code.Add(code); | 2081 deoptimized_code.Add(code); |
2089 } | 2082 } |
2090 | 2083 |
2091 | 2084 |
2092 void Isolate::clear_sticky_error() { | 2085 void Isolate::clear_sticky_error() { |
2093 sticky_error_ = Error::null(); | 2086 sticky_error_ = Error::null(); |
2094 } | 2087 } |
2095 | 2088 |
2096 | 2089 |
2097 void Isolate::clear_sticky_reload_error() { | |
2098 sticky_reload_error_ = Error::null(); | |
2099 } | |
2100 | |
2101 | |
2102 void Isolate::set_pending_service_extension_calls( | 2090 void Isolate::set_pending_service_extension_calls( |
2103 const GrowableObjectArray& value) { | 2091 const GrowableObjectArray& value) { |
2104 pending_service_extension_calls_ = value.raw(); | 2092 pending_service_extension_calls_ = value.raw(); |
2105 } | 2093 } |
2106 | 2094 |
2107 | 2095 |
2108 void Isolate::set_registered_service_extension_handlers( | 2096 void Isolate::set_registered_service_extension_handlers( |
2109 const GrowableObjectArray& value) { | 2097 const GrowableObjectArray& value) { |
2110 registered_service_extension_handlers_ = value.raw(); | 2098 registered_service_extension_handlers_ = value.raw(); |
2111 } | 2099 } |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2904 void IsolateSpawnState::DecrementSpawnCount() { | 2892 void IsolateSpawnState::DecrementSpawnCount() { |
2905 ASSERT(spawn_count_monitor_ != NULL); | 2893 ASSERT(spawn_count_monitor_ != NULL); |
2906 ASSERT(spawn_count_ != NULL); | 2894 ASSERT(spawn_count_ != NULL); |
2907 MonitorLocker ml(spawn_count_monitor_); | 2895 MonitorLocker ml(spawn_count_monitor_); |
2908 ASSERT(*spawn_count_ > 0); | 2896 ASSERT(*spawn_count_ > 0); |
2909 *spawn_count_ = *spawn_count_ - 1; | 2897 *spawn_count_ = *spawn_count_ - 1; |
2910 ml.Notify(); | 2898 ml.Notify(); |
2911 } | 2899 } |
2912 | 2900 |
2913 } // namespace dart | 2901 } // namespace dart |
OLD | NEW |