From: vitalyr@chromium.org Date: Mon, 21 Mar 2011 15:04:17 +0000 (+0000) Subject: Use v8::internal threading support in samples/shell.cc. X-Git-Tag: upstream/4.7.83~19865 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=04537cb2279b09fa67a5dab757fbca6a8ed85dc2;p=platform%2Fupstream%2Fv8.git Use v8::internal threading support in samples/shell.cc. We need this for isolates testing. To make it work I had to extend the internal Thread constructor with an option to set the stack size (see the comment in shell.cc). BUG=1264 Review URL: http://codereview.chromium.org/6711068 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7289 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/samples/shell.cc b/samples/shell.cc index d4aad91..3b2076a 100644 --- a/samples/shell.cc +++ b/samples/shell.cc @@ -35,12 +35,7 @@ #include "../src/v8.h" -// TODO(isolates): -// o Either use V8 internal platform stuff for every platform or -// re-implement it. -// o Do not assume not WIN32 implies pthreads. -#ifndef WIN32 -#include // NOLINT +#if !defined(_WIN32) && !defined(_WIN64) #include // NOLINT #endif @@ -67,10 +62,6 @@ v8::Handle ReadFile(const char* name); void ReportException(v8::TryCatch* handler); -#ifndef WIN32 -void* IsolateThreadEntry(void* arg); -#endif - static bool last_run = true; class SourceGroup { @@ -78,14 +69,9 @@ class SourceGroup { SourceGroup() : argv_(NULL), begin_offset_(0), end_offset_(0), - next_semaphore_(NULL), - done_semaphore_(NULL) { -#ifndef WIN32 - next_semaphore_ = v8::internal::OS::CreateSemaphore(0); - done_semaphore_ = v8::internal::OS::CreateSemaphore(0); - thread_ = 0; -#endif - } + next_semaphore_(v8::internal::OS::CreateSemaphore(0)), + done_semaphore_(v8::internal::OS::CreateSemaphore(0)), + thread_(NULL) { } void Begin(char** argv, int offset) { argv_ = const_cast(argv); @@ -125,42 +111,49 @@ class SourceGroup { } } -#ifdef WIN32 - void StartExecuteInThread() { ExecuteInThread(); } - void WaitForThread() {} - -#else void StartExecuteInThread() { - if (thread_ == 0) { - pthread_attr_t attr; - // On some systems (OSX 10.6) the stack size default is 0.5Mb or less - // which is not enough to parse the big literal expressions used in tests. - // The stack size should be at least StackGuard::kLimitSize + some - // OS-specific padding for thread startup code. - size_t stacksize = 2 << 20; // 2 Mb seems to be enough - pthread_attr_init(&attr); - pthread_attr_setstacksize(&attr, stacksize); - int error = pthread_create(&thread_, &attr, &IsolateThreadEntry, this); - if (error != 0) { - fprintf(stderr, "Error creating isolate thread.\n"); - ExitShell(1); - } + if (thread_ == NULL) { + thread_ = new IsolateThread(this); + thread_->Start(); } next_semaphore_->Signal(); } void WaitForThread() { - if (thread_ == 0) return; + if (thread_ == NULL) return; if (last_run) { - pthread_join(thread_, NULL); - thread_ = 0; + thread_->Join(); + thread_ = NULL; } else { done_semaphore_->Wait(); } } -#endif // WIN32 private: + static v8::internal::Thread::Options GetThreadOptions() { + v8::internal::Thread::Options options; + options.name = "IsolateThread"; + // On some systems (OSX 10.6) the stack size default is 0.5Mb or less + // which is not enough to parse the big literal expressions used in tests. + // The stack size should be at least StackGuard::kLimitSize + some + // OS-specific padding for thread startup code. + options.stack_size = 2 << 20; // 2 Mb seems to be enough + return options; + } + + class IsolateThread : public v8::internal::Thread { + public: + explicit IsolateThread(SourceGroup* group) + : group_(group), v8::internal::Thread(NULL, GetThreadOptions()) {} + + virtual void Run() { + group_->ExecuteInThread(); + } + + private: + SourceGroup* group_; + }; + void ExecuteInThread() { v8::Isolate* isolate = v8::Isolate::New(); do { @@ -185,20 +178,9 @@ class SourceGroup { int end_offset_; v8::internal::Semaphore* next_semaphore_; v8::internal::Semaphore* done_semaphore_; -#ifndef WIN32 - pthread_t thread_; -#endif - - friend void* IsolateThreadEntry(void* arg); + v8::internal::Thread* thread_; }; -#ifndef WIN32 -void* IsolateThreadEntry(void* arg) { - reinterpret_cast(arg)->ExecuteInThread(); - return NULL; -} -#endif - static SourceGroup* isolate_sources = NULL; diff --git a/src/platform-cygwin.cc b/src/platform-cygwin.cc index 03fb136..4b450c1 100644 --- a/src/platform-cygwin.cc +++ b/src/platform-cygwin.cc @@ -400,12 +400,18 @@ bool ThreadHandle::IsValid() const { } -Thread::Thread() : ThreadHandle(ThreadHandle::INVALID) { - set_name("v8:"); +Thread::Thread(Isolate* isolate, const Options& options) + : ThreadHandle(ThreadHandle::INVALID), + isolate_(isolate), + stack_size_(options.stack_size) { + set_name(options.name); } -Thread::Thread(const char* name) : ThreadHandle(ThreadHandle::INVALID) { +Thread::Thread(Isolate* isolate, const char* name) + : ThreadHandle(ThreadHandle::INVALID), + isolate_(isolate), + stack_size_(0) { set_name(name); } diff --git a/src/platform-freebsd.cc b/src/platform-freebsd.cc index 9eb8884..06f832b 100644 --- a/src/platform-freebsd.cc +++ b/src/platform-freebsd.cc @@ -425,15 +425,18 @@ bool ThreadHandle::IsValid() const { } -Thread::Thread(Isolate* isolate) +Thread::Thread(Isolate* isolate, const Options& options) : ThreadHandle(ThreadHandle::INVALID), - isolate_(isolate) { - set_name("v8:"); + isolate_(isolate), + stack_size_(options.stack_size) { + set_name(options.name); } + Thread::Thread(Isolate* isolate, const char* name) : ThreadHandle(ThreadHandle::INVALID), - isolate_(isolate) { + isolate_(isolate), + stack_size_(0) { set_name(name); } @@ -462,7 +465,14 @@ void Thread::set_name(const char* name) { void Thread::Start() { - pthread_create(&thread_handle_data()->thread_, NULL, ThreadEntry, this); + pthread_attr_t* attr_ptr = NULL; + pthread_attr_t attr; + if (stack_size_ > 0) { + pthread_attr_init(&attr); + pthread_attr_setstacksize(&attr, static_cast(stack_size_)); + attr_ptr = &attr; + } + pthread_create(&thread_handle_data()->thread_, attr_ptr, ThreadEntry, this); ASSERT(IsValid()); } diff --git a/src/platform-linux.cc b/src/platform-linux.cc index 50b0b67..5e378a7 100644 --- a/src/platform-linux.cc +++ b/src/platform-linux.cc @@ -573,16 +573,18 @@ bool ThreadHandle::IsValid() const { } -Thread::Thread(Isolate* isolate) +Thread::Thread(Isolate* isolate, const Options& options) : ThreadHandle(ThreadHandle::INVALID), - isolate_(isolate) { - set_name("v8:"); + isolate_(isolate), + stack_size_(options.stack_size) { + set_name(options.name); } Thread::Thread(Isolate* isolate, const char* name) : ThreadHandle(ThreadHandle::INVALID), - isolate_(isolate) { + isolate_(isolate), + stack_size_(0) { set_name(name); } @@ -614,7 +616,14 @@ void Thread::set_name(const char* name) { void Thread::Start() { - pthread_create(&thread_handle_data()->thread_, NULL, ThreadEntry, this); + pthread_attr_t* attr_ptr = NULL; + pthread_attr_t attr; + if (stack_size_ > 0) { + pthread_attr_init(&attr); + pthread_attr_setstacksize(&attr, static_cast(stack_size_)); + attr_ptr = &attr; + } + pthread_create(&thread_handle_data()->thread_, attr_ptr, ThreadEntry, this); ASSERT(IsValid()); } @@ -875,7 +884,9 @@ class SignalSender : public Thread { }; explicit SignalSender(int interval) - : Thread(NULL), vm_tgid_(getpid()), interval_(interval) {} + : Thread(NULL, "SignalSender"), + vm_tgid_(getpid()), + interval_(interval) {} static void AddActiveSampler(Sampler* sampler) { ScopedLock lock(mutex_); diff --git a/src/platform-macos.cc b/src/platform-macos.cc index df2cd67..66c86c6 100644 --- a/src/platform-macos.cc +++ b/src/platform-macos.cc @@ -432,16 +432,18 @@ bool ThreadHandle::IsValid() const { } -Thread::Thread(Isolate* isolate) +Thread::Thread(Isolate* isolate, const Options& options) : ThreadHandle(ThreadHandle::INVALID), - isolate_(isolate) { - set_name("v8:"); + isolate_(isolate), + stack_size_(options.stack_size) { + set_name(options.name); } Thread::Thread(Isolate* isolate, const char* name) : ThreadHandle(ThreadHandle::INVALID), - isolate_(isolate) { + isolate_(isolate), + stack_size_(0) { set_name(name); } @@ -450,7 +452,6 @@ Thread::~Thread() { } - static void SetThreadName(const char* name) { // pthread_setname_np is only available in 10.6 or later, so test // for it at runtime. @@ -489,7 +490,15 @@ void Thread::set_name(const char* name) { void Thread::Start() { - pthread_create(&thread_handle_data()->thread_, NULL, ThreadEntry, this); + pthread_attr_t* attr_ptr = NULL; + pthread_attr_t attr; + if (stack_size_ > 0) { + pthread_attr_init(&attr); + pthread_attr_setstacksize(&attr, static_cast(stack_size_)); + attr_ptr = &attr; + } + pthread_create(&thread_handle_data()->thread_, attr_ptr, ThreadEntry, this); + ASSERT(IsValid()); } @@ -626,7 +635,9 @@ class Sampler::PlatformData : public Malloced { class SamplerThread : public Thread { public: - explicit SamplerThread(int interval) : Thread(NULL), interval_(interval) {} + explicit SamplerThread(int interval) + : Thread(NULL, "SamplerThread"), + interval_(interval) {} static void AddActiveSampler(Sampler* sampler) { ScopedLock lock(mutex_); diff --git a/src/platform-nullos.cc b/src/platform-nullos.cc index 3608b6b..5409936 100644 --- a/src/platform-nullos.cc +++ b/src/platform-nullos.cc @@ -340,17 +340,19 @@ bool ThreadHandle::IsValid() const { } -Thread::Thread(Isolate* isolate) +Thread::Thread(Isolate* isolate, const Options& options) : ThreadHandle(ThreadHandle::INVALID), - isolate_(isolate) { - set_name("v8:"); + isolate_(isolate), + stack_size_(options.stack_size) { + set_name(options.name); UNIMPLEMENTED(); } Thread::Thread(Isolate* isolate, const char* name) : ThreadHandle(ThreadHandle::INVALID), - isolate_(isolate) { + isolate_(isolate), + stack_size_(0) { set_name(name); UNIMPLEMENTED(); } diff --git a/src/platform-openbsd.cc b/src/platform-openbsd.cc index 568acdb..fe1a62a 100644 --- a/src/platform-openbsd.cc +++ b/src/platform-openbsd.cc @@ -400,16 +400,18 @@ bool ThreadHandle::IsValid() const { } -Thread::Thread(Isolate* isolate) +Thread::Thread(Isolate* isolate, const Options& options) : ThreadHandle(ThreadHandle::INVALID), - isolate_(isolate) { - set_name("v8:"); + isolate_(isolate), + stack_size_(options.stack_size) { + set_name(options.name); } Thread::Thread(Isolate* isolate, const char* name) : ThreadHandle(ThreadHandle::INVALID), - isolate_(isolate) { + isolate_(isolate), + stack_size_(0) { set_name(name); } @@ -438,7 +440,14 @@ void Thread::set_name(const char* name) { void Thread::Start() { - pthread_create(&thread_handle_data()->thread_, NULL, ThreadEntry, this); + pthread_attr_t* attr_ptr = NULL; + pthread_attr_t attr; + if (stack_size_ > 0) { + pthread_attr_init(&attr); + pthread_attr_setstacksize(&attr, static_cast(stack_size_)); + attr_ptr = &attr; + } + pthread_create(&thread_handle_data()->thread_, attr_ptr, ThreadEntry, this); ASSERT(IsValid()); } diff --git a/src/platform-solaris.cc b/src/platform-solaris.cc index 6e66512..da278f3 100644 --- a/src/platform-solaris.cc +++ b/src/platform-solaris.cc @@ -415,16 +415,18 @@ bool ThreadHandle::IsValid() const { } -Thread::Thread(Isolate* isolate) +Thread::Thread(Isolate* isolate, const Options& options) : ThreadHandle(ThreadHandle::INVALID), - isolate_(isolate) { - set_name("v8:"); + isolate_(isolate), + stack_size_(options.stack_size) { + set_name(options.name); } Thread::Thread(Isolate* isolate, const char* name) : ThreadHandle(ThreadHandle::INVALID), - isolate_(isolate) { + isolate_(isolate), + stack_size_(0) { set_name(name); } @@ -453,6 +455,13 @@ void Thread::set_name(const char* name) { void Thread::Start() { + pthread_attr_t* attr_ptr = NULL; + pthread_attr_t attr; + if (stack_size_ > 0) { + pthread_attr_init(&attr); + pthread_attr_setstacksize(&attr, static_cast(stack_size_)); + attr_ptr = &attr; + } pthread_create(&thread_handle_data()->thread_, NULL, ThreadEntry, this); ASSERT(IsValid()); } diff --git a/src/platform-win32.cc b/src/platform-win32.cc index 31b65c1..5945527 100644 --- a/src/platform-win32.cc +++ b/src/platform-win32.cc @@ -1503,17 +1503,19 @@ class Thread::PlatformData : public Malloced { // Initialize a Win32 thread object. The thread has an invalid thread // handle until it is started. -Thread::Thread(Isolate* isolate) +Thread::Thread(Isolate* isolate, const Options& options) : ThreadHandle(ThreadHandle::INVALID), - isolate_(isolate) { + isolate_(isolate), + stack_size_(options.stack_size) { data_ = new PlatformData(kNoThread); - set_name("v8:"); + set_name(options.name); } Thread::Thread(Isolate* isolate, const char* name) : ThreadHandle(ThreadHandle::INVALID), - isolate_(isolate) { + isolate_(isolate), + stack_size_(0) { data_ = new PlatformData(kNoThread); set_name(name); } @@ -1538,7 +1540,7 @@ Thread::~Thread() { void Thread::Start() { data_->thread_ = reinterpret_cast( _beginthreadex(NULL, - 0, + static_cast(stack_size_), ThreadEntry, this, 0, @@ -1884,7 +1886,9 @@ class Sampler::PlatformData : public Malloced { class SamplerThread : public Thread { public: - explicit SamplerThread(int interval) : Thread(NULL), interval_(interval) {} + explicit SamplerThread(int interval) + : Thread(NULL, "SamplerThread"), + interval_(interval) {} static void AddActiveSampler(Sampler* sampler) { ScopedLock lock(mutex_); diff --git a/src/platform.h b/src/platform.h index ba9e76e..a6f5fb7 100644 --- a/src/platform.h +++ b/src/platform.h @@ -388,8 +388,15 @@ class Thread: public ThreadHandle { LOCAL_STORAGE_KEY_MAX_VALUE = kMaxInt }; + struct Options { + Options() : name("v8:"), stack_size(0) {} + + const char* name; + int stack_size; + }; + // Create new thread (with a value for storing in the TLS isolate field). - explicit Thread(Isolate* isolate); + Thread(Isolate* isolate, const Options& options); Thread(Isolate* isolate, const char* name); virtual ~Thread(); @@ -436,6 +443,7 @@ class Thread: public ThreadHandle { PlatformData* data_; Isolate* isolate_; char name_[kMaxThreadNameLength]; + int stack_size_; DISALLOW_COPY_AND_ASSIGN(Thread); }; diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h index 94b3bec..277593c 100644 --- a/test/cctest/cctest.h +++ b/test/cctest/cctest.h @@ -88,7 +88,7 @@ class ApiTestFuzzer: public v8::internal::Thread { public: void CallTest(); explicit ApiTestFuzzer(v8::internal::Isolate* isolate, int num) - : Thread(isolate), + : Thread(isolate, "ApiTestFuzzer"), test_number_(num), gate_(v8::internal::OS::CreateSemaphore(0)), active_(true) { diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index fbe5d8b..3f9ed6d 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -9929,7 +9929,7 @@ class RegExpInterruptTest { class GCThread : public i::Thread { public: explicit GCThread(i::Isolate* isolate, RegExpInterruptTest* test) - : Thread(isolate), test_(test) {} + : Thread(isolate, "GCThread"), test_(test) {} virtual void Run() { test_->CollectGarbage(); } @@ -10051,7 +10051,7 @@ class ApplyInterruptTest { class GCThread : public i::Thread { public: explicit GCThread(i::Isolate* isolate, ApplyInterruptTest* test) - : Thread(isolate), test_(test) {} + : Thread(isolate, "GCThread"), test_(test) {} virtual void Run() { test_->CollectGarbage(); } @@ -10347,7 +10347,7 @@ class RegExpStringModificationTest { public: explicit MorphThread(i::Isolate* isolate, RegExpStringModificationTest* test) - : Thread(isolate), test_(test) {} + : Thread(isolate, "MorphThread"), test_(test) {} virtual void Run() { test_->MorphString(); } @@ -13044,10 +13044,10 @@ static int CalcFibonacci(v8::Isolate* isolate, int limit) { class IsolateThread : public v8::internal::Thread { public: explicit IsolateThread(v8::Isolate* isolate, int fib_limit) - : Thread(NULL), - isolate_(isolate), - fib_limit_(fib_limit), - result_(0) { } + : Thread(NULL, "IsolateThread"), + isolate_(isolate), + fib_limit_(fib_limit), + result_(0) { } void Run() { result_ = CalcFibonacci(isolate_, fib_limit_); @@ -13095,9 +13095,9 @@ class InitDefaultIsolateThread : public v8::internal::Thread { enum TestCase { IgnoreOOM, SetResourceConstraints, SetFatalHandler }; explicit InitDefaultIsolateThread(TestCase testCase) - : Thread(NULL), - testCase_(testCase), - result_(false) { } + : Thread(NULL, "InitDefaultIsolateThread"), + testCase_(testCase), + result_(false) { } void Run() { switch (testCase_) { diff --git a/test/cctest/test-circular-queue.cc b/test/cctest/test-circular-queue.cc index a0d1719..9dd4981 100644 --- a/test/cctest/test-circular-queue.cc +++ b/test/cctest/test-circular-queue.cc @@ -89,7 +89,7 @@ class ProducerThread: public i::Thread { int records_per_chunk, Record value, i::Semaphore* finished) - : Thread(isolate), + : Thread(isolate, "producer"), scq_(scq), records_per_chunk_(records_per_chunk), value_(value), diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc index 89c3367..9622968 100644 --- a/test/cctest/test-debug.cc +++ b/test/cctest/test-debug.cc @@ -4721,7 +4721,7 @@ Barriers message_queue_barriers; class MessageQueueDebuggerThread : public v8::internal::Thread { public: explicit MessageQueueDebuggerThread(v8::internal::Isolate* isolate) - : Thread(isolate) { } + : Thread(isolate, "MessageQueueDebuggerThread") { } void Run(); }; @@ -4972,13 +4972,15 @@ Barriers threaded_debugging_barriers; class V8Thread : public v8::internal::Thread { public: - explicit V8Thread(v8::internal::Isolate* isolate) : Thread(isolate) { } + explicit V8Thread(v8::internal::Isolate* isolate) + : Thread(isolate, "V8Thread") { } void Run(); }; class DebuggerThread : public v8::internal::Thread { public: - explicit DebuggerThread(v8::internal::Isolate* isolate) : Thread(isolate) { } + explicit DebuggerThread(v8::internal::Isolate* isolate) + : Thread(isolate, "DebuggerThread") { } void Run(); }; @@ -5078,7 +5080,7 @@ TEST(ThreadedDebugging) { class BreakpointsV8Thread : public v8::internal::Thread { public: explicit BreakpointsV8Thread(v8::internal::Isolate* isolate) - : Thread(isolate) { } + : Thread(isolate, "BreakpointsV8Thread") { } void Run(); }; @@ -5086,7 +5088,8 @@ class BreakpointsDebuggerThread : public v8::internal::Thread { public: explicit BreakpointsDebuggerThread(v8::internal::Isolate* isolate, bool global_evaluate) - : Thread(isolate), global_evaluate_(global_evaluate) {} + : Thread(isolate, "BreakpointsDebuggerThread"), + global_evaluate_(global_evaluate) {} void Run(); private: @@ -5647,14 +5650,14 @@ TEST(DebuggerClearMessageHandlerWhileActive) { class HostDispatchV8Thread : public v8::internal::Thread { public: explicit HostDispatchV8Thread(v8::internal::Isolate* isolate) - : Thread(isolate) { } + : Thread(isolate, "HostDispatchV8Thread") { } void Run(); }; class HostDispatchDebuggerThread : public v8::internal::Thread { public: explicit HostDispatchDebuggerThread(v8::internal::Isolate* isolate) - : Thread(isolate) { } + : Thread(isolate, "HostDispatchDebuggerThread") { } void Run(); }; @@ -5753,14 +5756,14 @@ TEST(DebuggerHostDispatch) { class DebugMessageDispatchV8Thread : public v8::internal::Thread { public: explicit DebugMessageDispatchV8Thread(v8::internal::Isolate* isolate) - : Thread(isolate) { } + : Thread(isolate, "DebugMessageDispatchV8Thread") { } void Run(); }; class DebugMessageDispatchDebuggerThread : public v8::internal::Thread { public: explicit DebugMessageDispatchDebuggerThread(v8::internal::Isolate* isolate) - : Thread(isolate) { } + : Thread(isolate, "DebugMessageDispatchDebuggerThread") { } void Run(); }; @@ -5863,7 +5866,10 @@ TEST(DebuggerAgent) { class DebuggerAgentProtocolServerThread : public i::Thread { public: explicit DebuggerAgentProtocolServerThread(i::Isolate* isolate, int port) - : Thread(isolate), port_(port), server_(NULL), client_(NULL), + : Thread(isolate, "DebuggerAgentProtocolServerThread"), + port_(port), + server_(NULL), + client_(NULL), listening_(OS::CreateSemaphore(0)) { } ~DebuggerAgentProtocolServerThread() { diff --git a/test/cctest/test-sockets.cc b/test/cctest/test-sockets.cc index b6e3f4b..5246d09 100644 --- a/test/cctest/test-sockets.cc +++ b/test/cctest/test-sockets.cc @@ -11,8 +11,12 @@ using namespace ::v8::internal; class SocketListenerThread : public Thread { public: explicit SocketListenerThread(Isolate* isolate, int port, int data_size) - : Thread(isolate), port_(port), data_size_(data_size), server_(NULL), - client_(NULL), listening_(OS::CreateSemaphore(0)) { + : Thread(isolate, "SocketListenerThread"), + port_(port), + data_size_(data_size), + server_(NULL), + client_(NULL), + listening_(OS::CreateSemaphore(0)) { data_ = new char[data_size_]; } ~SocketListenerThread() { diff --git a/test/cctest/test-thread-termination.cc b/test/cctest/test-thread-termination.cc index b1ffd69..5635b17 100644 --- a/test/cctest/test-thread-termination.cc +++ b/test/cctest/test-thread-termination.cc @@ -160,7 +160,8 @@ TEST(TerminateOnlyV8ThreadFromThreadItselfNoLoop) { class TerminatorThread : public v8::internal::Thread { public: - explicit TerminatorThread(i::Isolate* isolate) : Thread(isolate) { } + explicit TerminatorThread(i::Isolate* isolate) + : Thread(isolate, "TerminatorThread") { } void Run() { semaphore->Wait(); CHECK(!v8::V8::IsExecutionTerminating()); @@ -195,7 +196,8 @@ TEST(TerminateOnlyV8ThreadFromOtherThread) { class LoopingThread : public v8::internal::Thread { public: - explicit LoopingThread(i::Isolate* isolate) : Thread(isolate) { } + explicit LoopingThread(i::Isolate* isolate) + : Thread(isolate, "LoopingThread") { } void Run() { v8::Locker locker; v8::HandleScope scope; diff --git a/test/cctest/test-threads.cc b/test/cctest/test-threads.cc index 3b20666..37f0205 100644 --- a/test/cctest/test-threads.cc +++ b/test/cctest/test-threads.cc @@ -64,7 +64,7 @@ static Turn turn = FILL_CACHE; class ThreadA: public v8::internal::Thread { public: - explicit ThreadA(i::Isolate* isolate) : Thread(isolate) { } + explicit ThreadA(i::Isolate* isolate) : Thread(isolate, "ThreadA") { } void Run() { v8::Locker locker; v8::HandleScope scope; @@ -100,7 +100,7 @@ class ThreadA: public v8::internal::Thread { class ThreadB: public v8::internal::Thread { public: - explicit ThreadB(i::Isolate* isolate) : Thread(isolate) { } + explicit ThreadB(i::Isolate* isolate) : Thread(isolate, "ThreadB") { } void Run() { do { {