Remove use of unstable box syntax.

http://www.robohornet.org gives a score of 101.36 on master,
and 102.68 with this PR. The latter is slightly better,
but probably within noise level.
So it looks like this PR does not affect DOM performance.

This is expected since `Box::new` is defined as:

```rust
impl<T> Box<T> {
    #[inline(always)]
    pub fn new(x: T) -> Box<T> {
        box x
    }
}
```

With inlining, it should compile to the same as box syntax.
This commit is contained in:
Simon Sapin 2017-10-16 14:35:30 +02:00
parent a5100e3c78
commit aa15dc269f
270 changed files with 580 additions and 514 deletions

View file

@ -226,7 +226,7 @@ pub unsafe fn create_global_object(
// avoid getting trace hooks called on a partially initialized object.
JS_SetReservedSlot(rval.get(), DOM_OBJECT_SLOT, PrivateValue(private));
let proto_array: Box<ProtoOrIfaceArray> =
box [0 as *mut JSObject; PrototypeList::PROTO_OR_IFACE_LENGTH];
Box::new([0 as *mut JSObject; PrototypeList::PROTO_OR_IFACE_LENGTH]);
JS_SetReservedSlot(rval.get(),
DOM_PROTOTYPE_SLOT,
PrivateValue(Box::into_raw(proto_array) as *const libc::c_void));