On 07/12/2013 04:12 PM, Patrick Walton wrote:
On 7/12/13 12:43 PM, Josh Matthews wrote:
Yes, this is the bed we have made for ourselves in Servo at this point.
Can we just have the JS trace hook for a DOM node recursively search
through children for wrappers, even those that don't have wrappers?
To illustrate, suppose we have this DOM:
O -- 1
/ \
X X
/ \ \
X X 2
|
3
|
4
O is the DOM node that has a wrapper which the JS garbage collector has
invoked the trace hook on. 1, 2, 3, and 4 are DOM nodes with wrappers.
Xs are DOM nodes without wrappers, because the wrappers have not been
created yet. When the trace hook is called on O, it searches recursively
through children and siblings and marks them, so it will mark 1, 2, and
3 as live. It stops once it finds a child node with a wrapper. Because 3
was marked, the JS engine then invokes the trace hook on it. In turn, it
marks 4 as live.
(I would prefer not to go the CC-and-GC route if we can avoid it,
although if we have to we can do that too, with good support from Rust.
Note that Chromium is adopting a full-GC model, like Servo's, with the
Oilpan project, although that's mostly driven by Dart.)
Patrick
So in this model, any time we are performing an operation that will
remove a reference to the DOM node, we now need to check for the
presence of a presence of a JS wrapper and potentially run the
finalizer, I guess? It sounds like we would require AbstractNode to be
reference counted now, or I can't figure out a way to determine if all
references to the node are now released.
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo