Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: test/unittests/base/atomic-utils-unittest.cc

Issue 2408233004: [heap] Old-to-new pointer updates need atomic accessors. (Closed)
Patch Set: inline check Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/mark-compact.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/base/atomic-utils-unittest.cc
diff --git a/test/unittests/base/atomic-utils-unittest.cc b/test/unittests/base/atomic-utils-unittest.cc
index 8e90c423e2cd5526352471816078f5e9ac351975..1f964887de1bc4e3d474c58626e15221abe40f1c 100644
--- a/test/unittests/base/atomic-utils-unittest.cc
+++ b/test/unittests/base/atomic-utils-unittest.cc
@@ -125,6 +125,40 @@ TEST(AtomicValue, WithVoidStar) {
EXPECT_EQ(&dummy, a.Value());
}
+TEST(NoBarrierAtomicValue, Initial) {
+ NoBarrierAtomicValue<TestFlag> a(kA);
+ EXPECT_EQ(TestFlag::kA, a.Value());
+}
+
+TEST(NoBarrierAtomicValue, SetValue) {
+ NoBarrierAtomicValue<TestFlag> a(kB);
+ a.SetValue(kC);
+ EXPECT_EQ(TestFlag::kC, a.Value());
+}
+
+TEST(NoBarrierAtomicValue, WithVoidStar) {
+ NoBarrierAtomicValue<void*> a(nullptr);
+ NoBarrierAtomicValue<void*> dummy(nullptr);
+ EXPECT_EQ(nullptr, a.Value());
+ a.SetValue(&a);
+ EXPECT_EQ(&a, a.Value());
+}
+
+TEST(NoBarrierAtomicValue, Construction) {
+ NoBarrierAtomicValue<TestFlag> a(kA);
+ TestFlag b = kA;
+ NoBarrierAtomicValue<TestFlag>* ptr =
+ NoBarrierAtomicValue<TestFlag>::FromAddress(&b);
+ EXPECT_EQ(ptr->Value(), a.Value());
+}
+
+TEST(NoBarrierAtomicValue, ConstructionVoidStar) {
+ NoBarrierAtomicValue<void*> a(nullptr);
+ void* b = nullptr;
+ NoBarrierAtomicValue<void*>* ptr =
+ NoBarrierAtomicValue<void*>::FromAddress(&b);
+ EXPECT_EQ(ptr->Value(), a.Value());
+}
namespace {
« no previous file with comments | « src/heap/mark-compact.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698