Index: runtime/vm/isolate.cc |
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc |
index f950d7ef3f2ebf225aa7d76889f380bacc8b343e..a58c7baaf5373bda3593acfe5e392e14a42cb287 100644 |
--- a/runtime/vm/isolate.cc |
+++ b/runtime/vm/isolate.cc |
@@ -8,6 +8,7 @@ |
#include "include/dart_native_api.h" |
#include "platform/assert.h" |
#include "platform/text_buffer.h" |
+#include "vm/atomic.h" |
#include "vm/class_finalizer.h" |
#include "vm/code_observers.h" |
#include "vm/compiler.h" |
@@ -142,19 +143,20 @@ NoOOBMessageScope::~NoOOBMessageScope() { |
} |
- |
NoReloadScope::NoReloadScope(Isolate* isolate, Thread* thread) |
: StackResource(thread), |
isolate_(isolate) { |
ASSERT(isolate_ != NULL); |
- isolate_->no_reload_scope_depth_++; |
- ASSERT(isolate_->no_reload_scope_depth_ >= 0); |
+ AtomicOperations::FetchAndIncrement(&(isolate_->no_reload_scope_depth_)); |
+ ASSERT( |
+ AtomicOperations::LoadRelaxed(&(isolate_->no_reload_scope_depth_)) >= 0); |
} |
NoReloadScope::~NoReloadScope() { |
- isolate_->no_reload_scope_depth_--; |
- ASSERT(isolate_->no_reload_scope_depth_ >= 0); |
+ AtomicOperations::FetchAndDecrement(&(isolate_->no_reload_scope_depth_)); |
+ ASSERT( |
+ AtomicOperations::LoadRelaxed(&(isolate_->no_reload_scope_depth_)) >= 0); |
} |
@@ -1074,7 +1076,8 @@ void Isolate::DoneLoading() { |
bool Isolate::CanReload() const { |
#ifndef PRODUCT |
return !ServiceIsolate::IsServiceIsolateDescendant(this) && |
- is_runnable() && !IsReloading() && (no_reload_scope_depth_ == 0) && |
+ is_runnable() && !IsReloading() && |
+ (AtomicOperations::LoadRelaxed(&no_reload_scope_depth_) == 0) && |
IsolateCreationEnabled(); |
#else |
return false; |