Index: src/base/atomic-utils.h |
diff --git a/src/base/atomic-utils.h b/src/base/atomic-utils.h |
index 6731a810f18c06f7929c21e2ec9c7f5466bccbe0..e19385dcb15742909517cb208f048d10dfee9ea7 100644 |
--- a/src/base/atomic-utils.h |
+++ b/src/base/atomic-utils.h |
@@ -19,12 +19,18 @@ class AtomicNumber { |
AtomicNumber() : value_(0) {} |
explicit AtomicNumber(T initial) : value_(initial) {} |
- // Returns the newly set value. |
+ // Returns the value after incrementing. |
V8_INLINE T Increment(T increment) { |
return static_cast<T>(base::Barrier_AtomicIncrement( |
&value_, static_cast<base::AtomicWord>(increment))); |
} |
+ // Returns the value after decrementing. |
+ V8_INLINE T Decrement(T decrement) { |
+ return static_cast<T>(base::Barrier_AtomicIncrement( |
+ &value_, -static_cast<base::AtomicWord>(decrement))); |
+ } |
+ |
V8_INLINE T Value() { return static_cast<T>(base::Acquire_Load(&value_)); } |
V8_INLINE void SetValue(T new_value) { |
@@ -36,6 +42,9 @@ class AtomicNumber { |
return value; |
} |
+ V8_INLINE T operator+=(T value) { return Increment(value); } |
+ V8_INLINE T operator-=(T value) { return Decrement(value); } |
+ |
private: |
STATIC_ASSERT(sizeof(T) <= sizeof(base::AtomicWord)); |