Bug 683802 - Remove mAutoString micro-optimization. r=mrbkap
authorBobby Holley <bobbyholley@gmail.com>
Sun, 25 Sep 2011 15:38:00 +0100
changeset 77526 c14b52621e7b43be376a7c29229d06434f4ceab0
parent 77525 2fe54a83eb507eb412d9ff8920b68a0e8000bfdf
child 77527 419e8e7166091a0813653ec0ba8980fd48d1c833
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;
                     }