Use more C stub pointers when possible. Update test_getter_time.js to output a value that can be interpreted as nanoseconds.

This commit is contained in:
Josh Matthews 2012-08-27 10:41:08 -04:00
parent ba0f91b64d
commit 939736ccf2
3 changed files with 5 additions and 3 deletions

@ -1 +1 @@
Subproject commit a89e0422f1ee6953dfaa30e7b43995be664a7a29
Subproject commit 194d39e0c4afd38705f0fafa212ea25bb6712201

View file

@ -6,6 +6,7 @@ import js::jsapi::bindgen::{JS_ValueToString, JS_GetStringCharsZAndLength, JS_Re
JS_GetReservedSlot, JS_SetReservedSlot, JS_NewStringCopyN,
JS_DefineFunctions, JS_DefineProperty, JS_DefineProperties};
import js::glue::bindgen::*;
import js::glue::{PROPERTY_STUB, STRICT_PROPERTY_STUB};
import js::crust::{JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ConvertStub, JS_ResolveStub};
import result::{result, ok, err};
import ptr::null;
@ -114,6 +115,7 @@ fn init(compartment: bare_compartment, doc: @Document) {
}
compartment.define_property(~"document", RUST_OBJECT_TO_JSVAL(instance.ptr),
JS_PropertyStub, JS_StrictPropertyStub,
GetJSClassHookStubPointer(PROPERTY_STUB) as *u8,
GetJSClassHookStubPointer(STRICT_PROPERTY_STUB) as *u8,
JSPROP_ENUMERATE);
}

View file

@ -1,7 +1,7 @@
var elem = document.documentElement.firstChild;
var start = (new Date()).getTime();
for (var i = 0; i < 100000; i++) {
for (var i = 0; i < 1000000; i++) {
var a = elem.nodeType;
}
window.alert((new Date()).getTime() - start);