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

Unified Diff: src/atomic-utils.h

Issue 1343883004: Add barriers to atomic utils. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test expectations Created 5 years, 3 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 | « no previous file | test/unittests/atomic-utils-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/atomic-utils.h
diff --git a/src/atomic-utils.h b/src/atomic-utils.h
index 9eb0bc4e39214e3e627b98404a3d64b5f1481e96..0bfd52cfe95995e3d49ff0c8afdf8072e114b59c 100644
--- a/src/atomic-utils.h
+++ b/src/atomic-utils.h
@@ -20,14 +20,14 @@ class AtomicNumber {
explicit AtomicNumber(T initial) : value_(initial) {}
V8_INLINE void Increment(T increment) {
- base::NoBarrier_AtomicIncrement(&value_,
- static_cast<base::AtomicWord>(increment));
+ base::Barrier_AtomicIncrement(&value_,
+ static_cast<base::AtomicWord>(increment));
}
- V8_INLINE T Value() { return static_cast<T>(base::NoBarrier_Load(&value_)); }
+ V8_INLINE T Value() { return static_cast<T>(base::Acquire_Load(&value_)); }
V8_INLINE void SetValue(T new_value) {
- base::NoBarrier_Store(&value_, static_cast<base::AtomicWord>(new_value));
+ base::Release_Store(&value_, static_cast<base::AtomicWord>(new_value));
}
private:
@@ -45,19 +45,18 @@ class AtomicValue {
: value_(cast_helper<T>::to_storage_type(initial)) {}
V8_INLINE T Value() {
- return cast_helper<T>::to_return_type(base::NoBarrier_Load(&value_));
+ return cast_helper<T>::to_return_type(base::Acquire_Load(&value_));
}
V8_INLINE bool TrySetValue(T old_value, T new_value) {
- return base::NoBarrier_CompareAndSwap(
+ return base::Release_CompareAndSwap(
&value_, cast_helper<T>::to_storage_type(old_value),
cast_helper<T>::to_storage_type(new_value)) ==
cast_helper<T>::to_storage_type(old_value);
}
- V8_INLINE T /*old_value*/ SetValue(T new_value) {
- return cast_helper<T>::to_return_type(base::NoBarrier_AtomicExchange(
- &value_, cast_helper<T>::to_storage_type(new_value)));
+ V8_INLINE void SetValue(T new_value) {
+ base::Release_Store(&value_, cast_helper<T>::to_storage_type(new_value));
}
private:
@@ -102,12 +101,11 @@ class AtomicEnumSet {
bool IsEmpty() const { return ToIntegral() == 0; }
bool Contains(E element) const { return (ToIntegral() & Mask(element)) != 0; }
-
bool ContainsAnyOf(const AtomicEnumSet& set) const {
return (ToIntegral() & set.ToIntegral()) != 0;
}
- void RemoveAll() { base::NoBarrier_Store(&bits_, 0); }
+ void RemoveAll() { base::Release_Store(&bits_, 0); }
bool operator==(const AtomicEnumSet& set) const {
return ToIntegral() == set.ToIntegral();
@@ -153,7 +151,7 @@ class AtomicEnumSet {
STATIC_ASSERT(E::kLastValue < (sizeof(base::AtomicWord) * CHAR_BIT));
V8_INLINE base::AtomicWord ToIntegral() const {
- return base::NoBarrier_Load(&bits_);
+ return base::Acquire_Load(&bits_);
}
V8_INLINE base::AtomicWord Mask(E element) const {
« no previous file with comments | « no previous file | test/unittests/atomic-utils-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698