Bug 692342 - Coalesce cleanup flagging even further. r=mrbkap
authorBobby Holley <bobbyholley@gmail.com>
Fri, 25 Nov 2011 17:09:07 -0800
changeset 81596 2c2730b0cbf7750957e63041fb7b5de3a290c3f6
parent 81595 c1bc4c0988143a2d8933b43018fb6ce7747c4871
child 81597 89e610a1014c7bd13b00a4ba73ccc07e83f262ca
push id628
push userclegnitto@mozilla.com
push dateWed, 21 Dec 2011 14:41:57 +0000
treeherdermozilla-aurora@24a61ad789e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs692342
milestone11.0a1
Bug 692342 - Coalesce cleanup flagging even further. r=mrbkap This eliminates another pesky use of IsPointer().
js/xpconnect/src/XPCWrappedNative.cpp
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -2744,33 +2744,24 @@ CallMethodHelper::ConvertDependentParam(
     } else {
         datum_type = type;
     }
 
     // Specify the correct storage/calling semantics.
     if (paramInfo.IsIndirect())
         dp->SetIndirect();
 
-    // Flag cleanup as necessary for each type.
-    if (isArray) {
-        // Case 1 - Arrays.
-        if (datum_type.IsPointer())
-            dp->SetValNeedsCleanup();
-
-    } else if (isSizedString) {
-        // Case 2 - Sized strings.
+    // We have 3 possible type of dependent parameters: Arrays, Sized Strings,
+    // and iid_is Interface pointers. The latter two always need cleanup, and
+    // arrays need cleanup for all non-arithmetic types. Since the latter two
+    // cases also happen to be non-arithmetic, we can just inspect datum_type
+    // here.
+    if (!datum_type.IsArithmetic())
         dp->SetValNeedsCleanup();
 
-    } else {
-        // Case 3 - Dependent interface pointer.
-        NS_ABORT_IF_FALSE(type.TagPart() == nsXPTType::T_INTERFACE_IS,
-                          "Unknown dependent type.");
-        dp->SetValNeedsCleanup();
-    }
-
     // Even if there's nothing to convert, we still need to examine the
     // JSObject container for out-params. If it's null or otherwise invalid,
     // we want to know before the call, rather than after.
     //
     // This is a no-op for 'in' params.
     jsval src;
     if (!GetOutParamSource(i, &src))
         return JS_FALSE;