Bug 692342 - Simplify cleanup code in ConvertIndependentParameter(). r=mrbkap
authorBobby Holley <bobbyholley@gmail.com>
Fri, 25 Nov 2011 17:09:07 -0800
changeset 82427 8790687685ee53327539a05ae6636c6f6ddfcb29
parent 82426 e8df70ae53e2b693d2a16b2bda022cbb7e7eef47
child 82428 4d417032d8878ed97c1093544e9ae13aa964999d
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs692342
milestone11.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 692342 - Simplify cleanup code in ConvertIndependentParameter(). r=mrbkap We're not dealing with dependent parameters here. So as far as I can tell, the only behavior change that this introduces is that we flag for cleanup on T_WCHAR_STR in addition to T_CHAR_STR. This seems like something we probably want.
js/xpconnect/src/XPCWrappedNative.cpp
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -2632,68 +2632,38 @@ CallMethodHelper::ConvertIndependentPara
     // Handle dipper types separately.
     if (paramInfo.IsDipper())
         return HandleDipperParam(dp, paramInfo);
 
     // Specify the correct storage/calling semantics.
     if (paramInfo.IsIndirect())
         dp->SetIndirect();
 
-    if (type_tag == nsXPTType::T_INTERFACE) {
-        dp->SetValNeedsCleanup();
-    }
-
     jsval src;
 
     if (!GetOutParamSource(i, &src))
         return JS_FALSE;
 
     // The JSVal proper is always stored within the 'val' union and passed
     // indirectly, regardless of in/out-ness.
     if (type_tag == nsXPTType::T_JSVAL) {
         // Root the value.
         dp->val.j = JSVAL_VOID;
         if (!JS_AddValueRoot(mCallContext, &dp->val.j))
             return JS_FALSE;
+    }
+
+    // Flag cleanup for anything that isn't self-contained.
+    if (!type.IsArithmetic())
         dp->SetValNeedsCleanup();
-    }
 
     if (paramInfo.IsOut()) {
-        if (type.IsPointer() &&
-            type_tag != nsXPTType::T_INTERFACE) {
-            dp->SetValNeedsCleanup();
-        }
-
-        if (!paramInfo.IsIn())
+        if(!paramInfo.IsIn())
             return JS_TRUE;
-
     } else {
-        switch (type_tag) {
-        case nsXPTType::T_IID:
-            dp->SetValNeedsCleanup();
-            break;
-        case nsXPTType::T_CHAR_STR:
-            dp->SetValNeedsCleanup();
-            break;
-        case nsXPTType::T_ASTRING:
-            // Fall through to the T_DOMSTRING case
-        case nsXPTType::T_DOMSTRING:
-            dp->SetValNeedsCleanup();
-            break;
-
-        case nsXPTType::T_UTF8STRING:
-            // Fall through to the C string case for now...
-        case nsXPTType::T_CSTRING:
-            dp->SetValNeedsCleanup();
-            break;
-        }
-
-        // Do this *after* the above because in the case where we have a
-        // "T_DOMSTRING && IsDipper()" then arg might be null since this
-        // is really an 'out' param masquerading as an 'in' param.
         NS_ASSERTION(i < mArgc || paramInfo.IsOptional(),
                      "Expected either enough arguments or an optional argument");
         if (i < mArgc)
             src = mArgv[i];
         else if (type_tag == nsXPTType::T_JSVAL)
             src = JSVAL_VOID;
         else
             src = JSVAL_NULL;