Commit 8c857fda authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

cppgc: Cleanups

Cleanups around tracing bottlenecks and tests.

Bug: chromium:1056170
Change-Id: I1f9ddd6d8727971db3bed5294f4ff3fdd20a9e34
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2757696
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: 's avatarOmer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73394}
parent 84e0835c
......@@ -32,10 +32,5 @@ HeapObjectName HeapObjectHeader::GetName() const {
return gc_info.name(Payload());
}
void HeapObjectHeader::Trace(Visitor* visitor) const {
const GCInfo& gc_info = GlobalGCInfoTable::GCInfoFromIndex(GetGCInfoIndex());
return gc_info.trace(visitor, Payload());
}
} // namespace internal
} // namespace cppgc
......@@ -102,7 +102,8 @@ class HeapObjectHeader {
V8_EXPORT_PRIVATE HeapObjectName GetName() const;
V8_EXPORT_PRIVATE void Trace(Visitor*) const;
template <AccessMode = AccessMode::kNonAtomic>
void Trace(Visitor*) const;
private:
enum class EncodedHalf : uint8_t { kLow, kHigh };
......@@ -276,6 +277,13 @@ bool HeapObjectHeader::IsFinalizable() const {
return gc_info.finalize;
}
template <AccessMode mode>
void HeapObjectHeader::Trace(Visitor* visitor) const {
const GCInfo& gc_info =
GlobalGCInfoTable::GCInfoFromIndex(GetGCInfoIndex<mode>());
return gc_info.trace(visitor, Payload());
}
template <AccessMode mode, HeapObjectHeader::EncodedHalf part,
std::memory_order memory_order>
uint16_t HeapObjectHeader::LoadEncoded() const {
......
......@@ -451,9 +451,7 @@ void DynamicallyTraceMarkedObject(Visitor& visitor,
const HeapObjectHeader& header) {
DCHECK(!header.IsInConstruction<mode>());
DCHECK(header.IsMarked<mode>());
const GCInfo& gcinfo =
GlobalGCInfoTable::GCInfoFromIndex(header.GetGCInfoIndex<mode>());
gcinfo.trace(&visitor, header.Payload());
header.Trace<mode>(&visitor);
}
} // namespace internal
......
......@@ -95,7 +95,7 @@ class VerificationVisitor final : public cppgc::Visitor {
void VisitWeakContainer(const void* object, TraceDescriptor,
TraceDescriptor weak_desc, WeakCallback,
const void*) {
const void*) final {
if (!object) return;
// Contents of weak containers are found themselves through page iteration
......
......@@ -46,11 +46,6 @@ class ConcurrentMarkingTest : public testing::TestWithHeap {
return marker->IncrementalMarkingStepForTesting(stack_state);
}
void FinishSteps(Config::StackState stack_state) {
while (!SingleStep(stack_state)) {
}
}
void FinishGC() {
Heap* heap = Heap::From(GetHeap());
heap->marker()->SetMainThreadMarkingDisabledForTesting(false);
......@@ -114,7 +109,7 @@ TEST_F(ConcurrentMarkingTest, MarkingObjects) {
*last_object = MakeGarbageCollected<GCed>(GetAllocationHandle());
last_object = &(*last_object)->child_;
}
// Use SignleStep to re-post concurrent jobs.
// Use SingleStep to re-post concurrent jobs.
SingleStep(Config::StackState::kNoHeapPointers);
}
FinishGC();
......@@ -133,7 +128,7 @@ TEST_F(ConcurrentMarkingTest, MarkingInConstructionObjects) {
last_object = &(*last_object)->child_;
});
}
// Use SignleStep to re-post concurrent jobs.
// Use SingleStep to re-post concurrent jobs.
SingleStep(Config::StackState::kNoHeapPointers);
}
FinishGC();
......@@ -149,7 +144,7 @@ TEST_F(ConcurrentMarkingTest, MarkingMixinObjects) {
*last_object = MakeGarbageCollected<GCedWithMixin>(GetAllocationHandle());
last_object = &(*last_object)->child_;
}
// Use SignleStep to re-post concurrent jobs.
// Use SingleStep to re-post concurrent jobs.
SingleStep(Config::StackState::kNoHeapPointers);
}
FinishGC();
......
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