Bug 624867 - Don't call MaybeGC() on every 20th script execution. r=jst a=blocking2.0:betaN+
authorPatrick Walton <pwalton@mozilla.com>
Wed, 12 Jan 2011 11:54:50 -0800
changeset 60568 d1adb7b245bdeebc6167f0e068e0366d1e3d0da6
parent 60567 4f71ecca94fe1c220de703e52aa6ca78b05eab45
child 60569 2d3cbd00376d0d6962988825fc882eb5c701db8e
push id18037
push usercleary@mozilla.com
push dateFri, 14 Jan 2011 17:42:55 +0000
treeherdermozilla-central@4e0501a0c5e5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst, blocking2.0
bugs624867
milestone2.0b10pre
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 624867 - Don't call MaybeGC() on every 20th script execution. r=jst a=blocking2.0:betaN+
dom/base/nsJSEnvironment.cpp
dom/base/nsJSEnvironment.h
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -1317,17 +1317,16 @@ nsJSContext::nsJSContext(JSRuntime *aRun
         LocaleToLowerCase,
         LocaleCompare,
         LocaleToUnicode
       };
 
     ::JS_SetLocaleCallbacks(mContext, &localeCallbacks);
   }
   mIsInitialized = PR_FALSE;
-  mNumEvaluations = 0;
   mTerminations = nsnull;
   mScriptsEnabled = PR_TRUE;
   mOperationCallbackTime = 0;
   mModalStateTime = 0;
   mModalStateDepth = 0;
   mProcessingScriptTag = PR_FALSE;
 }
 
@@ -3518,27 +3517,21 @@ nsJSContext::ScriptEvaluated(PRBool aTer
     for (nsJSContext::TerminationFuncClosure* cur = start;
          cur;
          cur = cur->mNext) {
       (*(cur->mTerminationFunc))(cur->mTerminationFuncArg);
     }
     delete start;
   }
 
-  mNumEvaluations++;
-
 #ifdef JS_GC_ZEAL
   if (mContext->runtime->gcZeal >= 2) {
     JS_MaybeGC(mContext);
-  } else
+  }
 #endif
-  if (mNumEvaluations > 20) {
-    mNumEvaluations = 0;
-    JS_MaybeGC(mContext);
-  }
 
   if (aTerminated) {
     mOperationCallbackTime = 0;
     mModalStateTime = 0;
   }
 }
 
 nsresult
--- a/dom/base/nsJSEnvironment.h
+++ b/dom/base/nsJSEnvironment.h
@@ -240,17 +240,16 @@ protected:
   // reporting.
   void ReportPendingException();
 private:
   void DestroyJSContext();
 
   nsrefcnt GetCCRefcnt();
 
   JSContext *mContext;
-  PRUint32 mNumEvaluations;
 
 protected:
   struct TerminationFuncHolder;
   friend struct TerminationFuncHolder;
   
   struct TerminationFuncClosure
   {
     TerminationFuncClosure(nsScriptTerminationFunc aFunc,