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

Side by Side 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, 7 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 unified diff | Download patch
« no previous file with comments | « test/unittests/BUILD.gn ('k') | test/unittests/unittests.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <stdlib.h>
6
7 #include "src/globals.h"
8 #include "src/heap/concurrent-marking-deque.h"
9 #include "src/heap/heap-inl.h"
10 #include "src/isolate.h"
11 #include "test/unittests/test-utils.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 namespace v8 {
15 namespace internal {
16
17 class ConcurrentMarkingDequeTest : public TestWithIsolate {
18 public:
19 ConcurrentMarkingDequeTest() {
20 marking_deque_ = new ConcurrentMarkingDeque(i_isolate()->heap());
21 object_ = i_isolate()->heap()->undefined_value();
22 }
23
24 ~ConcurrentMarkingDequeTest() { delete marking_deque_; }
25
26 ConcurrentMarkingDeque* marking_deque() { return marking_deque_; }
27
28 HeapObject* object() { return object_; }
29
30 private:
31 ConcurrentMarkingDeque* marking_deque_;
32 HeapObject* object_;
33 DISALLOW_COPY_AND_ASSIGN(ConcurrentMarkingDequeTest);
34 };
35
36 TEST_F(ConcurrentMarkingDequeTest, Empty) {
37 EXPECT_TRUE(marking_deque()->IsEmpty());
38 EXPECT_EQ(0, marking_deque()->Size());
39 }
40
41 TEST_F(ConcurrentMarkingDequeTest, SharedDeque) {
42 marking_deque()->Push(object());
43 EXPECT_FALSE(marking_deque()->IsEmpty());
44 EXPECT_EQ(1, marking_deque()->Size());
45 EXPECT_EQ(object(), marking_deque()->Pop(MarkingThread::kConcurrent));
46 }
47
48 TEST_F(ConcurrentMarkingDequeTest, BailoutDeque) {
49 marking_deque()->Push(object(), MarkingThread::kConcurrent,
50 TargetDeque::kBailout);
51 EXPECT_FALSE(marking_deque()->IsEmpty());
52 EXPECT_EQ(1, marking_deque()->Size());
53 EXPECT_EQ(nullptr, marking_deque()->Pop(MarkingThread::kConcurrent));
54 }
55
56 } // namespace internal
57 } // namespace v8
OLDNEW
« 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