Index: src/base/atomic-utils.h |
diff --git a/src/base/atomic-utils.h b/src/base/atomic-utils.h |
index e19385dcb15742909517cb208f048d10dfee9ea7..bb55ea890042079b7bc88e0968731caa14294419 100644 |
--- a/src/base/atomic-utils.h |
+++ b/src/base/atomic-utils.h |
@@ -72,6 +72,20 @@ class AtomicValue { |
cast_helper<T>::to_storage_type(old_value); |
} |
+ V8_INLINE void SetBits(T bits, int mask) { |
ulan
2016/09/20 12:33:02
mask also should be T
Hannes Payer (out of office)
2016/09/20 13:51:29
Done.
|
+ 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(1 << bit, 1 << bit); } |
ulan
2016/09/20 12:33:02
How about static_cast<T>(1) << bit to avoid potent
Hannes Payer (out of office)
2016/09/20 13:51:29
Done.
|
+ |
+ 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)); |
} |