Bug 1084009 - Part 2/3 - Only parse scripts off-main-thread on multicore systems. r=luke
authorKannan Vijayan <kvijayan@mozilla.com>
Mon, 21 Sep 2015 19:07:01 -0400
changeset 263609 1308b410b282875bc5219231094bf112307f8f67
parent 263608 825f3e3ccef5a296710003e1cb007e2a989d62d1
child 263610 ad320eee186e1f57aef89c322148cc3d73c3fc91
push id65369
push userkvijayan@mozilla.com
push dateMon, 21 Sep 2015 23:07:08 +0000
treeherdermozilla-inbound@ad320eee186e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs1084009
milestone44.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 1084009 - Part 2/3 - Only parse scripts off-main-thread on multicore systems. r=luke
dom/base/nsScriptLoader.cpp
--- a/dom/base/nsScriptLoader.cpp
+++ b/dom/base/nsScriptLoader.cpp
@@ -5,16 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * A class that handles loading and evaluation of <script> elements.
  */
 
 #include "nsScriptLoader.h"
 
+#include "prsystem.h"
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "xpcpublic.h"
 #include "nsIUnicodeDecoder.h"
 #include "nsIContent.h"
 #include "nsJSUtils.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/Element.h"
@@ -1583,17 +1584,17 @@ nsScriptLoader::PrepareLoadedRequest(nsS
                mPreloads.Contains(aRequest, PreloadRequestComparator()) ||
                mParserBlockingRequest,
                "aRequest should be pending!");
 
   // Mark this as loaded
   aRequest->mProgress = nsScriptLoadRequest::Progress_DoneLoading;
 
   // If this is currently blocking the parser, attempt to compile it off-main-thread.
-  if (aRequest == mParserBlockingRequest) {
+  if (aRequest == mParserBlockingRequest && (PR_GetNumberOfProcessors() > 1)) {
     nsresult rv = AttemptAsyncScriptCompile(aRequest);
     if (rv == NS_OK) {
       NS_ASSERTION(aRequest->mProgress == nsScriptLoadRequest::Progress_Compiling,
           "Request should be off-thread compiling now.");
       return NS_OK;
     }
 
     // If off-thread compile errored, return the error.