| 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 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 #ifndef PRODUCT | 1091 #ifndef PRODUCT |
| 1092 void Isolate::ReportReloadError(const Error& error) { | 1092 void Isolate::ReportReloadError(const Error& error) { |
| 1093 ASSERT(IsReloading()); | 1093 ASSERT(IsReloading()); |
| 1094 reload_context_->AbortReload(error); | 1094 reload_context_->AbortReload(error); |
| 1095 } | 1095 } |
| 1096 | 1096 |
| 1097 | 1097 |
| 1098 bool Isolate::ReloadSources(JSONStream* js, | 1098 bool Isolate::ReloadSources(JSONStream* js, |
| 1099 bool force_reload, | 1099 bool force_reload, |
| 1100 bool dont_delete_reload_context) { | 1100 bool dont_delete_reload_context) { |
| 1101 // TODO(asiva): Add verification of canonical objects. | |
| 1102 ASSERT(!IsReloading()); | 1101 ASSERT(!IsReloading()); |
| 1103 has_attempted_reload_ = true; | 1102 has_attempted_reload_ = true; |
| 1104 reload_context_ = new IsolateReloadContext(this, js); | 1103 reload_context_ = new IsolateReloadContext(this, js); |
| 1105 reload_context_->StartReload(force_reload); | 1104 reload_context_->StartReload(force_reload); |
| 1106 bool success = !reload_context_->has_error(); | 1105 bool success = !reload_context_->has_error(); |
| 1107 // TODO(asiva): Add verification of canonical objects. | 1106 // Unit tests use the reload context later. Caller is responsible |
| 1108 if (dont_delete_reload_context) { | 1107 // for deleting the context. |
| 1109 // Unit tests use the reload context later. Caller is responsible | 1108 if (!dont_delete_reload_context) { |
| 1110 // for deleting the context. | 1109 DeleteReloadContext(); |
| 1111 return success; | |
| 1112 } | 1110 } |
| 1113 DeleteReloadContext(); | 1111 #if defined(DEBUG) |
| 1112 if (success) { |
| 1113 Thread* thread = Thread::Current(); |
| 1114 Isolate* isolate = thread->isolate(); |
| 1115 isolate->heap()->CollectAllGarbage(); |
| 1116 VerifyCanonicalVisitor check_canonical(thread); |
| 1117 isolate->heap()->IterateObjects(&check_canonical); |
| 1118 } |
| 1119 #endif // DEBUG |
| 1114 return success; | 1120 return success; |
| 1115 } | 1121 } |
| 1116 | 1122 |
| 1117 | 1123 |
| 1118 void Isolate::DeleteReloadContext() { | 1124 void Isolate::DeleteReloadContext() { |
| 1119 delete reload_context_; | 1125 delete reload_context_; |
| 1120 reload_context_ = NULL; | 1126 reload_context_ = NULL; |
| 1121 } | 1127 } |
| 1122 #endif // !PRODUCT | 1128 #endif // !PRODUCT |
| 1123 | 1129 |
| (...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2892 void IsolateSpawnState::DecrementSpawnCount() { | 2898 void IsolateSpawnState::DecrementSpawnCount() { |
| 2893 ASSERT(spawn_count_monitor_ != NULL); | 2899 ASSERT(spawn_count_monitor_ != NULL); |
| 2894 ASSERT(spawn_count_ != NULL); | 2900 ASSERT(spawn_count_ != NULL); |
| 2895 MonitorLocker ml(spawn_count_monitor_); | 2901 MonitorLocker ml(spawn_count_monitor_); |
| 2896 ASSERT(*spawn_count_ > 0); | 2902 ASSERT(*spawn_count_ > 0); |
| 2897 *spawn_count_ = *spawn_count_ - 1; | 2903 *spawn_count_ = *spawn_count_ - 1; |
| 2898 ml.Notify(); | 2904 ml.Notify(); |
| 2899 } | 2905 } |
| 2900 | 2906 |
| 2901 } // namespace dart | 2907 } // namespace dart |
| OLD | NEW |