Skip to content

Commit

Permalink
Switch DOM bindings to using inlined GetObjectSlot
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky committed Oct 12, 2012
1 parent bdf480c commit 8391e3b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/rust-mozjs
Submodule rust-mozjs updated 1 files
+57 −1 js.rs
2 changes: 1 addition & 1 deletion src/servo/dom/bindings/node.rs
Expand Up @@ -74,7 +74,7 @@ fn NodeBundle(n: Node, s: NodeScope) -> NodeBundle {
}

unsafe fn unwrap(obj: *JSObject) -> *rust_box<NodeBundle> {
let val = JS_GetReservedSlot(obj, 0);
let val = js::GetReservedSlot(obj, 0);
cast::reinterpret_cast(&JSVAL_TO_PRIVATE(val))
}

Expand Down
10 changes: 6 additions & 4 deletions src/test/test_getter_time.js
@@ -1,12 +1,14 @@
var elem = document.documentElement.firstChild;

var start = (new Date()).getTime();
for (var i = 0; i < 1000000; i++) {
var start = new Date()
var count = 1000000;
for (var i = 0; i < count; i++) {
var a = elem.nodeType;
}
window.alert((new Date()).getTime() - start);
var stop = new Date()
window.alert((stop - start) / count * 1e6);

/*start = new Date().getTime();
for (i = 0; i < 10000; i++)
elem.width = i;
window.alert(new Date().getTime() - start);*/
window.alert(new Date().getTime() - start);*/

0 comments on commit 8391e3b

Please sign in to comment.