Bug 721642: Remove function proxy support from proxy_TraceObject. r=jorendorff
authorJim Blandy <jimb@mozilla.com>
Thu, 01 Mar 2012 12:59:24 -0800
changeset 88309 c22135099e70609695d2a83c3e1974b8d6c2126c
parent 88308 505c100dc41f742897099fea36f9dd31ce893379
child 88310 f2585061410d3f5fdcffda2bf26dd5da9fadfc95
push id157
push userMs2ger@gmail.com
push dateWed, 07 Mar 2012 19:27:10 +0000
reviewersjorendorff
bugs721642
milestone13.0a1
Bug 721642: Remove function proxy support from proxy_TraceObject. r=jorendorff Function proxies will always call proxy_TraceFunction, which handles the 'call' and 'construct' slots. This patch also moves the call to proxy_TraceObject from proxy_TraceFunction into a tail position, so it could be compiled as a jump.
js/src/jsproxy.cpp
--- a/js/src/jsproxy.cpp
+++ b/js/src/jsproxy.cpp
@@ -1246,28 +1246,24 @@ proxy_DeleteSpecial(JSContext *cx, JSObj
 
 static void
 proxy_TraceObject(JSTracer *trc, JSObject *obj)
 {
     GetProxyHandler(obj)->trace(trc, obj);
     MarkCrossCompartmentSlot(trc, &obj->getReservedSlotRef(JSSLOT_PROXY_PRIVATE), "private");
     MarkCrossCompartmentSlot(trc, &obj->getReservedSlotRef(JSSLOT_PROXY_EXTRA + 0), "extra0");
     MarkCrossCompartmentSlot(trc, &obj->getReservedSlotRef(JSSLOT_PROXY_EXTRA + 1), "extra1");
-    if (IsFunctionProxy(obj)) {
-        MarkCrossCompartmentSlot(trc, &GetCall(obj), "call");
-        MarkCrossCompartmentSlot(trc, &GetFunctionProxyConstruct(obj), "construct");
-    }
 }
 
 static void
 proxy_TraceFunction(JSTracer *trc, JSObject *obj)
 {
-    proxy_TraceObject(trc, obj);
     MarkCrossCompartmentSlot(trc, &GetCall(obj), "call");
     MarkCrossCompartmentSlot(trc, &GetFunctionProxyConstruct(obj), "construct");
+    proxy_TraceObject(trc, obj);
 }
 
 static JSBool
 proxy_Convert(JSContext *cx, JSObject *proxy, JSType hint, Value *vp)
 {
     JS_ASSERT(proxy->isProxy());
     return Proxy::defaultValue(cx, proxy, hint, vp);
 }