Commit 05b241c6 authored by Michael Lippautz's avatar Michael Lippautz Committed by V8 LUCI CQ

heap: Remove unused Worklist

- Removes the unused Worklist implementation. All uses now refer to
  ::heap::base::Worklist.
- Renames CppgcWorklistTest -> WorklistTest
- Add test for Swap()

Bug: v8:12426
Change-Id: I62c3472c030b853a846cf13ab48597ea1af8f700
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3306507Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78208}
parent c1e0aa1e
......@@ -1429,7 +1429,6 @@ filegroup(
"src/heap/sweeper.h",
"src/heap/weak-object-worklists.cc",
"src/heap/weak-object-worklists.h",
"src/heap/worklist.h",
"src/ic/call-optimization.cc",
"src/ic/call-optimization.h",
"src/ic/handler-configuration-inl.h",
......
......@@ -3011,7 +3011,6 @@ v8_header_set("v8_internal_headers") {
"src/heap/stress-scavenge-observer.h",
"src/heap/sweeper.h",
"src/heap/weak-object-worklists.h",
"src/heap/worklist.h",
"src/ic/call-optimization.h",
"src/ic/handler-configuration-inl.h",
"src/ic/handler-configuration.h",
......
......@@ -228,14 +228,14 @@ class Worklist<EntryType, SegmentSize>::Segment : public internal::SegmentBase {
friend class Worklist<EntryType, SegmentSize>::Local;
FRIEND_TEST(CppgcWorkListTest, SegmentCreate);
FRIEND_TEST(CppgcWorkListTest, SegmentPush);
FRIEND_TEST(CppgcWorkListTest, SegmentPushPop);
FRIEND_TEST(CppgcWorkListTest, SegmentIsEmpty);
FRIEND_TEST(CppgcWorkListTest, SegmentIsFull);
FRIEND_TEST(CppgcWorkListTest, SegmentClear);
FRIEND_TEST(CppgcWorkListTest, SegmentUpdateFalse);
FRIEND_TEST(CppgcWorkListTest, SegmentUpdate);
FRIEND_TEST(WorkListTest, SegmentCreate);
FRIEND_TEST(WorkListTest, SegmentPush);
FRIEND_TEST(WorkListTest, SegmentPushPop);
FRIEND_TEST(WorkListTest, SegmentIsEmpty);
FRIEND_TEST(WorkListTest, SegmentIsFull);
FRIEND_TEST(WorkListTest, SegmentClear);
FRIEND_TEST(WorkListTest, SegmentUpdateFalse);
FRIEND_TEST(WorkListTest, SegmentUpdate);
};
template <typename EntryType, uint16_t SegmentSize>
......
......@@ -24,7 +24,6 @@
#include "src/heap/objects-visiting-inl.h"
#include "src/heap/objects-visiting.h"
#include "src/heap/weak-object-worklists.h"
#include "src/heap/worklist.h"
#include "src/init/v8.h"
#include "src/objects/data-handler-inl.h"
#include "src/objects/embedder-data-array-inl.h"
......
......@@ -16,7 +16,6 @@
#include "src/heap/memory-measurement.h"
#include "src/heap/slot-set.h"
#include "src/heap/spaces.h"
#include "src/heap/worklist.h"
#include "src/init/v8.h"
#include "src/tasks/cancelable-task.h"
#include "src/utils/allocation.h"
......
......@@ -41,7 +41,6 @@
#include "src/heap/spaces-inl.h"
#include "src/heap/sweeper.h"
#include "src/heap/weak-object-worklists.h"
#include "src/heap/worklist.h"
#include "src/ic/stub-cache.h"
#include "src/init/v8.h"
#include "src/logging/tracing-flags.h"
......
......@@ -12,7 +12,6 @@
#include "src/heap/objects-visiting.h"
#include "src/heap/spaces.h"
#include "src/heap/weak-object-worklists.h"
#include "src/heap/worklist.h"
namespace v8 {
namespace internal {
......
......@@ -12,11 +12,11 @@
#include "src/base/atomic-utils.h"
#include "src/base/bit-field.h"
#include "src/base/bits.h"
#include "src/heap/worklist.h"
#include "src/objects/compressed-slots.h"
#include "src/objects/slots.h"
#include "src/utils/allocation.h"
#include "src/utils/utils.h"
#include "testing/gtest/include/gtest/gtest_prod.h" // nogncheck
namespace v8 {
namespace internal {
......
......@@ -6,7 +6,6 @@
#include "src/heap/heap-inl.h"
#include "src/heap/heap.h"
#include "src/heap/worklist.h"
#include "src/objects/hash-table.h"
#include "src/objects/heap-object.h"
#include "src/objects/js-function.h"
......
This diff is collapsed.
......@@ -10,7 +10,6 @@
#include "src/heap/mark-compact.h"
#include "src/heap/marking-worklist-inl.h"
#include "src/heap/marking-worklist.h"
#include "src/heap/worklist.h"
#include "src/init/v8.h"
#include "test/cctest/cctest.h"
#include "test/cctest/heap/heap-utils.h"
......
......@@ -339,7 +339,6 @@ v8_source_set("unittests_sources") {
"heap/slot-set-unittest.cc",
"heap/spaces-unittest.cc",
"heap/unmapper-unittest.cc",
"heap/worklist-unittest.cc",
"interpreter/bytecode-array-builder-unittest.cc",
"interpreter/bytecode-array-iterator-unittest.cc",
"interpreter/bytecode-array-random-iterator-unittest.cc",
......
......@@ -13,21 +13,21 @@ class SomeObject {};
using TestWorklist = Worklist<SomeObject*, 64>;
TEST(CppgcWorkListTest, SegmentCreate) {
TEST(WorkListTest, SegmentCreate) {
TestWorklist::Segment segment;
EXPECT_TRUE(segment.IsEmpty());
EXPECT_EQ(0u, segment.Size());
EXPECT_FALSE(segment.IsFull());
}
TEST(CppgcWorkListTest, SegmentPush) {
TEST(WorkListTest, SegmentPush) {
TestWorklist::Segment segment;
EXPECT_EQ(0u, segment.Size());
segment.Push(nullptr);
EXPECT_EQ(1u, segment.Size());
}
TEST(CppgcWorkListTest, SegmentPushPop) {
TEST(WorkListTest, SegmentPushPop) {
TestWorklist::Segment segment;
segment.Push(nullptr);
EXPECT_EQ(1u, segment.Size());
......@@ -38,14 +38,14 @@ TEST(CppgcWorkListTest, SegmentPushPop) {
EXPECT_EQ(nullptr, object);
}
TEST(CppgcWorkListTest, SegmentIsEmpty) {
TEST(WorkListTest, SegmentIsEmpty) {
TestWorklist::Segment segment;
EXPECT_TRUE(segment.IsEmpty());
segment.Push(nullptr);
EXPECT_FALSE(segment.IsEmpty());
}
TEST(CppgcWorkListTest, SegmentIsFull) {
TEST(WorkListTest, SegmentIsFull) {
TestWorklist::Segment segment;
EXPECT_FALSE(segment.IsFull());
for (size_t i = 0; i < TestWorklist::Segment::kSize; i++) {
......@@ -54,7 +54,7 @@ TEST(CppgcWorkListTest, SegmentIsFull) {
EXPECT_TRUE(segment.IsFull());
}
TEST(CppgcWorkListTest, SegmentClear) {
TEST(WorkListTest, SegmentClear) {
TestWorklist::Segment segment;
segment.Push(nullptr);
EXPECT_FALSE(segment.IsEmpty());
......@@ -65,7 +65,7 @@ TEST(CppgcWorkListTest, SegmentClear) {
}
}
TEST(CppgcWorkListTest, SegmentUpdateFalse) {
TEST(WorkListTest, SegmentUpdateFalse) {
TestWorklist::Segment segment;
SomeObject* object;
object = reinterpret_cast<SomeObject*>(&object);
......@@ -74,7 +74,7 @@ TEST(CppgcWorkListTest, SegmentUpdateFalse) {
EXPECT_TRUE(segment.IsEmpty());
}
TEST(CppgcWorkListTest, SegmentUpdate) {
TEST(WorkListTest, SegmentUpdate) {
TestWorklist::Segment segment;
SomeObject* objectA;
objectA = reinterpret_cast<SomeObject*>(&objectA);
......@@ -90,14 +90,14 @@ TEST(CppgcWorkListTest, SegmentUpdate) {
EXPECT_EQ(object, objectB);
}
TEST(CppgcWorkListTest, CreateEmpty) {
TEST(WorkListTest, CreateEmpty) {
TestWorklist worklist;
TestWorklist::Local worklist_local(&worklist);
EXPECT_TRUE(worklist_local.IsLocalEmpty());
EXPECT_TRUE(worklist.IsEmpty());
}
TEST(CppgcWorkListTest, LocalPushPop) {
TEST(WorkListTest, LocalPushPop) {
TestWorklist worklist;
TestWorklist::Local worklist_local(&worklist);
SomeObject dummy;
......@@ -108,7 +108,7 @@ TEST(CppgcWorkListTest, LocalPushPop) {
EXPECT_EQ(&dummy, retrieved);
}
TEST(CppgcWorkListTest, LocalPushStaysPrivate) {
TEST(WorkListTest, LocalPushStaysPrivate) {
TestWorklist worklist;
TestWorklist::Local worklist_local1(&worklist);
TestWorklist::Local worklist_local2(&worklist);
......@@ -125,7 +125,7 @@ TEST(CppgcWorkListTest, LocalPushStaysPrivate) {
EXPECT_EQ(0U, worklist.Size());
}
TEST(CppgcWorkListTest, LocalClear) {
TEST(WorkListTest, LocalClear) {
TestWorklist worklist;
TestWorklist::Local worklist_local(&worklist);
SomeObject* object;
......@@ -149,7 +149,7 @@ TEST(CppgcWorkListTest, LocalClear) {
EXPECT_TRUE(worklist_local.IsEmpty());
}
TEST(CppgcWorkListTest, GlobalUpdateNull) {
TEST(WorkListTest, GlobalUpdateNull) {
TestWorklist worklist;
TestWorklist::Local worklist_local(&worklist);
SomeObject* object;
......@@ -164,7 +164,7 @@ TEST(CppgcWorkListTest, GlobalUpdateNull) {
EXPECT_EQ(0U, worklist.Size());
}
TEST(CppgcWorkListTest, GlobalUpdate) {
TEST(WorkListTest, GlobalUpdate) {
TestWorklist worklist;
TestWorklist::Local worklist_local(&worklist);
SomeObject* objectA = nullptr;
......@@ -195,7 +195,7 @@ TEST(CppgcWorkListTest, GlobalUpdate) {
}
}
TEST(CppgcWorkListTest, FlushToGlobalPushSegment) {
TEST(WorkListTest, FlushToGlobalPushSegment) {
TestWorklist worklist;
TestWorklist::Local worklist_local0(&worklist);
TestWorklist::Local worklist_local1(&worklist);
......@@ -208,7 +208,7 @@ TEST(CppgcWorkListTest, FlushToGlobalPushSegment) {
EXPECT_TRUE(worklist_local1.Pop(&object));
}
TEST(CppgcWorkListTest, FlushToGlobalPopSegment) {
TEST(WorkListTest, FlushToGlobalPopSegment) {
TestWorklist worklist;
TestWorklist::Local worklist_local0(&worklist);
TestWorklist::Local worklist_local1(&worklist);
......@@ -223,7 +223,7 @@ TEST(CppgcWorkListTest, FlushToGlobalPopSegment) {
EXPECT_TRUE(worklist_local1.Pop(&object));
}
TEST(CppgcWorkListTest, Clear) {
TEST(WorkListTest, Clear) {
TestWorklist worklist;
TestWorklist::Local worklist_local(&worklist);
SomeObject* object;
......@@ -236,7 +236,7 @@ TEST(CppgcWorkListTest, Clear) {
EXPECT_EQ(0U, worklist.Size());
}
TEST(CppgcWorkListTest, SingleSegmentSteal) {
TEST(WorkListTest, SingleSegmentSteal) {
TestWorklist worklist;
TestWorklist::Local worklist_local1(&worklist);
TestWorklist::Local worklist_local2(&worklist);
......@@ -260,7 +260,7 @@ TEST(CppgcWorkListTest, SingleSegmentSteal) {
EXPECT_EQ(0U, worklist.Size());
}
TEST(CppgcWorkListTest, MultipleSegmentsStolen) {
TEST(WorkListTest, MultipleSegmentsStolen) {
TestWorklist worklist;
TestWorklist::Local worklist_local1(&worklist);
TestWorklist::Local worklist_local2(&worklist);
......@@ -302,7 +302,7 @@ TEST(CppgcWorkListTest, MultipleSegmentsStolen) {
EXPECT_TRUE(worklist.IsEmpty());
}
TEST(CppgcWorkListTest, MergeGlobalPool) {
TEST(WorkListTest, MergeGlobalPool) {
TestWorklist worklist1;
TestWorklist::Local worklist_local1(&worklist1);
SomeObject dummy;
......@@ -331,5 +331,25 @@ TEST(CppgcWorkListTest, MergeGlobalPool) {
EXPECT_TRUE(worklist2.IsEmpty());
}
TEST(WorkListTest, SwapGlobalPool) {
TestWorklist worklist1;
TestWorklist::Local worklist_local1(&worklist1);
SomeObject dummy;
worklist_local1.Push(&dummy);
worklist_local1.Publish();
TestWorklist worklist2;
EXPECT_FALSE(worklist1.IsEmpty());
EXPECT_TRUE(worklist2.IsEmpty());
worklist1.Swap(&worklist2);
EXPECT_TRUE(worklist1.IsEmpty());
EXPECT_FALSE(worklist2.IsEmpty());
TestWorklist::Local worklist_local2(&worklist2);
SomeObject* retrieved = nullptr;
EXPECT_TRUE(worklist_local2.Pop(&retrieved));
EXPECT_EQ(&dummy, retrieved);
EXPECT_FALSE(worklist_local2.Pop(&retrieved));
EXPECT_TRUE(worklist2.IsEmpty());
}
} // namespace base
} // namespace heap
This diff is collapsed.
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