On 07/23/2013 10:08 PM, Boris Zbarsky wrote:
On 7/23/13 6:34 PM, Josh Matthews wrote:
Accordingly, there are now branches of servo, rust-mozjs,
and mozjs (all named 'inline') that contain my work to date on storing
DOM objects inline in their JS wrappers' fixed slots. There are some
rooting problems that make it crash once in a while, but otherwise
test_bindings.html runs to completion on a regular basis.
How does the resulting rust-side code look? Is is sufficiently like
idiomatic rust?
All DOM objects are represented with |JSManaged<Whatever> whatever|.
When you want to access a property owner_document of Whatever, you use
|do whatever.with_imm |whatever| { whatever.owner_document }|, and |do
whatever.with_mut |whatever| { whatever.owner_document = other_document
}| to modify it. This is exactly like the AbstractNode abstraction we
use already to expose inheritance usefully.
Thing to note:
* Each Option<AbstractNode<ScriptView>> is 16 bytes, so just the base
Node is already way over the inline storage limit, leading to the
NodeOutOfLine structure in src/script/dom/node.rs.
Hm. What are we storing inline, then? From the diff it looks like
basic stuff like parent and owner document and prevsibling is out of
line... What's our inline storage limit?
-Boris
The limit for non-proxies is 16 words, for proxies it's 13. Everything
that is not in a special OutOfLine structure (of which NodeOutOfLine is
the only one right now) is inline.
Cheers,
Josh
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo