Commit 0b48da8b authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

cppgc: Add HoH::Trace utility method

Bug: chromium:1056170
Change-Id: I65a2b38c85a93ac2822cb7d2b7ac4bd66540348a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2468996
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarOmer Katz <omerkatz@chromium.org>
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70498}
parent 2e7a9b04
......@@ -23,6 +23,9 @@ class V8_EXPORT_PRIVATE CppHeap final : public cppgc::internal::HeapBase,
const std::vector<std::unique_ptr<cppgc::CustomSpaceBase>>&
custom_spaces);
CppHeap(const CppHeap&) = delete;
CppHeap& operator=(const CppHeap&) = delete;
HeapBase& AsBase() { return *this; }
const HeapBase& AsBase() const { return *this; }
......
......@@ -32,5 +32,10 @@ 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
......@@ -20,6 +20,9 @@
#include "src/heap/cppgc/globals.h"
namespace cppgc {
class Visitor;
namespace internal {
// HeapObjectHeader contains meta data per object and is prepended to each
......@@ -96,6 +99,8 @@ class HeapObjectHeader {
V8_EXPORT_PRIVATE HeapObjectName GetName() const;
V8_EXPORT_PRIVATE void Trace(Visitor*) const;
private:
enum class EncodedHalf : uint8_t { kLow, kHigh };
......
......@@ -70,8 +70,7 @@ bool MarkingVerifier::VisitHeapObjectHeader(HeapObjectHeader* header) {
parent_ = header;
if (!header->IsInConstruction()) {
GlobalGCInfoTable::GCInfoFromIndex(header->GetGCInfoIndex())
.trace(this, header->Payload());
header->Trace(this);
} else {
// Dispatches to conservative tracing implementation.
TraceConservativelyIfNeeded(*header);
......
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