servo: Merge #2654 - Use internal mutability for Reflector (from Ms2ger:reflector-cell); r=jdm
authorMs2ger <ms2ger@gmail.com>
Fri, 13 Jun 2014 13:29:39 -0400
changeset 334522 6c4eb20b3014ed5a52362fd10f58ae26ecaae066
parent 334521 11eb32bc4172e36a6306a83f6f33f689032179a5
child 334523 5d26c94d9768879e2262db9efc23bea5d98abe57
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
servo: Merge #2654 - Use internal mutability for Reflector (from Ms2ger:reflector-cell); r=jdm Source-Repo: https://github.com/servo/servo Source-Revision: 65e5896894afdaf79cb4387f35f78e9037dd2e52
servo/src/components/script/dom/attr.rs
servo/src/components/script/dom/attrlist.rs
servo/src/components/script/dom/bindings/codegen/CodegenRust.py
servo/src/components/script/dom/bindings/element.rs
servo/src/components/script/dom/bindings/js.rs
servo/src/components/script/dom/bindings/utils.rs
servo/src/components/script/dom/blob.rs
servo/src/components/script/dom/characterdata.rs
servo/src/components/script/dom/clientrect.rs
servo/src/components/script/dom/clientrectlist.rs
servo/src/components/script/dom/console.rs
servo/src/components/script/dom/customevent.rs
servo/src/components/script/dom/document.rs
servo/src/components/script/dom/domexception.rs
servo/src/components/script/dom/domimplementation.rs
servo/src/components/script/dom/domparser.rs
servo/src/components/script/dom/domtokenlist.rs
servo/src/components/script/dom/element.rs
servo/src/components/script/dom/event.rs
servo/src/components/script/dom/eventtarget.rs
servo/src/components/script/dom/formdata.rs
servo/src/components/script/dom/htmlcollection.rs
servo/src/components/script/dom/location.rs
servo/src/components/script/dom/mouseevent.rs
servo/src/components/script/dom/navigator.rs
servo/src/components/script/dom/node.rs
servo/src/components/script/dom/nodelist.rs
servo/src/components/script/dom/performance.rs
servo/src/components/script/dom/performancetiming.rs
servo/src/components/script/dom/progressevent.rs
servo/src/components/script/dom/testbinding.rs
servo/src/components/script/dom/uievent.rs
servo/src/components/script/dom/validitystate.rs
servo/src/components/script/dom/window.rs
servo/src/components/script/dom/xmlhttprequest.rs
servo/src/components/script/dom/xmlhttprequesteventtarget.rs
servo/src/components/script/dom/xmlhttprequestupload.rs
--- a/servo/src/components/script/dom/attr.rs
+++ b/servo/src/components/script/dom/attr.rs
@@ -66,20 +66,16 @@ pub struct Attr {
     /// the element that owns this attribute.
     pub owner: Cell<JS<Element>>,
 }
 
 impl Reflectable for Attr {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector_
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector_
-    }
 }
 
 impl Attr {
     fn new_inherited(local_name: DOMString, value: AttrValue,
                      name: DOMString, namespace: Namespace,
                      prefix: Option<DOMString>, owner: &JSRef<Element>) -> Attr {
         Attr {
             reflector_: Reflector::new(),
--- a/servo/src/components/script/dom/attrlist.rs
+++ b/servo/src/components/script/dom/attrlist.rs
@@ -52,13 +52,9 @@ impl<'a> AttrListMethods for JSRef<'a, A
         item
     }
 }
 
 impl Reflectable for AttrList {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector_
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector_
-    }
 }
--- a/servo/src/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/servo/src/components/script/dom/bindings/codegen/CodegenRust.py
@@ -1833,27 +1833,27 @@ class CGWrapMethod(CGAbstractMethod):
   assert!(scope.is_not_null());
   assert!(((*JS_GetClass(scope)).flags & JSCLASS_IS_GLOBAL) != 0);
 
   let proto = with_compartment(aCx, scope, || GetProtoObject(aCx, scope, scope));
   assert!(proto.is_not_null());
 
 %s
 
-  raw.mut_reflector().set_jsobject(obj);
+  raw.reflector().set_jsobject(obj);
 
   return raw;""" % CreateBindingJSObject(self.descriptor, "scope")
         else:
             return """
 %s
   with_compartment(aCx, obj, || {
     let proto = GetProtoObject(aCx, obj, obj);
     JS_SetPrototype(aCx, obj, proto);
   });
