Fix for bug 814821 (Dromaeo dom-traverse regression from bug 812333) - part 4: inline xpc_qsUnwrapObj. r=bz.
☠☠ backed out by 5de5d3950328 ☠ ☠
authorPeter Van der Beken <peterv@propagandism.org>
Tue, 27 Nov 2012 10:20:05 +0100
changeset 114279 bf8746658a7203bda1fb0019f6631d4df9c6cb37
parent 114278 e73366b088d7ed68e1f395df42519d73dc5003db
child 114280 9d70b44605083e84de6971479a151c1bb4532ddc
push id23913
push useremorley@mozilla.com
push dateWed, 28 Nov 2012 17:11:31 +0000
treeherdermozilla-central@17c267a881cf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs814821, 812333
milestone20.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
Fix for bug 814821 (Dromaeo dom-traverse regression from bug 812333) - part 4: inline xpc_qsUnwrapObj. r=bz.
dom/bindings/BindingUtils.h
js/xpconnect/src/XPCQuickStubs.cpp
js/xpconnect/src/XPCQuickStubs.h
--- a/dom/bindings/BindingUtils.h
+++ b/dom/bindings/BindingUtils.h
@@ -182,17 +182,17 @@ IsDOMObject(JSObject* obj)
   return IsDOMClass(clasp) || IsDOMProxy(obj, clasp);
 }
 
 // Some callers don't want to set an exception when unwrapping fails
 // (for example, overload resolution uses unwrapping to tell what sort
 // of thing it's looking at).
 // U must be something that a T* can be assigned to (e.g. T* or an nsRefPtr<T>).
 template <prototypes::ID PrototypeID, class T, typename U>
-inline nsresult
+MOZ_ALWAYS_INLINE nsresult
 UnwrapObject(JSContext* cx, JSObject* obj, U& value)
 {
   /* First check to see whether we have a DOM object */
   const DOMClass* domClass;
   DOMObjectSlot slot = GetDOMClass(obj, domClass);
   if (slot == eNonDOMObject) {
     /* Maybe we have a security wrapper or outer window? */
     if (!js::IsWrapper(obj)) {
--- a/js/xpconnect/src/XPCQuickStubs.cpp
+++ b/js/xpconnect/src/XPCQuickStubs.cpp
@@ -793,37 +793,16 @@ xpc_qsUnwrapThisFromCcxImpl(XPCCallConte
     nsresult rv = getNative(native, GetOffsets(native, ccx.GetProto()),
                             ccx.GetFlattenedJSObject(), iid, ppThis, pThisRef,
                             vp);
     if (NS_FAILED(rv))
         return xpc_qsThrow(ccx.GetJSContext(), rv);
     return true;
 }
 
-JSObject*
-xpc_qsUnwrapObj(JS::Value v, nsISupports **ppArgRef, nsresult *rv)
-{
-    if (v.isNullOrUndefined()) {
-        *ppArgRef = nullptr;
-        *rv = NS_OK;
-        return nullptr;
-    }
-
-    if (!v.isObject()) {
-        *ppArgRef = nullptr;
-        *rv = ((v.isInt32() && v.toInt32() == 0)
-               ? NS_ERROR_XPC_BAD_CONVERT_JS_ZERO_ISNOT_NULL
-               : NS_ERROR_XPC_BAD_CONVERT_JS);
-        return nullptr;
-    }
-
-    *rv = NS_OK;
-    return &v.toObject();
-}
-
 nsresult
 xpc_qsUnwrapArgImpl(JSContext *cx,
                     jsval v,
                     const nsIID &iid,
                     void **ppArg,
                     nsISupports **ppArgRef,
                     jsval *vp)
 {
--- a/js/xpconnect/src/XPCQuickStubs.h
+++ b/js/xpconnect/src/XPCQuickStubs.h
@@ -495,18 +495,33 @@ xpc_qsUnwrapThisFromCcx(XPCCallContext &
 {
     return xpc_qsUnwrapThisFromCcxImpl(ccx,
                                        NS_GET_TEMPLATE_IID(T),
                                        reinterpret_cast<void **>(ppThis),
                                        pThisRef,
                                        pThisVal);
 }
 
-JSObject*
-xpc_qsUnwrapObj(jsval v, nsISupports **ppArgRef, nsresult *rv);
+MOZ_ALWAYS_INLINE JSObject*
+xpc_qsUnwrapObj(jsval v, nsISupports **ppArgRef, nsresult *rv)
+{
+    *rv = NS_OK;
+    if (v.isObject()) {
+        return &v.toObject();
+    }
+
+    if (!v.isNullOrUndefined()) {
+        *rv = ((v.isInt32() && v.toInt32() == 0)
+               ? NS_ERROR_XPC_BAD_CONVERT_JS_ZERO_ISNOT_NULL
+               : NS_ERROR_XPC_BAD_CONVERT_JS);
+    }
+
+    *ppArgRef = nullptr;
+    return nullptr;
+}
 
 nsresult
 xpc_qsUnwrapArgImpl(JSContext *cx, jsval v, const nsIID &iid, void **ppArg,
                     nsISupports **ppArgRef, jsval *vp);
 
 /** Convert a jsval to an XPCOM pointer. */
 template <class Interface, class StrongRefType>
 inline nsresult