From 5275240ebae372c657fd605b6898e9c4ef39786b Mon Sep 17 00:00:00 2001 From: "jochen@chromium.org" Date: Thu, 20 Feb 2014 19:32:27 +0000 Subject: [PATCH] Ensure that the worker pool is running if we intend to use it 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 | 4 ++-- src/v8.cc | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libplatform/default-platform.h b/src/libplatform/default-platform.h index 877b3a63e7..5c48832344 100644 --- a/src/libplatform/default-platform.h +++ b/src/libplatform/default-platform.h @@ -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_; diff --git a/src/v8.cc b/src/v8.cc index 28454b437e..a415f26197 100644 --- 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(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);