Bug 57903

Summary: Introduced the concept of opaque roots, in preparation for marking the DOM with them
Product: WebKit Reporter: Geoffrey Garen <ggaren>
Component: New BugsAssignee: Geoffrey Garen <ggaren>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, oliver
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: OS X 10.5   
Attachments:
Description Flags
Patch oliver: review+

Description Geoffrey Garen 2011-04-05 16:22:58 PDT
Introduced the concept of opaque roots, in preparation for marking the DOM with them
Comment 1 Geoffrey Garen 2011-04-05 16:27:57 PDT
Created attachment 88333 [details]
Patch
Comment 2 Oliver Hunt 2011-04-05 16:58:54 PDT
Comment on attachment 88333 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=88333&action=review

> Source/JavaScriptCore/collector/handles/HandleHeap.cpp:110
> +            ASSERT(isValidWeakHandle(node->slot()));
> +            JSCell* cell = node->slot()->asCell();
> +            if (Heap::isMarked(cell))
> +                continue;
> +
> +            WeakHandleOwner* weakOwner = node->weakOwner();
> +            if (!weakOwner)
> +                continue;
> +
> +            if (!weakOwner->isReachableFromOpaqueRoots(Handle<Unknown>::wrapSlot(node->slot()), node->weakOwnerContext(), markStack))
> +                continue;
> +
> +            heapRootMarker.mark(node->slot());

I wish we could do something to separate out handles that will remain alive as we enumerate them, otherwise we end up visiting nodes repeatedly (even if just for an isMarked check)
Comment 3 Geoffrey Garen 2011-04-05 18:25:55 PDT
> I wish we could do something to separate out handles that will remain alive as we enumerate them, otherwise we end up visiting nodes repeatedly (even if just for an isMarked check)

This loop almost always executes exactly once, so the tradeoff probably doesn't favor this approach, but:

I think we could optimize by doing an initial pass to separate off the unmarked handles into a temporary linked list. Thereafter, we could iterate only that linked list.
Comment 4 Build Bot 2011-04-05 18:58:23 PDT
Attachment 88333 [details] did not build on win:
Build output: http://queues.webkit.org/results/8346011
Comment 5 Build Bot 2011-04-05 19:14:13 PDT
Attachment 88333 [details] did not build on win:
Build output: http://queues.webkit.org/results/8343016
Comment 6 Geoffrey Garen 2011-04-05 20:44:54 PDT
Committed r83011: <http://trac.webkit.org/changeset/83011>