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" |
| 11 #include "vm/atomic.h" |
11 #include "vm/class_finalizer.h" | 12 #include "vm/class_finalizer.h" |
12 #include "vm/code_observers.h" | 13 #include "vm/code_observers.h" |
13 #include "vm/compiler.h" | 14 #include "vm/compiler.h" |
14 #include "vm/compiler_stats.h" | 15 #include "vm/compiler_stats.h" |
15 #include "vm/dart_api_message.h" | 16 #include "vm/dart_api_message.h" |
16 #include "vm/dart_api_state.h" | 17 #include "vm/dart_api_state.h" |
17 #include "vm/dart_entry.h" | 18 #include "vm/dart_entry.h" |
18 #include "vm/debugger.h" | 19 #include "vm/debugger.h" |
19 #include "vm/deopt_instructions.h" | 20 #include "vm/deopt_instructions.h" |
20 #include "vm/flags.h" | 21 #include "vm/flags.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 NoOOBMessageScope::NoOOBMessageScope(Thread* thread) : StackResource(thread) { | 136 NoOOBMessageScope::NoOOBMessageScope(Thread* thread) : StackResource(thread) { |
136 thread->DeferOOBMessageInterrupts(); | 137 thread->DeferOOBMessageInterrupts(); |
137 } | 138 } |
138 | 139 |
139 | 140 |
140 NoOOBMessageScope::~NoOOBMessageScope() { | 141 NoOOBMessageScope::~NoOOBMessageScope() { |
141 thread()->RestoreOOBMessageInterrupts(); | 142 thread()->RestoreOOBMessageInterrupts(); |
142 } | 143 } |
143 | 144 |
144 | 145 |
145 | |
146 NoReloadScope::NoReloadScope(Isolate* isolate, Thread* thread) | 146 NoReloadScope::NoReloadScope(Isolate* isolate, Thread* thread) |
147 : StackResource(thread), | 147 : StackResource(thread), |
148 isolate_(isolate) { | 148 isolate_(isolate) { |
149 ASSERT(isolate_ != NULL); | 149 ASSERT(isolate_ != NULL); |
150 isolate_->no_reload_scope_depth_++; | 150 AtomicOperations::FetchAndIncrement(&(isolate_->no_reload_scope_depth_)); |
151 ASSERT(isolate_->no_reload_scope_depth_ >= 0); | 151 ASSERT( |
| 152 AtomicOperations::LoadRelaxed(&(isolate_->no_reload_scope_depth_)) >= 0); |
152 } | 153 } |
153 | 154 |
154 | 155 |
155 NoReloadScope::~NoReloadScope() { | 156 NoReloadScope::~NoReloadScope() { |
156 isolate_->no_reload_scope_depth_--; | 157 AtomicOperations::FetchAndDecrement(&(isolate_->no_reload_scope_depth_)); |
157 ASSERT(isolate_->no_reload_scope_depth_ >= 0); | 158 ASSERT( |
| 159 AtomicOperations::LoadRelaxed(&(isolate_->no_reload_scope_depth_)) >= 0); |
158 } | 160 } |
159 | 161 |
160 | 162 |
161 void Isolate::RegisterClass(const Class& cls) { | 163 void Isolate::RegisterClass(const Class& cls) { |
162 NOT_IN_PRODUCT( | 164 NOT_IN_PRODUCT( |
163 if (IsReloading()) { | 165 if (IsReloading()) { |
164 reload_context()->RegisterClass(cls); | 166 reload_context()->RegisterClass(cls); |
165 return; | 167 return; |
166 } | 168 } |
167 ) | 169 ) |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 } | 1069 } |
1068 lib.InitExportedNamesCache(); | 1070 lib.InitExportedNamesCache(); |
1069 } | 1071 } |
1070 TokenStream::CloseSharedTokenList(this); | 1072 TokenStream::CloseSharedTokenList(this); |
1071 } | 1073 } |
1072 | 1074 |
1073 | 1075 |
1074 bool Isolate::CanReload() const { | 1076 bool Isolate::CanReload() const { |
1075 #ifndef PRODUCT | 1077 #ifndef PRODUCT |
1076 return !ServiceIsolate::IsServiceIsolateDescendant(this) && | 1078 return !ServiceIsolate::IsServiceIsolateDescendant(this) && |
1077 is_runnable() && !IsReloading() && (no_reload_scope_depth_ == 0) && | 1079 is_runnable() && !IsReloading() && |
| 1080 (AtomicOperations::LoadRelaxed(&no_reload_scope_depth_) == 0) && |
1078 IsolateCreationEnabled(); | 1081 IsolateCreationEnabled(); |
1079 #else | 1082 #else |
1080 return false; | 1083 return false; |
1081 #endif | 1084 #endif |
1082 } | 1085 } |
1083 | 1086 |
1084 | 1087 |
1085 #ifndef PRODUCT | 1088 #ifndef PRODUCT |
1086 bool Isolate::ReloadSources(JSONStream* js, | 1089 bool Isolate::ReloadSources(JSONStream* js, |
1087 bool force_reload, | 1090 bool force_reload, |
(...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2893 void IsolateSpawnState::DecrementSpawnCount() { | 2896 void IsolateSpawnState::DecrementSpawnCount() { |
2894 ASSERT(spawn_count_monitor_ != NULL); | 2897 ASSERT(spawn_count_monitor_ != NULL); |
2895 ASSERT(spawn_count_ != NULL); | 2898 ASSERT(spawn_count_ != NULL); |
2896 MonitorLocker ml(spawn_count_monitor_); | 2899 MonitorLocker ml(spawn_count_monitor_); |
2897 ASSERT(*spawn_count_ > 0); | 2900 ASSERT(*spawn_count_ > 0); |
2898 *spawn_count_ = *spawn_count_ - 1; | 2901 *spawn_count_ = *spawn_count_ - 1; |
2899 ml.Notify(); | 2902 ml.Notify(); |
2900 } | 2903 } |
2901 | 2904 |
2902 } // namespace dart | 2905 } // namespace dart |
OLD | NEW |