Index: src/base/atomic-utils.h |
diff --git a/src/base/atomic-utils.h b/src/base/atomic-utils.h |
index e19385dcb15742909517cb208f048d10dfee9ea7..31db603bf94345bb84ce9ef7b135c513f8f9da3a 100644 |
--- a/src/base/atomic-utils.h |
+++ b/src/base/atomic-utils.h |
@@ -72,6 +72,22 @@ class AtomicValue { |
cast_helper<T>::to_storage_type(old_value); |
} |
+ V8_INLINE void SetBits(T bits, T mask) { |
+ DCHECK_EQ(bits & ~mask, 0); |
+ T old_value; |
+ T new_value; |
+ do { |
+ old_value = Value(); |
+ new_value = (old_value & ~mask) | bits; |
+ } while (!TrySetValue(old_value, new_value)); |
+ } |
+ |
+ V8_INLINE void SetBit(int bit) { |
+ SetBits(static_cast<T>(1) << bit, static_cast<T>(1) << bit); |
+ } |
+ |
+ V8_INLINE void ClearBit(int bit) { SetBits(0, 1 << bit); } |
+ |
V8_INLINE void SetValue(T new_value) { |
base::Release_Store(&value_, cast_helper<T>::to_storage_type(new_value)); |
} |