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: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57404}
This commit is contained in:
Clemens Hammacher 2018-11-08 16:10:03 +01:00 committed by Commit Bot
parent 878776f713
commit f321afeefd
2 changed files with 1 additions and 40 deletions

View File

@ -28,29 +28,6 @@ class AtomicValue {
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) {
base::Release_Store(&value_, cast_helper<T>::to_storage_type(new_value));
}

View File

@ -12,11 +12,7 @@ namespace v8 {
namespace base {
namespace {
enum TestFlag : base::AtomicWord {
kA,
kB,
kC,
};
enum TestFlag : base::AtomicWord { kA, kB, kC };
} // namespace
@ -26,15 +22,6 @@ TEST(AtomicValue, Initial) {
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) {
AtomicValue<TestFlag> a(kB);
a.SetValue(kC);
@ -48,9 +35,6 @@ TEST(AtomicValue, WithVoidStar) {
EXPECT_EQ(nullptr, a.Value());
a.SetValue(&a);
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) {