Bug 915167 - Don't create helper threads when GetCPUCount() == 1 (r=bhackett)
authorLuke Wagner <luke@mozilla.com>
Wed, 11 Sep 2013 09:52:16 -0500
changeset 159502 86ffabbadeb66a7918ea6da7a465797b335f7b57
parent 159501 4299c9aa391bb3e4f3cb25fbe04f998605eb1b7e
child 159503 727213fcc7474832d144f1f8b742ca4d85473823
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhackett
bugs915167
milestone26.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 915167 - Don't create helper threads when GetCPUCount() == 1 (r=bhackett)
js/src/vm/Runtime.h
--- a/js/src/vm/Runtime.h
+++ b/js/src/vm/Runtime.h
@@ -1597,18 +1597,20 @@ struct JSRuntime : public JS::shadow::Ru
 
     void requestHelperThreadCount(size_t count) {
         requestedHelperThreadCount = count;
     }
 
     /* Number of helper threads which should be created for this runtime. */
     size_t helperThreadCount() const {
 #ifdef JS_WORKER_THREADS
-        if (requestedHelperThreadCount < 0)
-            return js::GetCPUCount();
+        if (requestedHelperThreadCount < 0) {
+            unsigned ncpus = js::GetCPUCount();
+            return ncpus == 1 ? 0 : ncpus;
+        }
         return requestedHelperThreadCount;
 #else
         return 0;
 #endif
     }
 
     void setCanUseHelperThreadsForIonCompilation(bool value) {
         useHelperThreadsForIonCompilation_ = value;