Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Unified Diff: src/vm-state-inl.h

Issue 2852047: Fix concurrent access to VMState::current_state_. (Closed)
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/vm-state.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/vm-state-inl.h
diff --git a/src/vm-state-inl.h b/src/vm-state-inl.h
index 4df2cfda73b4f47cc584287afffa986d26f91d1d..aa4cedbb134b532e20020f160ba8930a827b3c9d 100644
--- a/src/vm-state-inl.h
+++ b/src/vm-state-inl.h
@@ -74,8 +74,10 @@ VMState::VMState(StateTag state)
if (state == EXTERNAL) state = OTHER;
#endif
state_ = state;
- previous_ = current_state_; // Save the previous state.
- current_state_ = this; // Install the new state.
+ // Save the previous state.
+ previous_ = reinterpret_cast<VMState*>(current_state_);
+ // Install the new state.
+ OS::ReleaseStore(&current_state_, reinterpret_cast<AtomicWord>(this));
#ifdef ENABLE_LOGGING_AND_PROFILING
if (FLAG_log_state_changes) {
@@ -103,7 +105,8 @@ VMState::VMState(StateTag state)
VMState::~VMState() {
if (disabled_) return;
- current_state_ = previous_; // Return to the previous state.
+ // Return to the previous state.
+ OS::ReleaseStore(&current_state_, reinterpret_cast<AtomicWord>(previous_));
#ifdef ENABLE_LOGGING_AND_PROFILING
if (FLAG_log_state_changes) {
« no previous file with comments | « src/vm-state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698