On 03/29/2014 01:35 PM, Josh Matthews wrote:
One of many hurdles in upgrading to a newer SpiderMonkey revision was
the exact rooting requirement, and I've got a branch that has a decent
start on that: https://github.com/jdm/servo/commits/newroot
In short, with my changes all of Servo's content tests run correctly
despite GCing every time SpiderMonkey allocates anything, suggesting
that our compiler-generated trace hooks are effective, and the on-stack
rooting API I've implemented is doing its job. There's more work
required to devise some types that prevent errors like the HTML parser
one that I fixed in the most recent commit, but I thought I'd post my
early promising results.
Cheers,
Josh
For those who want quick links,
https://github.com/jdm/servo/commit/3d3c8e8cdc833e88d81b4ac9f84e4cb2822dde55
shows the changes required for hand-written DOM code so far (ie. all DOM
methods now take the equivalent of JS::Handle and arguments must
therefore be explicitly rooted). Generated bindings code Just Works as
you would expect.
The parser rooting error I references is
https://github.com/jdm/servo/commit/0efd09497bb7a956d04b7589b685c7ba43cd1f06#diff-f716191032d0b98cc78247b27ec08f5dL75
.. The parser is callback-based, so we were a) creating an unrooted JS<T>
object, then GCing it when we tried to attach any attributes to it, b)
not rooting the element during the period between when it's created and
when it's attached to the tree. I suspect the solution for this is to
make methods return an Unrooted<T> instead of JS<T>, but I'll spend some
time thinking through the possibilities.
Cheers,
Josh
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo