Bug 57903 - Introduced the concept of opaque roots, in preparation for marking the DOM with them
Summary: Introduced the concept of opaque roots, in preparation for marking the DOM wi...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Geoffrey Garen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-05 16:22 PDT by Geoffrey Garen
Modified: 2011-04-05 20:44 PDT (History)
2 users (show)

See Also:


Attachments
Patch (11.16 KB, patch)
2011-04-05 16:27 PDT, Geoffrey Garen
oliver: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>