Commit f321afee authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

Remove unused AtomicValue::TrySetValue method

AtomicValue is deprecated, so we can start removing things that are not
in use any more.

R=mstarzinger@chromium.org

Bug: v8:8238
Change-Id: I0a1445eccaf89f8869fd56e0fbece809bbcd6e5e
Reviewed-on: https://chromium-review.googlesource.com/c/1326464
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57404}
parent 878776f7
...@@ -28,29 +28,6 @@ class AtomicValue { ...@@ -28,29 +28,6 @@ class AtomicValue {
return cast_helper<T>::to_return_type(base::Acquire_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::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 void SetBits(T bits, T mask) {
DCHECK_EQ(bits & ~mask, static_cast<T>(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) { V8_INLINE void SetValue(T new_value) {
base::Release_Store(&value_, cast_helper<T>::to_storage_type(new_value)); base::Release_Store(&value_, cast_helper<T>::to_storage_type(new_value));
} }
......
...@@ -12,11 +12,7 @@ namespace v8 { ...@@ -12,11 +12,7 @@ namespace v8 {
namespace base { namespace base {
namespace { namespace {
enum TestFlag : base::AtomicWord { enum TestFlag : base::AtomicWord { kA, kB, kC };
kA,
kB,
kC,
};
} // namespace } // namespace
...@@ -26,15 +22,6 @@ TEST(AtomicValue, Initial) { ...@@ -26,15 +22,6 @@ TEST(AtomicValue, Initial) {
EXPECT_EQ(TestFlag::kA, a.Value()); EXPECT_EQ(TestFlag::kA, a.Value());
} }
TEST(AtomicValue, TrySetValue) {
AtomicValue<TestFlag> a(kA);
EXPECT_FALSE(a.TrySetValue(kB, kC));
EXPECT_TRUE(a.TrySetValue(kA, kC));
EXPECT_EQ(TestFlag::kC, a.Value());
}
TEST(AtomicValue, SetValue) { TEST(AtomicValue, SetValue) {
AtomicValue<TestFlag> a(kB); AtomicValue<TestFlag> a(kB);
a.SetValue(kC); a.SetValue(kC);
...@@ -48,9 +35,6 @@ TEST(AtomicValue, WithVoidStar) { ...@@ -48,9 +35,6 @@ TEST(AtomicValue, WithVoidStar) {
EXPECT_EQ(nullptr, a.Value()); EXPECT_EQ(nullptr, a.Value());
a.SetValue(&a); a.SetValue(&a);
EXPECT_EQ(&a, a.Value()); EXPECT_EQ(&a, a.Value());
EXPECT_FALSE(a.TrySetValue(nullptr, &dummy));
EXPECT_TRUE(a.TrySetValue(&a, &dummy));
EXPECT_EQ(&dummy, a.Value());
} }
TEST(AsAtomic8, CompareAndSwap_Sequential) { TEST(AsAtomic8, CompareAndSwap_Sequential) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment