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

Unified Diff: test/unittests/heap/concurrent-marking-deque-unittest.cc

Issue 2810893002: [heap] Implement simple concurrent marking deque. (Closed)
Patch Set: Fix comment Created 3 years, 8 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 | « test/unittests/BUILD.gn ('k') | test/unittests/unittests.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/heap/concurrent-marking-deque-unittest.cc
diff --git a/test/unittests/heap/concurrent-marking-deque-unittest.cc b/test/unittests/heap/concurrent-marking-deque-unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..25369217e31c7c63d9bd3a8ec24978409cfdd0d8
--- /dev/null
+++ b/test/unittests/heap/concurrent-marking-deque-unittest.cc
@@ -0,0 +1,57 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stdlib.h>
+
+#include "src/globals.h"
+#include "src/heap/concurrent-marking-deque.h"
+#include "src/heap/heap-inl.h"
+#include "src/isolate.h"
+#include "test/unittests/test-utils.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace v8 {
+namespace internal {
+
+class ConcurrentMarkingDequeTest : public TestWithIsolate {
+ public:
+ ConcurrentMarkingDequeTest() {
+ marking_deque_ = new ConcurrentMarkingDeque(i_isolate()->heap());
+ object_ = i_isolate()->heap()->undefined_value();
+ }
+
+ ~ConcurrentMarkingDequeTest() { delete marking_deque_; }
+
+ ConcurrentMarkingDeque* marking_deque() { return marking_deque_; }
+
+ HeapObject* object() { return object_; }
+
+ private:
+ ConcurrentMarkingDeque* marking_deque_;
+ HeapObject* object_;
+ DISALLOW_COPY_AND_ASSIGN(ConcurrentMarkingDequeTest);
+};
+
+TEST_F(ConcurrentMarkingDequeTest, Empty) {
+ EXPECT_TRUE(marking_deque()->IsEmpty());
+ EXPECT_EQ(0, marking_deque()->Size());
+}
+
+TEST_F(ConcurrentMarkingDequeTest, SharedDeque) {
+ marking_deque()->Push(object());
+ EXPECT_FALSE(marking_deque()->IsEmpty());
+ EXPECT_EQ(1, marking_deque()->Size());
+ EXPECT_EQ(object(), marking_deque()->Pop(MarkingThread::kConcurrent));
+}
+
+TEST_F(ConcurrentMarkingDequeTest, BailoutDeque) {
+ marking_deque()->Push(object(), MarkingThread::kConcurrent,
+ TargetDeque::kBailout);
+ EXPECT_FALSE(marking_deque()->IsEmpty());
+ EXPECT_EQ(1, marking_deque()->Size());
+ EXPECT_EQ(nullptr, marking_deque()->Pop(MarkingThread::kConcurrent));
+}
+
+} // namespace internal
+} // namespace v8
« no previous file with comments | « test/unittests/BUILD.gn ('k') | test/unittests/unittests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698