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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 pause_loop_monitor_(NULL), | 839 pause_loop_monitor_(NULL), |
840 loading_invalidation_gen_(kInvalidGen), | 840 loading_invalidation_gen_(kInvalidGen), |
841 top_level_parsing_count_(0), | 841 top_level_parsing_count_(0), |
842 field_list_mutex_(new Mutex()), | 842 field_list_mutex_(new Mutex()), |
843 boxed_field_list_(GrowableObjectArray::null()), | 843 boxed_field_list_(GrowableObjectArray::null()), |
844 spawn_count_monitor_(new Monitor()), | 844 spawn_count_monitor_(new Monitor()), |
845 spawn_count_(0), | 845 spawn_count_(0), |
846 has_attempted_reload_(false), | 846 has_attempted_reload_(false), |
847 no_reload_scope_depth_(0), | 847 no_reload_scope_depth_(0), |
848 reload_every_n_stack_overflow_checks_(FLAG_reload_every), | 848 reload_every_n_stack_overflow_checks_(FLAG_reload_every), |
849 reload_context_(NULL) { | 849 reload_context_(NULL), |
| 850 reload_timestamp_(OS::GetCurrentTimeMillis()) { |
850 NOT_IN_PRODUCT(FlagsCopyFrom(api_flags)); | 851 NOT_IN_PRODUCT(FlagsCopyFrom(api_flags)); |
851 // TODO(asiva): A Thread is not available here, need to figure out | 852 // TODO(asiva): A Thread is not available here, need to figure out |
852 // how the vm_tag (kEmbedderTagId) can be set, these tags need to | 853 // how the vm_tag (kEmbedderTagId) can be set, these tags need to |
853 // move to the OSThread structure. | 854 // move to the OSThread structure. |
854 set_user_tag(UserTags::kDefaultUserTag); | 855 set_user_tag(UserTags::kDefaultUserTag); |
855 } | 856 } |
856 | 857 |
857 #undef REUSABLE_HANDLE_SCOPE_INIT | 858 #undef REUSABLE_HANDLE_SCOPE_INIT |
858 #undef REUSABLE_HANDLE_INITIALIZERS | 859 #undef REUSABLE_HANDLE_INITIALIZERS |
859 | 860 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 } | 1083 } |
1083 | 1084 |
1084 | 1085 |
1085 #ifndef PRODUCT | 1086 #ifndef PRODUCT |
1086 void Isolate::ReportReloadError(const Error& error) { | 1087 void Isolate::ReportReloadError(const Error& error) { |
1087 ASSERT(IsReloading()); | 1088 ASSERT(IsReloading()); |
1088 reload_context_->AbortReload(error); | 1089 reload_context_->AbortReload(error); |
1089 } | 1090 } |
1090 | 1091 |
1091 | 1092 |
1092 void Isolate::ReloadSources(bool dont_delete_reload_context) { | 1093 void Isolate::ReloadSources(bool force_reload, |
| 1094 bool dont_delete_reload_context) { |
1093 // TODO(asiva): Add verification of canonical objects. | 1095 // TODO(asiva): Add verification of canonical objects. |
1094 ASSERT(!IsReloading()); | 1096 ASSERT(!IsReloading()); |
1095 has_attempted_reload_ = true; | 1097 has_attempted_reload_ = true; |
1096 reload_context_ = new IsolateReloadContext(this); | 1098 reload_context_ = new IsolateReloadContext(this); |
1097 reload_context_->StartReload(); | 1099 reload_context_->StartReload(force_reload); |
1098 // TODO(asiva): Add verification of canonical objects. | 1100 // TODO(asiva): Add verification of canonical objects. |
1099 if (dont_delete_reload_context) { | 1101 if (dont_delete_reload_context) { |
1100 // Unit tests use the reload context later. Caller is responsible | 1102 // Unit tests use the reload context later. Caller is responsible |
1101 // for deleting the context. | 1103 // for deleting the context. |
1102 return; | 1104 return; |
1103 } | 1105 } |
1104 DeleteReloadContext(); | 1106 DeleteReloadContext(); |
1105 } | 1107 } |
1106 | 1108 |
1107 | 1109 |
1108 void Isolate::DeleteReloadContext() { | 1110 void Isolate::DeleteReloadContext() { |
1109 delete reload_context_; | 1111 delete reload_context_; |
1110 reload_context_ = NULL; | 1112 reload_context_ = NULL; |
1111 } | 1113 } |
1112 #endif // !PRODUCT | 1114 #endif // !PRODUCT |
1113 | 1115 |
1114 | 1116 |
1115 void Isolate::DoneFinalizing() { | 1117 void Isolate::DoneFinalizing() { |
1116 NOT_IN_PRODUCT( | 1118 NOT_IN_PRODUCT( |
1117 if (IsReloading()) { | 1119 if (IsReloading()) { |
1118 reload_context_->FinishReload(); | 1120 reload_context_->FinishReload(); |
1119 if (reload_context_->has_error()) { | 1121 if (reload_context_->has_error()) { |
1120 // Remember the reload error. | 1122 // Remember the reload error. |
1121 sticky_reload_error_ = reload_context_->error(); | 1123 sticky_reload_error_ = reload_context_->error(); |
1122 } else { | 1124 } else { |
1123 reload_context_->ReportSuccess(); | 1125 reload_context_->ReportSuccess(); |
| 1126 reload_timestamp_ = reload_context_->reload_timestamp(); |
1124 } | 1127 } |
1125 } | 1128 } |
1126 ) | 1129 ) |
1127 } | 1130 } |
1128 | 1131 |
1129 | 1132 |
1130 | 1133 |
1131 bool Isolate::MakeRunnable() { | 1134 bool Isolate::MakeRunnable() { |
1132 ASSERT(Isolate::Current() == NULL); | 1135 ASSERT(Isolate::Current() == NULL); |
1133 | 1136 |
(...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2891 void IsolateSpawnState::DecrementSpawnCount() { | 2894 void IsolateSpawnState::DecrementSpawnCount() { |
2892 ASSERT(spawn_count_monitor_ != NULL); | 2895 ASSERT(spawn_count_monitor_ != NULL); |
2893 ASSERT(spawn_count_ != NULL); | 2896 ASSERT(spawn_count_ != NULL); |
2894 MonitorLocker ml(spawn_count_monitor_); | 2897 MonitorLocker ml(spawn_count_monitor_); |
2895 ASSERT(*spawn_count_ > 0); | 2898 ASSERT(*spawn_count_ > 0); |
2896 *spawn_count_ = *spawn_count_ - 1; | 2899 *spawn_count_ = *spawn_count_ - 1; |
2897 ml.Notify(); | 2900 ml.Notify(); |
2898 } | 2901 } |
2899 | 2902 |
2900 } // namespace dart | 2903 } // namespace dart |
OLD | NEW |