Bug 692342 - Coalesce cleanup flagging even further. r=mrbkap
authorBobby Holley <bobbyholley@gmail.com>
Fri, 25 Nov 2011 17:09:07 -0800
changeset 80797 2c2730b0cbf7750957e63041fb7b5de3a290c3f6
parent 80796 c1bc4c0988143a2d8933b43018fb6ce7747c4871
child 80798 89e610a1014c7bd13b00a4ba73ccc07e83f262ca
push id21530
push userbmo@edmorley.co.uk
push dateSat, 26 Nov 2011 08:27:28 +0000
treeherdermozilla-central@c58bad0b4640 [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 - 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;