Commit 68b788ca authored by Maya Lekova's avatar Maya Lekova Committed by Commit Bot

Revert "Reland "cppgc, heap: Don't eagerly allocate worklist segments""

This reverts commit f25cb50a.

Reason for revert: Fails compilation on gcc https://ci.chromium.org/p/v8/builders/ci/V8%20Linux64%20gcc%20-%20debug/9026?

Original change's description:
> Reland "cppgc, heap: Don't eagerly allocate worklist segments"
> 
> This is a reland of c99147c6
> 
> Original change's description:
> > cppgc, heap: Don't eagerly allocate worklist segments
> >
> > Bug: chromium:1056170
> > Change-Id: I75a6b5f52bfe8dd71abc086e5d1e060759ad7fc0
> > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2391254
> > Commit-Queue: Omer Katz <omerkatz@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#69778}
> 
> Bug: chromium:1056170
> Change-Id: I4633da065976a6b2710d2f23b946fd2af0e65c83
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2401425
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> Commit-Queue: Omer Katz <omerkatz@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#69806}

TBR=ulan@chromium.org,mlippautz@chromium.org,omerkatz@chromium.org

Change-Id: I004173e2a82518a88e68eae3a6f7e96656c0ad7e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1056170
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2403249Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69809}
parent 608018e5
...@@ -4256,7 +4256,6 @@ v8_source_set("v8_cppgc_shared") { ...@@ -4256,7 +4256,6 @@ v8_source_set("v8_cppgc_shared") {
sources = [ sources = [
"src/heap/base/stack.cc", "src/heap/base/stack.cc",
"src/heap/base/stack.h", "src/heap/base/stack.h",
"src/heap/base/worklist.cc",
"src/heap/base/worklist.h", "src/heap/base/worklist.h",
] ]
......
// Copyright 2020 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 "src/heap/base/worklist.h"
namespace heap {
namespace base {
namespace internal {
SegmentBase SegmentBase::kSentinelSegment(0);
} // namespace internal
} // namespace base
} // namespace heap
This diff is collapsed.
...@@ -69,7 +69,6 @@ v8_executable("cppgc_unittests") { ...@@ -69,7 +69,6 @@ v8_executable("cppgc_unittests") {
deps = [ deps = [
":cppgc_unittests_sources", ":cppgc_unittests_sources",
":v8_cppgc_shared_unittests_sources",
"../..:cppgc_for_testing", "../..:cppgc_for_testing",
"//testing/gmock", "//testing/gmock",
"//testing/gtest", "//testing/gtest",
...@@ -137,7 +136,6 @@ v8_executable("unittests") { ...@@ -137,7 +136,6 @@ v8_executable("unittests") {
deps = [ deps = [
":cppgc_unittests_sources", ":cppgc_unittests_sources",
":unittests_sources", ":unittests_sources",
":v8_cppgc_shared_unittests_sources",
"../..:v8_for_testing", "../..:v8_for_testing",
"../..:v8_libbase", "../..:v8_libbase",
"../..:v8_libplatform", "../..:v8_libplatform",
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "src/heap/base/worklist.h" #include "src/heap/base/worklist.h"
#include "testing/gtest/include/gtest/gtest.h" #include "test/unittests/heap/cppgc/tests.h"
namespace heap { namespace heap {
namespace base { namespace base {
...@@ -23,17 +23,17 @@ TEST(CppgcWorkListTest, SegmentCreate) { ...@@ -23,17 +23,17 @@ TEST(CppgcWorkListTest, SegmentCreate) {
TEST(CppgcWorkListTest, SegmentPush) { TEST(CppgcWorkListTest, SegmentPush) {
TestWorklist::Segment segment; TestWorklist::Segment segment;
EXPECT_EQ(0u, segment.Size()); EXPECT_EQ(0u, segment.Size());
segment.Push(nullptr); EXPECT_TRUE(segment.Push(nullptr));
EXPECT_EQ(1u, segment.Size()); EXPECT_EQ(1u, segment.Size());
} }
TEST(CppgcWorkListTest, SegmentPushPop) { TEST(CppgcWorkListTest, SegmentPushPop) {
TestWorklist::Segment segment; TestWorklist::Segment segment;
segment.Push(nullptr); EXPECT_TRUE(segment.Push(nullptr));
EXPECT_EQ(1u, segment.Size()); EXPECT_EQ(1u, segment.Size());
SomeObject dummy; SomeObject dummy;
SomeObject* object = &dummy; SomeObject* object = &dummy;
segment.Pop(&object); EXPECT_TRUE(segment.Pop(&object));
EXPECT_EQ(0u, segment.Size()); EXPECT_EQ(0u, segment.Size());
EXPECT_EQ(nullptr, object); EXPECT_EQ(nullptr, object);
} }
...@@ -41,7 +41,7 @@ TEST(CppgcWorkListTest, SegmentPushPop) { ...@@ -41,7 +41,7 @@ TEST(CppgcWorkListTest, SegmentPushPop) {
TEST(CppgcWorkListTest, SegmentIsEmpty) { TEST(CppgcWorkListTest, SegmentIsEmpty) {
TestWorklist::Segment segment; TestWorklist::Segment segment;
EXPECT_TRUE(segment.IsEmpty()); EXPECT_TRUE(segment.IsEmpty());
segment.Push(nullptr); EXPECT_TRUE(segment.Push(nullptr));
EXPECT_FALSE(segment.IsEmpty()); EXPECT_FALSE(segment.IsEmpty());
} }
...@@ -49,27 +49,44 @@ TEST(CppgcWorkListTest, SegmentIsFull) { ...@@ -49,27 +49,44 @@ TEST(CppgcWorkListTest, SegmentIsFull) {
TestWorklist::Segment segment; TestWorklist::Segment segment;
EXPECT_FALSE(segment.IsFull()); EXPECT_FALSE(segment.IsFull());
for (size_t i = 0; i < TestWorklist::Segment::kSize; i++) { for (size_t i = 0; i < TestWorklist::Segment::kSize; i++) {
segment.Push(nullptr); EXPECT_TRUE(segment.Push(nullptr));
} }
EXPECT_TRUE(segment.IsFull()); EXPECT_TRUE(segment.IsFull());
} }
TEST(CppgcWorkListTest, SegmentClear) { TEST(CppgcWorkListTest, SegmentClear) {
TestWorklist::Segment segment; TestWorklist::Segment segment;
segment.Push(nullptr); EXPECT_TRUE(segment.Push(nullptr));
EXPECT_FALSE(segment.IsEmpty()); EXPECT_FALSE(segment.IsEmpty());
segment.Clear(); segment.Clear();
EXPECT_TRUE(segment.IsEmpty()); EXPECT_TRUE(segment.IsEmpty());
for (size_t i = 0; i < TestWorklist::Segment::kSize; i++) { for (size_t i = 0; i < TestWorklist::Segment::kSize; i++) {
segment.Push(nullptr); EXPECT_TRUE(segment.Push(nullptr));
} }
} }
TEST(CppgcWorkListTest, SegmentFullPushFails) {
TestWorklist::Segment segment;
EXPECT_FALSE(segment.IsFull());
for (size_t i = 0; i < TestWorklist::Segment::kSize; i++) {
EXPECT_TRUE(segment.Push(nullptr));
}
EXPECT_TRUE(segment.IsFull());
EXPECT_FALSE(segment.Push(nullptr));
}
TEST(CppgcWorkListTest, SegmentEmptyPopFails) {
TestWorklist::Segment segment;
EXPECT_TRUE(segment.IsEmpty());
SomeObject* object;
EXPECT_FALSE(segment.Pop(&object));
}
TEST(CppgcWorkListTest, SegmentUpdateFalse) { TEST(CppgcWorkListTest, SegmentUpdateFalse) {
TestWorklist::Segment segment; TestWorklist::Segment segment;
SomeObject* object; SomeObject* object;
object = reinterpret_cast<SomeObject*>(&object); object = reinterpret_cast<SomeObject*>(&object);
segment.Push(object); EXPECT_TRUE(segment.Push(object));
segment.Update([](SomeObject* object, SomeObject** out) { return false; }); segment.Update([](SomeObject* object, SomeObject** out) { return false; });
EXPECT_TRUE(segment.IsEmpty()); EXPECT_TRUE(segment.IsEmpty());
} }
...@@ -80,13 +97,13 @@ TEST(CppgcWorkListTest, SegmentUpdate) { ...@@ -80,13 +97,13 @@ TEST(CppgcWorkListTest, SegmentUpdate) {
objectA = reinterpret_cast<SomeObject*>(&objectA); objectA = reinterpret_cast<SomeObject*>(&objectA);
SomeObject* objectB; SomeObject* objectB;
objectB = reinterpret_cast<SomeObject*>(&objectB); objectB = reinterpret_cast<SomeObject*>(&objectB);
segment.Push(objectA); EXPECT_TRUE(segment.Push(objectA));
segment.Update([objectB](SomeObject* object, SomeObject** out) { segment.Update([objectB](SomeObject* object, SomeObject** out) {
*out = objectB; *out = objectB;
return true; return true;
}); });
SomeObject* object; SomeObject* object;
segment.Pop(&object); EXPECT_TRUE(segment.Pop(&object));
EXPECT_EQ(object, objectB); EXPECT_EQ(object, objectB);
} }
...@@ -307,26 +324,5 @@ TEST(CppgcWorkListTest, MergeGlobalPool) { ...@@ -307,26 +324,5 @@ TEST(CppgcWorkListTest, MergeGlobalPool) {
EXPECT_TRUE(worklist2.IsEmpty()); EXPECT_TRUE(worklist2.IsEmpty());
} }
#ifdef DEBUG
TEST(CppgcWorkListDeathTest, DiesOnPushToFullSegment) {
TestWorklist::Segment segment;
EXPECT_FALSE(segment.IsFull());
for (size_t i = 0; i < TestWorklist::Segment::kSize; i++) {
segment.Push(nullptr);
}
EXPECT_TRUE(segment.IsFull());
EXPECT_DEATH_IF_SUPPORTED(segment.Push(nullptr), "");
}
TEST(CppgcWorkListDeathTest, DiesOnPopFromEmptySegment) {
TestWorklist::Segment segment;
EXPECT_TRUE(segment.IsEmpty());
SomeObject* object;
EXPECT_DEATH_IF_SUPPORTED(segment.Pop(&object), "");
}
#endif // DEBUG
} // namespace base } // namespace base
} // namespace heap } // namespace heap
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