Bug 683802 - Remove mAutoString micro-optimization. r=mrbkap
authorBobby Holley <bobbyholley@gmail.com>
Fri, 23 Sep 2011 14:50:27 -0700
changeset 77463 b59d487d96204ad951d08361d34547cb6586b47d
parent 77462 9eb6dc0ea6b272f053cbd759a9b406b3d6e2de0d
child 77464 0a45714951c6fe0875b28a1481a8a505ed819204
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersmrbkap
bugs683802
milestone9.0a1
Bug 683802 - Remove mAutoString micro-optimization. r=mrbkap
js/src/xpconnect/src/xpcwrappednative.cpp
--- a/js/src/xpconnect/src/xpcwrappednative.cpp
+++ b/js/src/xpconnect/src/xpcwrappednative.cpp
@@ -2176,22 +2176,16 @@ class CallMethodHelper
     nsISupports* const mCallee;
     const uint16 mVTableIndex;
     const jsid mIdxValueId;
 
     nsAutoTArray<nsXPTCVariant, 8> mDispatchParams;
     uint8 mJSContextIndex; // TODO make const
     uint8 mOptArgcIndex; // TODO make const
 
-    // Reserve space for one nsAutoString. We don't want the string itself
-    // to be declared as that would make the ctor and dtors run for each
-    // CallMethodHelper instantiation, and they're only needed in a
-    // fraction of all the calls that come through here.
-    js::Maybe<nsAutoString> mAutoString;
-
     jsval* const mArgv;
     const PRUint32 mArgc;
 
     enum SizeMode {
         eGetSize,
         eGetLength
     };
 
@@ -2876,25 +2870,16 @@ CallMethodHelper::ConvertIndependentPara
 
                 case nsXPTType::T_DOMSTRING:
                     if(paramInfo.IsDipper())
                     {
                         // Is an 'out' DOMString. Make a new nsAString
                         // now and then continue in order to skip the call to
                         // JSData2Native
 
-                        if(mAutoString.empty())
-                        {
-                            mAutoString.construct();
-                            // Don't call SetValIsDOMString because we don't
-                            // want to delete this pointer.
-                            dp->val.p = mAutoString.addr();
-                            continue;
-                        }
-
                         dp->SetValIsDOMString();
                         if(!(dp->val.p = new nsAutoString()))
                         {
                             JS_ReportOutOfMemory(mCallContext);
                             return JS_FALSE;
                         }
                         continue;
                     }