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

_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo

Reply via email to