Commit b2dad047 authored by Findit's avatar Findit

Revert "heap: Move test utilities into a separate lib"

This reverts commit f4d6b677.

Reason for revert:

Findit (https://goo.gl/kROfz5) identified CL at revision 695951 as the
culprit for failures in the build cycles as shown on:
https://analysis.chromium.org/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyRAsSDVdmU3VzcGVjdGVkQ0wiMWNocm9taXVtL2Y0ZDZiNjc3N2RhMGVhY2JkY2ExNTg2Zjc1ZmM2ZWJkMGIxYzQxZDUM

Sample Failed Build: https://ci.chromium.org/buildbot/chromium/linux-archive-dbg/3691

Sample Failed Step: compile

Original change's description:
> heap: Move test utilities into a separate lib
> 
> This also moves IncrementalMarkingTestDriver to heap_test_utilities.
> 
> Change-Id: I17e0dc40d71925b7ff701c37ce6a6ef502f518fa
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1798671
> Reviewed-by: Kentaro Hara <haraken@chromium.org>
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Commit-Queue: Anton Bikineev <bikineev@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#695951}


Change-Id: I24f16dbde74caf22dd485b4c903cdd1b40edb9e5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1799487
Cr-Commit-Position: refs/heads/master@{#695957}
parent c47b3182
...@@ -1650,7 +1650,6 @@ jumbo_static_library("test_support") { ...@@ -1650,7 +1650,6 @@ jumbo_static_library("test_support") {
"//services/service_manager/public/cpp", "//services/service_manager/public/cpp",
"//skia", "//skia",
"//third_party/blink/renderer/platform/blob:test_support", "//third_party/blink/renderer/platform/blob:test_support",
"//third_party/blink/renderer/platform/heap:test_support",
"//third_party/blink/renderer/platform/loader:test_support", "//third_party/blink/renderer/platform/loader:test_support",
"//third_party/blink/renderer/platform/network:test_support", "//third_party/blink/renderer/platform/network:test_support",
"//third_party/blink/renderer/platform/scheduler:test_support", "//third_party/blink/renderer/platform/scheduler:test_support",
......
...@@ -87,19 +87,6 @@ blink_platform_sources("heap") { ...@@ -87,19 +87,6 @@ blink_platform_sources("heap") {
] ]
} }
jumbo_source_set("test_support") {
testonly = true
sources = [
"heap_test_utilities.cc",
"heap_test_utilities.h",
]
deps = [
"//testing/gtest",
]
}
test("blink_heap_unittests") { test("blink_heap_unittests") {
deps = [ deps = [
":blink_heap_unittests_sources", ":blink_heap_unittests_sources",
...@@ -125,6 +112,8 @@ jumbo_source_set("blink_heap_unittests_sources") { ...@@ -125,6 +112,8 @@ jumbo_source_set("blink_heap_unittests_sources") {
"heap_compact_test.cc", "heap_compact_test.cc",
"heap_stats_collector_test.cc", "heap_stats_collector_test.cc",
"heap_test.cc", "heap_test.cc",
"heap_test_utilities.cc",
"heap_test_utilities.h",
"heap_thread_test.cc", "heap_thread_test.cc",
"heap_traits_test.cc", "heap_traits_test.cc",
"incremental_marking_test.cc", "incremental_marking_test.cc",
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "third_party/blink/renderer/platform/heap/heap_test_utilities.h" #include "third_party/blink/renderer/platform/heap/heap_test_utilities.h"
#include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/heap/heap_compact.h"
namespace blink { namespace blink {
...@@ -43,48 +42,4 @@ void TestSupportingGC::CompleteSweepingIfNeeded() { ...@@ -43,48 +42,4 @@ void TestSupportingGC::CompleteSweepingIfNeeded() {
ThreadState::Current()->CompleteSweep(); ThreadState::Current()->CompleteSweep();
} }
IncrementalMarkingTestDriver::~IncrementalMarkingTestDriver() {
if (thread_state_->IsIncrementalMarking())
FinishGC();
}
void IncrementalMarkingTestDriver::Start() {
thread_state_->IncrementalMarkingStart(
BlinkGC::GCReason::kForcedGCForTesting);
}
bool IncrementalMarkingTestDriver::SingleStep(BlinkGC::StackState stack_state) {
CHECK(thread_state_->IsIncrementalMarking());
if (thread_state_->GetGCState() ==
ThreadState::kIncrementalMarkingStepScheduled) {
thread_state_->IncrementalMarkingStep(stack_state);
return true;
}
return false;
}
void IncrementalMarkingTestDriver::FinishSteps(
BlinkGC::StackState stack_state) {
CHECK(thread_state_->IsIncrementalMarking());
while (SingleStep(stack_state)) {
}
}
void IncrementalMarkingTestDriver::FinishGC(bool complete_sweep) {
CHECK(thread_state_->IsIncrementalMarking());
FinishSteps(BlinkGC::StackState::kNoHeapPointersOnStack);
CHECK_EQ(ThreadState::kIncrementalMarkingFinalizeScheduled,
thread_state_->GetGCState());
thread_state_->RunScheduledGC(BlinkGC::StackState::kNoHeapPointersOnStack);
CHECK(!thread_state_->IsIncrementalMarking());
if (complete_sweep) {
thread_state_->CompleteSweep();
}
}
size_t IncrementalMarkingTestDriver::GetHeapCompactLastFixupCount() const {
HeapCompact* compaction = ThreadState::Current()->Heap().Compaction();
return compaction->LastFixupCountForTesting();
}
} // namespace blink } // namespace blink
...@@ -141,27 +141,6 @@ class LinkedObject : public GarbageCollected<LinkedObject> { ...@@ -141,27 +141,6 @@ class LinkedObject : public GarbageCollected<LinkedObject> {
Member<LinkedObject> next_; Member<LinkedObject> next_;
}; };
// Test driver for incremental marking. Assumes that no stack handling is
// required.
class IncrementalMarkingTestDriver {
public:
explicit IncrementalMarkingTestDriver(ThreadState* thread_state)
: thread_state_(thread_state) {}
~IncrementalMarkingTestDriver();
void Start();
bool SingleStep(BlinkGC::StackState stack_state =
BlinkGC::StackState::kNoHeapPointersOnStack);
void FinishSteps(BlinkGC::StackState stack_state =
BlinkGC::StackState::kNoHeapPointersOnStack);
void FinishGC(bool complete_sweep = true);
size_t GetHeapCompactLastFixupCount() const;
private:
ThreadState* const thread_state_;
};
} // namespace blink } // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_HEAP_TEST_UTILITIES_H_ #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_HEAP_TEST_UTILITIES_H_
...@@ -1482,6 +1482,60 @@ TEST_F(IncrementalMarkingTest, OverrideAfterMixinConstruction) { ...@@ -1482,6 +1482,60 @@ TEST_F(IncrementalMarkingTest, OverrideAfterMixinConstruction) {
// Tests that execute complete incremental garbage collections. ================ // Tests that execute complete incremental garbage collections. ================
// ============================================================================= // =============================================================================
// Test driver for incremental marking. Assumes that no stack handling is
// required.
class IncrementalMarkingTestDriver {
public:
explicit IncrementalMarkingTestDriver(ThreadState* thread_state)
: thread_state_(thread_state) {}
~IncrementalMarkingTestDriver() {
if (thread_state_->IsIncrementalMarking())
FinishGC();
}
void Start() {
thread_state_->IncrementalMarkingStart(
BlinkGC::GCReason::kForcedGCForTesting);
}
bool SingleStep(BlinkGC::StackState stack_state =
BlinkGC::StackState::kNoHeapPointersOnStack) {
CHECK(thread_state_->IsIncrementalMarking());
if (thread_state_->GetGCState() ==
ThreadState::kIncrementalMarkingStepScheduled) {
thread_state_->IncrementalMarkingStep(stack_state);
return true;
}
return false;
}
void FinishSteps(BlinkGC::StackState stack_state =
BlinkGC::StackState::kNoHeapPointersOnStack) {
CHECK(thread_state_->IsIncrementalMarking());
while (SingleStep(stack_state)) {
}
}
void FinishGC(bool complete_sweep = true) {
CHECK(thread_state_->IsIncrementalMarking());
FinishSteps(BlinkGC::StackState::kNoHeapPointersOnStack);
CHECK_EQ(ThreadState::kIncrementalMarkingFinalizeScheduled,
thread_state_->GetGCState());
thread_state_->RunScheduledGC(BlinkGC::StackState::kNoHeapPointersOnStack);
CHECK(!thread_state_->IsIncrementalMarking());
if (complete_sweep)
thread_state_->CompleteSweep();
}
size_t GetHeapCompactLastFixupCount() {
HeapCompact* compaction = ThreadState::Current()->Heap().Compaction();
return compaction->LastFixupCountForTesting();
}
private:
ThreadState* const thread_state_;
};
TEST_F(IncrementalMarkingTest, TestDriver) { TEST_F(IncrementalMarkingTest, TestDriver) {
IncrementalMarkingTestDriver driver(ThreadState::Current()); IncrementalMarkingTestDriver driver(ThreadState::Current());
driver.Start(); driver.Start();
......
...@@ -57,6 +57,7 @@ namespace blink { ...@@ -57,6 +57,7 @@ namespace blink {
namespace incremental_marking_test { namespace incremental_marking_test {
class IncrementalMarkingScope; class IncrementalMarkingScope;
class IncrementalMarkingTestDriver;
} // namespace incremental_marking_test } // namespace incremental_marking_test
class CancelableTaskScheduler; class CancelableTaskScheduler;
...@@ -592,7 +593,7 @@ class PLATFORM_EXPORT ThreadState final { ...@@ -592,7 +593,7 @@ class PLATFORM_EXPORT ThreadState final {
friend class BlinkGCObserver; friend class BlinkGCObserver;
friend class incremental_marking_test::IncrementalMarkingScope; friend class incremental_marking_test::IncrementalMarkingScope;
friend class IncrementalMarkingTestDriver; friend class incremental_marking_test::IncrementalMarkingTestDriver;
friend class HeapAllocator; friend class HeapAllocator;
template <typename T> template <typename T>
friend class PrefinalizerRegistration; friend class PrefinalizerRegistration;
......
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