Ensure that the worker pool is running if we intend to use it
authorjochen@chromium.org <jochen@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 20 Feb 2014 19:32:27 +0000 (19:32 +0000)
committerjochen@chromium.org <jochen@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 20 Feb 2014 19:32:27 +0000 (19:32 +0000)
BUG=none
R=hpayer@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/170483002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19519 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/libplatform/default-platform.h
src/v8.cc

index 877b3a63e7b23e5882face165b5f393e27867800..5c488323442272a72c959db728e9a41e63e96014 100644 (file)
@@ -50,6 +50,8 @@ class DefaultPlatform : public Platform {
 
   void SetThreadPoolSize(int thread_pool_size);
 
+  void EnsureInitialized();
+
   // v8::Platform implementation.
   virtual void CallOnBackgroundThread(
       Task *task, ExpectedRuntime expected_runtime) V8_OVERRIDE;
@@ -59,8 +61,6 @@ class DefaultPlatform : public Platform {
  private:
   static const int kMaxThreadPoolSize = 4;
 
-  void EnsureInitialized();
-
   Mutex lock_;
   bool initialized_;
   int thread_pool_size_;
index 28454b437e5d9f75141572e37865b01e3220dfae..a415f26197b7f5cf9d001823c39021bef4d7703c 100644 (file)
--- a/src/v8.cc
+++ b/src/v8.cc
@@ -82,6 +82,8 @@ bool V8::Initialize(Deserializer* des) {
 #ifdef V8_USE_DEFAULT_PLATFORM
   DefaultPlatform* platform = static_cast<DefaultPlatform*>(platform_);
   platform->SetThreadPoolSize(isolate->max_available_threads());
+  // We currently only start the threads early, if we know that we'll use them.
+  if (FLAG_job_based_sweeping) platform->EnsureInitialized();
 #endif
 
   return isolate->Init(des);