unified-young-gen: Don't miss tracing API objects
Apart from JSApiObject, there are other JS types with other visitor-ids that may contain embedder fields. The CL adds support for embedder fields visitation for such types. Bug: v8:13475 Change-Id: Ifa6f947964d7900245287b35beab19f5b11347ea Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4079015 Commit-Queue: Anton Bikineev <bikineev@chromium.org> Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/main@{#84669}
This commit is contained in:
parent
dbbc07b828
commit
fd9bc064b2
@ -581,24 +581,13 @@ YoungGenerationMarkingVisitorBase<ConcreteVisitor, MarkingState>::
|
||||
worklists_local_(worklists_local) {}
|
||||
|
||||
template <typename ConcreteVisitor, typename MarkingState>
|
||||
int YoungGenerationMarkingVisitorBase<
|
||||
ConcreteVisitor, MarkingState>::VisitJSArrayBuffer(Map map,
|
||||
JSArrayBuffer object) {
|
||||
if (!concrete_visitor()->ShouldVisit(object)) return 0;
|
||||
object.YoungMarkExtension();
|
||||
int size = JSArrayBuffer::BodyDescriptor::SizeOf(map, object);
|
||||
JSArrayBuffer::BodyDescriptor::IterateBody(map, object, size, this);
|
||||
return size;
|
||||
}
|
||||
|
||||
template <typename ConcreteVisitor, typename MarkingState>
|
||||
int YoungGenerationMarkingVisitorBase<
|
||||
ConcreteVisitor, MarkingState>::VisitJSApiObject(Map map, JSObject object) {
|
||||
if (!worklists_local_->SupportsExtractWrapper())
|
||||
return this->VisitJSObject(map, object);
|
||||
if (!concrete_visitor()->ShouldVisit(object)) return 0;
|
||||
template <typename T>
|
||||
int YoungGenerationMarkingVisitorBase<ConcreteVisitor, MarkingState>::
|
||||
VisitEmbedderTracingSubClassWithEmbedderTracing(Map map, T object) {
|
||||
const bool requires_snapshot = worklists_local_->SupportsExtractWrapper();
|
||||
MarkingWorklists::Local::WrapperSnapshot wrapper_snapshot;
|
||||
const bool valid_snapshot =
|
||||
requires_snapshot &&
|
||||
worklists_local_->ExtractWrapper(map, object, wrapper_snapshot);
|
||||
const int size = concrete_visitor()->VisitJSObjectSubclass(map, object);
|
||||
if (size && valid_snapshot) {
|
||||
@ -608,6 +597,34 @@ int YoungGenerationMarkingVisitorBase<
|
||||
return size;
|
||||
}
|
||||
|
||||
template <typename ConcreteVisitor, typename MarkingState>
|
||||
int YoungGenerationMarkingVisitorBase<
|
||||
ConcreteVisitor, MarkingState>::VisitJSArrayBuffer(Map map,
|
||||
JSArrayBuffer object) {
|
||||
object.YoungMarkExtension();
|
||||
return VisitEmbedderTracingSubClassWithEmbedderTracing(map, object);
|
||||
}
|
||||
|
||||
template <typename ConcreteVisitor, typename MarkingState>
|
||||
int YoungGenerationMarkingVisitorBase<
|
||||
ConcreteVisitor, MarkingState>::VisitJSApiObject(Map map, JSObject object) {
|
||||
return VisitEmbedderTracingSubClassWithEmbedderTracing(map, object);
|
||||
}
|
||||
|
||||
template <typename ConcreteVisitor, typename MarkingState>
|
||||
int YoungGenerationMarkingVisitorBase<
|
||||
ConcreteVisitor, MarkingState>::VisitJSDataView(Map map,
|
||||
JSDataView object) {
|
||||
return VisitEmbedderTracingSubClassWithEmbedderTracing(map, object);
|
||||
}
|
||||
|
||||
template <typename ConcreteVisitor, typename MarkingState>
|
||||
int YoungGenerationMarkingVisitorBase<
|
||||
ConcreteVisitor, MarkingState>::VisitJSTypedArray(Map map,
|
||||
JSTypedArray object) {
|
||||
return VisitEmbedderTracingSubClassWithEmbedderTracing(map, object);
|
||||
}
|
||||
|
||||
template <typename ConcreteVisitor, typename MarkingState>
|
||||
void YoungGenerationMarkingVisitorBase<ConcreteVisitor, MarkingState>::
|
||||
MarkObjectViaMarkingWorklist(HeapObject object) {
|
||||
|
@ -242,15 +242,19 @@ class YoungGenerationMarkingVisitorBase
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
V8_INLINE int VisitJSArrayBuffer(Map map, JSArrayBuffer object);
|
||||
|
||||
V8_INLINE int VisitJSApiObject(Map map, JSObject object);
|
||||
V8_INLINE int VisitJSArrayBuffer(Map map, JSArrayBuffer object);
|
||||
V8_INLINE int VisitJSDataView(Map map, JSDataView object);
|
||||
V8_INLINE int VisitJSTypedArray(Map map, JSTypedArray object);
|
||||
|
||||
protected:
|
||||
ConcreteVisitor* concrete_visitor() {
|
||||
return static_cast<ConcreteVisitor*>(this);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
int VisitEmbedderTracingSubClassWithEmbedderTracing(Map map, T object);
|
||||
|
||||
inline void MarkObjectViaMarkingWorklist(HeapObject object);
|
||||
|
||||
private:
|
||||
|
@ -236,7 +236,7 @@ int NewSpaceVisitor<ConcreteVisitor>::VisitWeakCell(Map map,
|
||||
template <typename ConcreteVisitor>
|
||||
template <typename T, typename TBodyDescriptor>
|
||||
int NewSpaceVisitor<ConcreteVisitor>::VisitJSObjectSubclass(Map map, T object) {
|
||||
if (!this->ShouldVisit(object)) return 0;
|
||||
if (!static_cast<ConcreteVisitor*>(this)->ShouldVisit(object)) return 0;
|
||||
this->VisitMapPointer(object);
|
||||
int size = TBodyDescriptor::SizeOf(map, object);
|
||||
TBodyDescriptor::IterateBody(map, object, size, this);
|
||||
|
Loading…
Reference in New Issue
Block a user