-  raw.mut_reflector().set_jsobject(obj);
+  raw.reflector().set_jsobject(obj);
   return raw;""" % CreateBindingJSObject(self.descriptor)
 
 
 class CGIDLInterface(CGThing):
     """
     Class for codegen of an implementation of the IDLInterface trait.
     """
     def __init__(self, descriptor):
--- a/servo/src/components/script/dom/bindings/element.rs
+++ b/servo/src/components/script/dom/bindings/element.rs
@@ -43,20 +43,16 @@ macro_rules! generate_cacheable_wrapper_
 )
 
 macro_rules! generate_cacheable_wrapper_base(
     ($name: path, $wrap: path, $parent: ident) => (
         impl Reflectable for $name {
             fn reflector<'a>(&'a self) -> &'a Reflector {
                 self.$parent.reflector()
             }
-
-            fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-                self.$parent.mut_reflector()
-            }
         }
     )
 )
 
 generate_cacheable_wrapper_characterdata!(Comment, CommentBinding::Wrap)
 
 generate_cacheable_wrapper_node!(DocumentFragment, DocumentFragmentBinding::Wrap)
 
--- a/servo/src/components/script/dom/bindings/js.rs
+++ b/servo/src/components/script/dom/bindings/js.rs
@@ -166,22 +166,16 @@ impl<T: Assignable<U>, U: Reflectable> J
 //XXXjdm This is disappointing. This only gets called from trace hooks, in theory,
 //       so it's safe to assume that self is rooted and thereby safe to access.
 impl<T: Reflectable> Reflectable for JS<T> {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         unsafe {
             (*self.unsafe_get()).reflector()
         }
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        unsafe {
-            (*self.unsafe_get()).mut_reflector()
-        }
-    }
 }
 
 impl<T: Reflectable> JS<T> {
     /// Returns an unsafe pointer to the interior of this JS object without touching the borrow
     /// flags. This is the only method that be safely accessed from layout. (The fact that this
     /// is unsafe is what necessitates the layout wrappers.)
     pub unsafe fn unsafe_get(&self) -> *mut T {
         mem::transmute_copy(&self.ptr)
@@ -495,13 +489,9 @@ impl<'a,T> JSRef<'a,T> {
         }
     }
 }
 
 impl<'a, T: Reflectable> Reflectable for JSRef<'a, T> {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         self.deref().reflector()
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        self.deref_mut().mut_reflector()
-    }
 }
--- a/servo/src/components/script/dom/bindings/utils.rs
+++ b/servo/src/components/script/dom/bindings/utils.rs
@@ -9,18 +9,19 @@ use dom::bindings::js::{JS, JSRef, Tempo
 use dom::bindings::trace::Untraceable;
 use dom::browsercontext;
 use dom::window;
 use servo_util::str::DOMString;
 
 use collections::hashmap::HashMap;
 use libc;
 use libc::c_uint;
+use std::cell::Cell;
+use std::cmp::Eq;
 use std::mem;
-use std::cmp::Eq;
 use std::ptr;
 use std::ptr::null;
 use std::slice;
 use std::str;
 use js::glue::{js_IsObjectProxyClass, js_IsFunctionProxyClass, IsProxyHandlerFamily};
 use js::glue::{GetGlobalForObjectCrossCompartment, UnwrapObject, GetProxyHandlerExtra};
 use js::glue::{IsWrapper, RUST_JSID_TO_STRING, RUST_JSID_IS_INT};
 use js::glue::{RUST_JSID_IS_STRING, RUST_JSID_TO_INT};
@@ -396,55 +397,56 @@ pub fn initialize_global(global: *mut JS
         JS_SetReservedSlot(global,
                            DOM_PROTOTYPE_SLOT,
                            PrivateValue(box_ as *libc::c_void));
     }
 }
 
 pub trait Reflectable {
     fn reflector<'a>(&'a self) -> &'a Reflector;
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector;
 }
 
 pub fn reflect_dom_object<T: Reflectable>
         (obj:     Box<T>,
          window:  &JSRef<window::Window>,
          wrap_fn: extern "Rust" fn(*mut JSContext, &JSRef<window::Window>, Box<T>) -> JS<T>)
          -> Temporary<T> {
     Temporary::new(wrap_fn(window.deref().get_cx(), window, obj))
 }
 
 #[allow(raw_pointer_deriving)]
 #[deriving(Eq)]
 pub struct Reflector {
-    object: *mut JSObject,
+    object: Cell<*mut JSObject>,
 }
 
 impl Reflector {
     #[inline]
     pub fn get_jsobject(&self) -> *mut JSObject {
-        self.object
+        self.object.get()
     }
 
-    pub fn set_jsobject(&mut self, object: *mut JSObject) {
-        assert!(self.object.is_null());
+    pub fn set_jsobject(&self, object: *mut JSObject) {
+        assert!(self.object.get().is_null());
         assert!(object.is_not_null());
-        self.object = object;
+        self.object.set(object);
     }
 
     /// Return a pointer to the memory location at which the JS reflector object is stored.
     /// Used by Temporary values to root the reflector, as required by the JSAPI rooting
     /// APIs.
-    pub fn rootable<'a>(&'a mut self) -> &'a mut *mut JSObject {
-        &mut self.object
+    pub fn rootable(&self) -> *mut *mut JSObject {
+        &self.object as *Cell<*mut JSObject>
+                     as *mut Cell<*mut JSObject>
+                     as *mut *mut JSObject
     }
 
     pub fn new() -> Reflector {
         Reflector {
-            object: ptr::mut_null(),
+            object: Cell::new(ptr::mut_null()),
         }
     }
 }
 
 pub fn GetPropertyOnPrototype(cx: *mut JSContext, proxy: *mut JSObject, id: jsid, found: *mut bool,
                               vp: *mut JSVal) -> bool {
     unsafe {
       //let proto = GetObjectProto(proxy);
--- a/servo/src/components/script/dom/blob.rs
+++ b/servo/src/components/script/dom/blob.rs
@@ -35,13 +35,9 @@ impl Blob {
 
 pub trait BlobMethods {
 }
 
 impl Reflectable for Blob {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector_
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector_
-    }
 }
--- a/servo/src/components/script/dom/characterdata.rs
+++ b/servo/src/components/script/dom/characterdata.rs
@@ -109,13 +109,9 @@ impl<'a> CharacterDataMethods for JSRef<
         node.remove_self();
     }
 }
 
 impl Reflectable for CharacterData {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         self.node.reflector()
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        self.node.mut_reflector()
-    }
 }
--- a/servo/src/components/script/dom/clientrect.rs
+++ b/servo/src/components/script/dom/clientrect.rs
@@ -74,13 +74,9 @@ impl<'a> ClientRectMethods for JSRef<'a,
         (self.bottom - self.top).abs()
     }
 }
 
 impl Reflectable for ClientRect {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector_
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector_
-    }
 }
--- a/servo/src/components/script/dom/clientrectlist.rs
+++ b/servo/src/components/script/dom/clientrectlist.rs
@@ -58,13 +58,9 @@ impl<'a> ClientRectListMethods for JSRef
         self.Item(index)
     }
 }
 
 impl Reflectable for ClientRectList {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector_
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector_
-    }
 }
--- a/servo/src/components/script/dom/console.rs
+++ b/servo/src/components/script/dom/console.rs
@@ -65,13 +65,9 @@ impl<'a> ConsoleMethods for JSRef<'a, Co
         }
     }
 }
 
 impl Reflectable for Console {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector_
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector_
-    }
 }
--- a/servo/src/components/script/dom/customevent.rs
+++ b/servo/src/components/script/dom/customevent.rs
@@ -76,13 +76,9 @@ impl<'a> CustomEventMethods for JSRef<'a
         event.InitEvent(type_, can_bubble, cancelable);
     }
 }
 
 impl Reflectable for CustomEvent {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         self.event.reflector()
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        self.event.mut_reflector()
-    }
 }
--- a/servo/src/components/script/dom/document.rs
+++ b/servo/src/components/script/dom/document.rs
@@ -246,20 +246,16 @@ impl Document {
         Document::reflect_document(box document, window, DocumentBinding::Wrap)
     }
 }
 
 impl Reflectable for Document {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         self.node.reflector()
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        self.node.mut_reflector()
-    }
 }
 
 trait PrivateDocumentHelpers {
     fn createNodeList(&self, callback: |node: &JSRef<Node>| -> bool) -> Temporary<NodeList>;
     fn get_html_element(&self) -> Option<Temporary<HTMLHtmlElement>>;
 }
 
 impl<'a> PrivateDocumentHelpers for JSRef<'a, Document> {
--- a/servo/src/components/script/dom/domexception.rs
+++ b/servo/src/components/script/dom/domexception.rs
@@ -78,20 +78,16 @@ impl DOMException {
         DOMException::new(window, DOMErrorName::from_error(code))
     }
 }
 
 impl Reflectable for DOMException {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector_
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector_
-    }
 }
 
 pub trait DOMExceptionMethods {
     fn Code(&self) -> u16;
     fn Name(&self) -> DOMString;
     fn Message(&self) -> DOMString;
 }
 
--- a/servo/src/components/script/dom/domimplementation.rs
+++ b/servo/src/components/script/dom/domimplementation.rs
@@ -38,20 +38,16 @@ impl DOMImplementation {
                            DOMImplementationBinding::Wrap)
     }
 }
 
 impl Reflectable for DOMImplementation {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector_
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector_
-    }
 }
 
 pub trait DOMImplementationMethods {
     fn CreateDocumentType(&self, qname: DOMString, pubid: DOMString, sysid: DOMString) -> Fallible<Temporary<DocumentType>>;
     fn CreateDocument(&self, namespace: Option<DOMString>, qname: DOMString,
                       mut maybe_doctype: Option<JSRef<DocumentType>>) -> Fallible<Temporary<Document>>;
     fn CreateHTMLDocument(&self, title: Option<DOMString>) -> Temporary<Document>;
 }
--- a/servo/src/components/script/dom/domparser.rs
+++ b/servo/src/components/script/dom/domparser.rs
@@ -59,13 +59,9 @@ impl<'a> DOMParserMethods for JSRef<'a, 
         }
     }
 }
 
 impl Reflectable for DOMParser {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector_
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector_
-    }
 }
--- a/servo/src/components/script/dom/domtokenlist.rs
+++ b/servo/src/components/script/dom/domtokenlist.rs
@@ -36,20 +36,16 @@ impl DOMTokenList {
                            &*window, DOMTokenListBinding::Wrap)
     }
 }
 
 impl Reflectable for DOMTokenList {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector_
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector_
-    }
 }
 
 trait PrivateDOMTokenListHelpers {
     fn attribute(&self) -> Option<Temporary<Attr>>;
 }
 
 impl<'a> PrivateDOMTokenListHelpers for JSRef<'a, DOMTokenList> {
     fn attribute(&self) -> Option<Temporary<Attr>> {
--- a/servo/src/components/script/dom/element.rs
+++ b/servo/src/components/script/dom/element.rs
@@ -57,20 +57,16 @@ impl ElementDerived for EventTarget {
         }
     }
 }
 
 impl Reflectable for Element {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         self.node.reflector()
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        self.node.mut_reflector()
-    }
 }
 
 #[deriving(Eq,Encodable)]
 pub enum ElementTypeId {
     HTMLElementTypeId,
     HTMLAnchorElementTypeId,
     HTMLAppletElementTypeId,
     HTMLAreaElementTypeId,
--- a/servo/src/components/script/dom/event.rs
+++ b/servo/src/components/script/dom/event.rs
@@ -194,13 +194,9 @@ impl<'a> EventMethods for JSRef<'a, Even
         self.trusted.deref().get()
     }
 }
 
 impl Reflectable for Event {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector_
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector_
-    }
 }
--- a/servo/src/components/script/dom/eventtarget.rs
+++ b/servo/src/components/script/dom/eventtarget.rs
@@ -273,19 +273,15 @@ impl<'a> EventTargetMethods for JSRef<'a
         self.dispatch_event_with_target(None, event)
     }
 }
 
 impl Reflectable for EventTarget {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector_
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector_
-    }
 }
 
 impl<'a> VirtualMethods for JSRef<'a, EventTarget> {
     fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods:> {
         None
     }
 }
--- a/servo/src/components/script/dom/formdata.rs
+++ b/servo/src/components/script/dom/formdata.rs
@@ -65,13 +65,9 @@ impl<'a> FormDataMethods for JSRef<'a, F
         self.data.deref().borrow_mut().insert(name, StringData(value));
     }
 }
 
 impl Reflectable for FormData {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector_
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector_
-    }
 }
--- a/servo/src/components/script/dom/htmlcollection.rs
+++ b/servo/src/components/script/dom/htmlcollection.rs
@@ -216,13 +216,9 @@ impl<'a> HTMLCollectionMethods for JSRef
         }
     }
 }
 
 impl Reflectable for HTMLCollection {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector_
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector_
-    }
 }
--- a/servo/src/components/script/dom/location.rs
+++ b/servo/src/components/script/dom/location.rs
@@ -44,13 +44,9 @@ impl<'a> LocationMethods for JSRef<'a, L
         self.page.get_url().to_str()
     }
 }
 
 impl Reflectable for Location {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector_
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector_
-    }
 }
--- a/servo/src/components/script/dom/mouseevent.rs
+++ b/servo/src/components/script/dom/mouseevent.rs
@@ -199,13 +199,9 @@ impl<'a> MouseEventMethods for JSRef<'a,
     }
 }
 
 
 impl Reflectable for MouseEvent {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         self.mouseevent.reflector()
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        self.mouseevent.mut_reflector()
-    }
 }
--- a/servo/src/components/script/dom/navigator.rs
+++ b/servo/src/components/script/dom/navigator.rs
@@ -56,13 +56,9 @@ impl<'a> NavigatorMethods for JSRef<'a, 
         "".to_string()
     }
 }
 
 impl Reflectable for Navigator {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector_
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector_
-    }
 }
--- a/servo/src/components/script/dom/node.rs
+++ b/servo/src/components/script/dom/node.rs
@@ -1936,20 +1936,16 @@ impl<'a> NodeMethods for JSRef<'a, Node>
     }
 }
 
 
 impl Reflectable for Node {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         self.eventtarget.reflector()
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        self.eventtarget.mut_reflector()
-    }
 }
 
 pub fn document_from_node<T: NodeBase>(derived: &JSRef<T>) -> Temporary<Document> {
     let node: &JSRef<Node> = NodeCast::from_ref(derived);
     node.owner_doc()
 }
 
 pub fn window_from_node<T: NodeBase>(derived: &JSRef<T>) -> Temporary<Window> {
--- a/servo/src/components/script/dom/nodelist.rs
+++ b/servo/src/components/script/dom/nodelist.rs
@@ -81,13 +81,9 @@ impl<'a> NodeListMethods for JSRef<'a, N
         item
     }
 }
 
 impl Reflectable for NodeList {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector_
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector_
-    }
 }
--- a/servo/src/components/script/dom/performance.rs
+++ b/servo/src/components/script/dom/performance.rs
@@ -47,13 +47,9 @@ impl<'a> PerformanceMethods for JSRef<'a
         (time::precise_time_s() - navStart) as DOMHighResTimeStamp
     }
 }
 
 impl Reflectable for Performance {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector_
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector_
-    }
 }
--- a/servo/src/components/script/dom/performancetiming.rs
+++ b/servo/src/components/script/dom/performancetiming.rs
@@ -45,13 +45,9 @@ impl<'a> PerformanceTimingMethods for JS
         self.navigationStartPrecise
     }
 }
 
 impl Reflectable for PerformanceTiming {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector_
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector_
-    }
 }
--- a/servo/src/components/script/dom/progressevent.rs
+++ b/servo/src/components/script/dom/progressevent.rs
@@ -71,13 +71,9 @@ impl<'a> ProgressEventMethods for JSRef<
         self.total
     }
 }
 
 impl Reflectable for ProgressEvent {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         self.event.reflector()
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        self.event.mut_reflector()
-    }
 }
--- a/servo/src/components/script/dom/testbinding.rs
+++ b/servo/src/components/script/dom/testbinding.rs
@@ -295,13 +295,9 @@ impl<'a> TestBindingMethods for JSRef<'a
         Some(Blob::new(&*window))
     }
 }
 
 impl Reflectable for TestBinding {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector
-    }
 }
--- a/servo/src/components/script/dom/uievent.rs
+++ b/servo/src/components/script/dom/uievent.rs
@@ -96,13 +96,9 @@ impl<'a> UIEventMethods for JSRef<'a, UI
         self.detail.deref().set(detail);
     }
 }
 
 impl Reflectable for UIEvent {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         self.event.reflector()
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        self.event.mut_reflector()
-    }
 }
--- a/servo/src/components/script/dom/validitystate.rs
+++ b/servo/src/components/script/dom/validitystate.rs
@@ -33,13 +33,9 @@ impl ValidityState {
 
 pub trait ValidityStateMethods {
 }
 
 impl Reflectable for ValidityState {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         &self.reflector_
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        &mut self.reflector_
-    }
 }
--- a/servo/src/components/script/dom/window.rs
+++ b/servo/src/components/script/dom/window.rs
@@ -270,20 +270,16 @@ impl<'a> WindowMethods for JSRef<'a, Win
         }
     }
 }
 
 impl Reflectable for Window {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         self.eventtarget.reflector()
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        self.eventtarget.mut_reflector()
-    }
 }
 
 pub trait WindowHelpers {
     fn damage_and_reflow(&self, damage: DocumentDamageLevel);
     fn wait_until_safe_to_modify_dom(&self);
     fn init_browser_context(&self, doc: &JSRef<Document>);
     fn load_url(&self, href: DOMString);
 }
--- a/servo/src/components/script/dom/xmlhttprequest.rs
+++ b/servo/src/components/script/dom/xmlhttprequest.rs
@@ -574,20 +574,16 @@ impl<'a> XMLHttpRequestMethods<'a> for J
         self.response_xml.get().map(|response| Temporary::new(response))
     }
 }
 
 impl Reflectable for XMLHttpRequest {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         self.eventtarget.reflector()
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        self.eventtarget.mut_reflector()
-    }
 }
 
 impl XMLHttpRequestDerived for EventTarget {
     fn is_xmlhttprequest(&self) -> bool {
         match self.type_id {
             XMLHttpRequestTargetTypeId(XMLHttpRequestTypeId) => true,
             _ => false
         }
@@ -617,24 +613,24 @@ trait PrivateXMLHttpRequestHelpers {
     fn text_response(&self) -> DOMString;
 }
 
 impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
     // Creates a trusted address to the object, and roots it. Always pair this with a release()
     unsafe fn to_trusted(&mut self) -> TrustedXHRAddress {
         assert!(self.pinned == false);
         self.pinned = true;
-        JS_AddObjectRoot(self.global.root().get_cx(), self.mut_reflector().rootable());
+        JS_AddObjectRoot(self.global.root().get_cx(), self.reflector().rootable());
         TrustedXHRAddress(self.deref() as *XMLHttpRequest as *libc::c_void)
     }
 
     fn release(&mut self) {
         assert!(self.pinned);
         unsafe {
-            JS_RemoveObjectRoot(self.global.root().get_cx(), self.mut_reflector().rootable());
+            JS_RemoveObjectRoot(self.global.root().get_cx(), self.reflector().rootable());
         }
         self.pinned = false;
     }
 
     fn change_ready_state(&mut self, rs: XMLHttpRequestState) {
         assert!(self.ready_state != rs)
         self.ready_state = rs;
         let win = &*self.global.root();
--- a/servo/src/components/script/dom/xmlhttprequesteventtarget.rs
+++ b/servo/src/components/script/dom/xmlhttprequesteventtarget.rs
@@ -31,20 +31,16 @@ impl XMLHttpRequestEventTargetDerived fo
     }
 
 }
 
 impl Reflectable for XMLHttpRequestEventTarget {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         self.eventtarget.reflector()
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        self.eventtarget.mut_reflector()
-    }
 }
 
 pub trait XMLHttpRequestEventTargetMethods {
     fn GetOnloadstart(&self) -> Option<EventHandlerNonNull>;
     fn SetOnloadstart(&self, listener: Option<EventHandlerNonNull>);
     fn GetOnprogress(&self) -> Option<EventHandlerNonNull>;
     fn SetOnprogress(&self, listener: Option<EventHandlerNonNull>);
     fn GetOnabort(&self) -> Option<EventHandlerNonNull>;
--- a/servo/src/components/script/dom/xmlhttprequestupload.rs
+++ b/servo/src/components/script/dom/xmlhttprequestupload.rs
@@ -27,20 +27,16 @@ impl XMLHttpRequestUpload {
                            window,
                            XMLHttpRequestUploadBinding::Wrap)
     }
 }
 impl Reflectable for XMLHttpRequestUpload {
     fn reflector<'a>(&'a self) -> &'a Reflector {
         self.eventtarget.reflector()
     }
-
-    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
-        self.eventtarget.mut_reflector()
-    }
 }
 
 impl XMLHttpRequestUploadDerived for EventTarget {
     fn is_xmlhttprequestupload(&self) -> bool {
         self.type_id == XMLHttpRequestTargetTypeId(XMLHttpRequestUploadTypeId)
     }
 }