Bug 1136925 part 4. Stop passing parents to ProxyObject::New. r=waldo
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 26 Feb 2015 15:58:59 -0500
changeset 231125 eafeefc2a038a0eb02e9c6171a44b2754cdadde0
parent 231124 2e9b1150861bab37b5120e712fea7e872f4d8bd8
child 231126 f80f5e04611c6c3ebb38934a35033ca5753b0265
push id28344
push userryanvm@gmail.com
push dateFri, 27 Feb 2015 18:20:08 +0000
treeherdermozilla-central@9dd9d1e5b43c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswaldo
bugs1136925
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1136925 part 4. Stop passing parents to ProxyObject::New. r=waldo
js/src/jsobj.cpp
js/src/proxy/Proxy.cpp
js/src/vm/ProxyObject.cpp
js/src/vm/ProxyObject.h
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -1798,17 +1798,17 @@ js::CloneObject(JSContext *cx, HandleObj
         }
 
         if (obj->as<NativeObject>().hasPrivate())
             clone->as<NativeObject>().setPrivate(obj->as<NativeObject>().getPrivate());
     } else {
         ProxyOptions options;
         options.setClass(obj->getClass());
 
-        clone = ProxyObject::New(cx, GetProxyHandler(obj), JS::NullHandleValue, proto, nullptr, options);
+        clone = ProxyObject::New(cx, GetProxyHandler(obj), JS::NullHandleValue, proto, options);
         if (!clone)
             return nullptr;
 
         if (!CopyProxyObject(cx, obj.as<ProxyObject>(), clone.as<ProxyObject>()))
             return nullptr;
     }
 
     return clone;
--- a/js/src/proxy/Proxy.cpp
+++ b/js/src/proxy/Proxy.cpp
@@ -730,18 +730,17 @@ JS_FRIEND_API(JSObject *)
 js::NewProxyObject(JSContext *cx, const BaseProxyHandler *handler, HandleValue priv, JSObject *proto_,
                    const ProxyOptions &options)
 {
     if (options.lazyProto()) {
         MOZ_ASSERT(!proto_);
         proto_ = TaggedProto::LazyProto;
     }
 
-    return ProxyObject::New(cx, handler, priv, TaggedProto(proto_), nullptr,
-                            options);
+    return ProxyObject::New(cx, handler, priv, TaggedProto(proto_), options);
 }
 
 void
 ProxyObject::renew(JSContext *cx, const BaseProxyHandler *handler, Value priv)
 {
     MOZ_ASSERT_IF(IsCrossCompartmentWrapper(this), IsDeadProxyObject(this));
     MOZ_ASSERT(getParent() == cx->global());
     MOZ_ASSERT(getClass() == &ProxyObject::class_);
--- a/js/src/vm/ProxyObject.cpp
+++ b/js/src/vm/ProxyObject.cpp
@@ -9,26 +9,24 @@
 #include "jscompartment.h"
 #include "jsgcinlines.h"
 #include "jsobjinlines.h"
 
 using namespace js;
 
 /* static */ ProxyObject *
 ProxyObject::New(JSContext *cx, const BaseProxyHandler *handler, HandleValue priv, TaggedProto proto_,
-                 JSObject *parent_, const ProxyOptions &options)
+                 const ProxyOptions &options)
 {
     Rooted<TaggedProto> proto(cx, proto_);
-    RootedObject parent(cx, parent_);
 
     const Class *clasp = options.clasp();
 
     MOZ_ASSERT(isValidProxyClass(clasp));
     MOZ_ASSERT_IF(proto.isObject(), cx->compartment() == proto.toObject()->compartment());
-    MOZ_ASSERT_IF(parent, cx->compartment() == parent->compartment());
 
     /*
      * Eagerly mark properties unknown for proxies, so we don't try to track
      * their properties and so that we don't need to walk the compartment if
      * their prototype changes later.  But don't do this for DOM proxies,
      * because we want to be able to keep track of them in typesets in useful
      * ways.
      */
@@ -45,17 +43,17 @@ ProxyObject::New(JSContext *cx, const Ba
         allocKind = GetBackgroundAllocKind(allocKind);
 
     ProxyValueArray *values = cx->zone()->new_<ProxyValueArray>();
     if (!values)
         return nullptr;
 
     // Note: this will initialize the object's |data| to strange values, but we
     // will immediately overwrite those below.
-    RootedObject obj(cx, NewObjectWithGivenTaggedProto(cx, clasp, proto, parent, allocKind,
+    RootedObject obj(cx, NewObjectWithGivenTaggedProto(cx, clasp, proto, NullPtr(), allocKind,
                                                        newKind));
     if (!obj) {
         js_free(values);
         return nullptr;
     }
 
     Rooted<ProxyObject*> proxy(cx, &obj->as<ProxyObject>());
 
--- a/js/src/vm/ProxyObject.h
+++ b/js/src/vm/ProxyObject.h
@@ -23,18 +23,17 @@ class ProxyObject : public JSObject
         static_assert(sizeof(ProxyObject) == sizeof(JSObject_Slots0),
                       "proxy object size must match GC thing size");
         static_assert(offsetof(ProxyObject, data) == ProxyDataOffset,
                       "proxy object layout must match shadow interface");
     }
 
   public:
     static ProxyObject *New(JSContext *cx, const BaseProxyHandler *handler, HandleValue priv,
-                            TaggedProto proto_, JSObject *parent_,
-                            const ProxyOptions &options);
+                            TaggedProto proto_, const ProxyOptions &options);
 
     const Value &private_() {
         return GetProxyPrivate(this);
     }
 
     void setCrossCompartmentPrivate(const Value &priv);
     void setSameCompartmentPrivate(const Value &priv);