From 6891dd204c85d297d1828e8b4205695907d55be3 Mon Sep 17 00:00:00 2001 From: "mikhail.naganov@gmail.com" Date: Fri, 10 Jun 2011 09:36:18 +0000 Subject: [PATCH] tests compile but crash git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8255 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- test/cctest/cctest.h | 4 +-- test/cctest/test-api.cc | 28 ++++++++-------- test/cctest/test-circular-queue.cc | 12 +++---- test/cctest/test-cpu-profiler.cc | 8 ++--- test/cctest/test-debug.cc | 60 ++++++++++++++-------------------- test/cctest/test-lockers.cc | 6 ++-- test/cctest/test-platform-tls.cc | 2 +- test/cctest/test-sockets.cc | 7 ++-- test/cctest/test-thread-termination.cc | 10 +++--- test/cctest/test-threads.cc | 10 +++--- 10 files changed, 64 insertions(+), 83 deletions(-) diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h index e4052d6..b0b8eb7 100644 --- a/test/cctest/cctest.h +++ b/test/cctest/cctest.h @@ -87,8 +87,8 @@ class CcTest { class ApiTestFuzzer: public v8::internal::Thread { public: void CallTest(); - explicit ApiTestFuzzer(v8::internal::Isolate* isolate, int num) - : Thread(isolate, "ApiTestFuzzer"), + explicit ApiTestFuzzer(int num) + : Thread("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 9c3a91e..bc0ce12 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -9342,8 +9342,7 @@ void ApiTestFuzzer::Setup(PartOfTest part) { int end = (count * (part + 1) / (LAST_PART + 1)) - 1; active_tests_ = tests_being_run_ = end - start + 1; for (int i = 0; i < tests_being_run_; i++) { - RegisterThreadedTest::nth(i)->fuzzer_ = new ApiTestFuzzer( - i::Isolate::Current(), i + start); + RegisterThreadedTest::nth(i)->fuzzer_ = new ApiTestFuzzer(i + start); } for (int i = 0; i < active_tests_; i++) { RegisterThreadedTest::nth(i)->fuzzer_->Start(); @@ -10459,7 +10458,7 @@ class RegExpInterruptTest { gc_during_regexp_ = 0; regexp_success_ = false; gc_success_ = false; - GCThread gc_thread(i::Isolate::Current(), this); + GCThread gc_thread(this); gc_thread.Start(); v8::Locker::StartPreemption(1); @@ -10479,8 +10478,8 @@ class RegExpInterruptTest { class GCThread : public i::Thread { public: - explicit GCThread(i::Isolate* isolate, RegExpInterruptTest* test) - : Thread(isolate, "GCThread"), test_(test) {} + GCThread(RegExpInterruptTest* test) + : Thread("GCThread"), test_(test) {} virtual void Run() { test_->CollectGarbage(); } @@ -10582,7 +10581,7 @@ class ApplyInterruptTest { gc_during_apply_ = 0; apply_success_ = false; gc_success_ = false; - GCThread gc_thread(i::Isolate::Current(), this); + GCThread gc_thread(this); gc_thread.Start(); v8::Locker::StartPreemption(1); @@ -10602,8 +10601,8 @@ class ApplyInterruptTest { class GCThread : public i::Thread { public: - explicit GCThread(i::Isolate* isolate, ApplyInterruptTest* test) - : Thread(isolate, "GCThread"), test_(test) {} + explicit GCThread(ApplyInterruptTest* test) + : Thread("GCThread"), test_(test) {} virtual void Run() { test_->CollectGarbage(); } @@ -10877,7 +10876,7 @@ class RegExpStringModificationTest { NONE, i::kNonStrictMode)->ToObjectChecked(); - MorphThread morph_thread(i::Isolate::Current(), this); + MorphThread morph_thread(this); morph_thread.Start(); v8::Locker::StartPreemption(1); LongRunningRegExp(); @@ -10897,9 +10896,8 @@ class RegExpStringModificationTest { class MorphThread : public i::Thread { public: - explicit MorphThread(i::Isolate* isolate, - RegExpStringModificationTest* test) - : Thread(isolate, "MorphThread"), test_(test) {} + explicit MorphThread(RegExpStringModificationTest* test) + : Thread("MorphThread"), test_(test) {} virtual void Run() { test_->MorphString(); } @@ -13716,8 +13714,8 @@ 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, "IsolateThread"), + IsolateThread(v8::Isolate* isolate, int fib_limit) + : Thread("IsolateThread"), isolate_(isolate), fib_limit_(fib_limit), result_(0) { } @@ -13797,7 +13795,7 @@ class InitDefaultIsolateThread : public v8::internal::Thread { }; explicit InitDefaultIsolateThread(TestCase testCase) - : Thread(NULL, "InitDefaultIsolateThread"), + : Thread("InitDefaultIsolateThread"), testCase_(testCase), result_(false) { } diff --git a/test/cctest/test-circular-queue.cc b/test/cctest/test-circular-queue.cc index 9dd4981..c4e5c4c 100644 --- a/test/cctest/test-circular-queue.cc +++ b/test/cctest/test-circular-queue.cc @@ -84,12 +84,11 @@ class ProducerThread: public i::Thread { public: typedef SamplingCircularQueue::Cell Record; - ProducerThread(i::Isolate* isolate, - SamplingCircularQueue* scq, + ProducerThread(SamplingCircularQueue* scq, int records_per_chunk, Record value, i::Semaphore* finished) - : Thread(isolate, "producer"), + : Thread("producer"), scq_(scq), records_per_chunk_(records_per_chunk), value_(value), @@ -133,10 +132,9 @@ TEST(SamplingCircularQueueMultithreading) { // Check that we are using non-reserved values. CHECK_NE(SamplingCircularQueue::kClear, 1); CHECK_NE(SamplingCircularQueue::kEnd, 1); - i::Isolate* isolate = i::Isolate::Current(); - ProducerThread producer1(isolate, &scq, kRecordsPerChunk, 1, semaphore); - ProducerThread producer2(isolate, &scq, kRecordsPerChunk, 10, semaphore); - ProducerThread producer3(isolate, &scq, kRecordsPerChunk, 20, semaphore); + ProducerThread producer1(&scq, kRecordsPerChunk, 1, semaphore); + ProducerThread producer2(&scq, kRecordsPerChunk, 10, semaphore); + ProducerThread producer3(&scq, kRecordsPerChunk, 20, semaphore); CHECK_EQ(NULL, scq.StartDequeue()); producer1.Start(); diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc index beb73c5..7d898ce 100644 --- a/test/cctest/test-cpu-profiler.cc +++ b/test/cctest/test-cpu-profiler.cc @@ -24,7 +24,7 @@ using i::TokenEnumerator; TEST(StartStop) { CpuProfilesCollection profiles; ProfileGenerator generator(&profiles); - ProfilerEventsProcessor processor(i::Isolate::Current(), &generator); + ProfilerEventsProcessor processor(&generator); processor.Start(); processor.Stop(); processor.Join(); @@ -85,7 +85,7 @@ TEST(CodeEvents) { CpuProfilesCollection profiles; profiles.StartProfiling("", 1); ProfileGenerator generator(&profiles); - ProfilerEventsProcessor processor(i::Isolate::Current(), &generator); + ProfilerEventsProcessor processor(&generator); processor.Start(); // Enqueue code creation events. @@ -146,7 +146,7 @@ TEST(TickEvents) { CpuProfilesCollection profiles; profiles.StartProfiling("", 1); ProfileGenerator generator(&profiles); - ProfilerEventsProcessor processor(i::Isolate::Current(), &generator); + ProfilerEventsProcessor processor(&generator); processor.Start(); processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, @@ -236,7 +236,7 @@ TEST(Issue1398) { CpuProfilesCollection profiles; profiles.StartProfiling("", 1); ProfileGenerator generator(&profiles); - ProfilerEventsProcessor processor(i::Isolate::Current(), &generator); + ProfilerEventsProcessor processor(&generator); processor.Start(); processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc index d8c1876..570c9cc 100644 --- a/test/cctest/test-debug.cc +++ b/test/cctest/test-debug.cc @@ -4728,8 +4728,8 @@ Barriers message_queue_barriers; // placing JSON debugger commands in the queue. class MessageQueueDebuggerThread : public v8::internal::Thread { public: - explicit MessageQueueDebuggerThread(v8::internal::Isolate* isolate) - : Thread(isolate, "MessageQueueDebuggerThread") { } + MessageQueueDebuggerThread() + : Thread("MessageQueueDebuggerThread") { } void Run(); }; @@ -4832,8 +4832,7 @@ void MessageQueueDebuggerThread::Run() { // This thread runs the v8 engine. TEST(MessageQueues) { - MessageQueueDebuggerThread message_queue_debugger_thread( - i::Isolate::Current()); + MessageQueueDebuggerThread message_queue_debugger_thread; // Create a V8 environment v8::HandleScope scope; @@ -4980,15 +4979,13 @@ Barriers threaded_debugging_barriers; class V8Thread : public v8::internal::Thread { public: - explicit V8Thread(v8::internal::Isolate* isolate) - : Thread(isolate, "V8Thread") { } + V8Thread() : Thread("V8Thread") { } void Run(); }; class DebuggerThread : public v8::internal::Thread { public: - explicit DebuggerThread(v8::internal::Isolate* isolate) - : Thread(isolate, "DebuggerThread") { } + DebuggerThread() : Thread("DebuggerThread") { } void Run(); }; @@ -5065,8 +5062,8 @@ void DebuggerThread::Run() { TEST(ThreadedDebugging) { - DebuggerThread debugger_thread(i::Isolate::Current()); - V8Thread v8_thread(i::Isolate::Current()); + DebuggerThread debugger_thread; + V8Thread v8_thread; // Create a V8 environment threaded_debugging_barriers.Initialize(); @@ -5087,16 +5084,14 @@ TEST(ThreadedDebugging) { class BreakpointsV8Thread : public v8::internal::Thread { public: - explicit BreakpointsV8Thread(v8::internal::Isolate* isolate) - : Thread(isolate, "BreakpointsV8Thread") { } + BreakpointsV8Thread() : Thread("BreakpointsV8Thread") { } void Run(); }; class BreakpointsDebuggerThread : public v8::internal::Thread { public: - explicit BreakpointsDebuggerThread(v8::internal::Isolate* isolate, - bool global_evaluate) - : Thread(isolate, "BreakpointsDebuggerThread"), + explicit BreakpointsDebuggerThread(bool global_evaluate) + : Thread("BreakpointsDebuggerThread"), global_evaluate_(global_evaluate) {} void Run(); @@ -5273,9 +5268,8 @@ void BreakpointsDebuggerThread::Run() { void TestRecursiveBreakpointsGeneric(bool global_evaluate) { i::FLAG_debugger_auto_break = true; - BreakpointsDebuggerThread breakpoints_debugger_thread(i::Isolate::Current(), - global_evaluate); - BreakpointsV8Thread breakpoints_v8_thread(i::Isolate::Current()); + BreakpointsDebuggerThread breakpoints_debugger_thread(global_evaluate); + BreakpointsV8Thread breakpoints_v8_thread; // Create a V8 environment Barriers stack_allocated_breakpoints_barriers; @@ -5657,15 +5651,13 @@ TEST(DebuggerClearMessageHandlerWhileActive) { class HostDispatchV8Thread : public v8::internal::Thread { public: - explicit HostDispatchV8Thread(v8::internal::Isolate* isolate) - : Thread(isolate, "HostDispatchV8Thread") { } + HostDispatchV8Thread() : Thread("HostDispatchV8Thread") { } void Run(); }; class HostDispatchDebuggerThread : public v8::internal::Thread { public: - explicit HostDispatchDebuggerThread(v8::internal::Isolate* isolate) - : Thread(isolate, "HostDispatchDebuggerThread") { } + HostDispatchDebuggerThread() : Thread("HostDispatchDebuggerThread") { } void Run(); }; @@ -5737,9 +5729,8 @@ void HostDispatchDebuggerThread::Run() { TEST(DebuggerHostDispatch) { - HostDispatchDebuggerThread host_dispatch_debugger_thread( - i::Isolate::Current()); - HostDispatchV8Thread host_dispatch_v8_thread(i::Isolate::Current()); + HostDispatchDebuggerThread host_dispatch_debugger_thread; + HostDispatchV8Thread host_dispatch_v8_thread; i::FLAG_debugger_auto_break = true; // Create a V8 environment @@ -5763,15 +5754,14 @@ TEST(DebuggerHostDispatch) { class DebugMessageDispatchV8Thread : public v8::internal::Thread { public: - explicit DebugMessageDispatchV8Thread(v8::internal::Isolate* isolate) - : Thread(isolate, "DebugMessageDispatchV8Thread") { } + DebugMessageDispatchV8Thread() : Thread("DebugMessageDispatchV8Thread") { } void Run(); }; class DebugMessageDispatchDebuggerThread : public v8::internal::Thread { public: - explicit DebugMessageDispatchDebuggerThread(v8::internal::Isolate* isolate) - : Thread(isolate, "DebugMessageDispatchDebuggerThread") { } + DebugMessageDispatchDebuggerThread() + : Thread("DebugMessageDispatchDebuggerThread") { } void Run(); }; @@ -5805,10 +5795,8 @@ void DebugMessageDispatchDebuggerThread::Run() { TEST(DebuggerDebugMessageDispatch) { - DebugMessageDispatchDebuggerThread debug_message_dispatch_debugger_thread( - i::Isolate::Current()); - DebugMessageDispatchV8Thread debug_message_dispatch_v8_thread( - i::Isolate::Current()); + DebugMessageDispatchDebuggerThread debug_message_dispatch_debugger_thread; + DebugMessageDispatchV8Thread debug_message_dispatch_v8_thread; i::FLAG_debugger_auto_break = true; @@ -5873,8 +5861,8 @@ TEST(DebuggerAgent) { class DebuggerAgentProtocolServerThread : public i::Thread { public: - explicit DebuggerAgentProtocolServerThread(i::Isolate* isolate, int port) - : Thread(isolate, "DebuggerAgentProtocolServerThread"), + explicit DebuggerAgentProtocolServerThread(int port) + : Thread("DebuggerAgentProtocolServerThread"), port_(port), server_(NULL), client_(NULL), @@ -5939,7 +5927,7 @@ TEST(DebuggerAgentProtocolOverflowHeader) { // Create a socket server to receive a debugger agent message. DebuggerAgentProtocolServerThread* server = - new DebuggerAgentProtocolServerThread(i::Isolate::Current(), kPort); + new DebuggerAgentProtocolServerThread(kPort); server->Start(); server->WaitForListening(); diff --git a/test/cctest/test-lockers.cc b/test/cctest/test-lockers.cc index 1b46887..1f17051 100644 --- a/test/cctest/test-lockers.cc +++ b/test/cctest/test-lockers.cc @@ -64,7 +64,7 @@ class KangarooThread : public v8::internal::Thread { public: KangarooThread(v8::Isolate* isolate, v8::Handle context, int value) - : Thread(NULL, "KangarooThread"), + : Thread("KangarooThread"), isolate_(isolate), context_(context), value_(value) { } @@ -149,8 +149,8 @@ class JoinableThread { private: class ThreadWithSemaphore : public i::Thread { public: - explicit ThreadWithSemaphore(JoinableThread* joinable_thread) - : Thread(NULL, joinable_thread->name_), + ThreadWithSemaphore(JoinableThread* joinable_thread) + : Thread(joinable_thread->name_), joinable_thread_(joinable_thread) { } diff --git a/test/cctest/test-platform-tls.cc b/test/cctest/test-platform-tls.cc index b2cb101..7f33aa2 100644 --- a/test/cctest/test-platform-tls.cc +++ b/test/cctest/test-platform-tls.cc @@ -48,7 +48,7 @@ static void DoTest() { class TestThread : public Thread { public: - TestThread() : Thread(NULL, "TestThread") {} + TestThread() : Thread("TestThread") {} virtual void Run() { DoTest(); diff --git a/test/cctest/test-sockets.cc b/test/cctest/test-sockets.cc index 5246d09..4af55db 100644 --- a/test/cctest/test-sockets.cc +++ b/test/cctest/test-sockets.cc @@ -10,8 +10,8 @@ using namespace ::v8::internal; class SocketListenerThread : public Thread { public: - explicit SocketListenerThread(Isolate* isolate, int port, int data_size) - : Thread(isolate, "SocketListenerThread"), + SocketListenerThread(int port, int data_size) + : Thread("SocketListenerThread"), port_(port), data_size_(data_size), server_(NULL), @@ -92,8 +92,7 @@ static void SendAndReceive(int port, char *data, int len) { OS::SNPrintF(Vector(port_str, kPortBuferLen), "%d", port); // Create a socket listener. - SocketListenerThread* listener = new SocketListenerThread(Isolate::Current(), - port, len); + SocketListenerThread* listener = new SocketListenerThread(port, len); listener->Start(); listener->WaitForListening(); diff --git a/test/cctest/test-thread-termination.cc b/test/cctest/test-thread-termination.cc index 1e8a627..9e6cb4d 100644 --- a/test/cctest/test-thread-termination.cc +++ b/test/cctest/test-thread-termination.cc @@ -160,8 +160,7 @@ TEST(TerminateOnlyV8ThreadFromThreadItselfNoLoop) { class TerminatorThread : public v8::internal::Thread { public: - explicit TerminatorThread(i::Isolate* isolate) - : Thread(isolate, "TerminatorThread") { } + TerminatorThread() : Thread("TerminatorThread") { } void Run() { semaphore->Wait(); CHECK(!v8::V8::IsExecutionTerminating()); @@ -174,7 +173,7 @@ class TerminatorThread : public v8::internal::Thread { // from the side by another thread. TEST(TerminateOnlyV8ThreadFromOtherThread) { semaphore = v8::internal::OS::CreateSemaphore(0); - TerminatorThread thread(i::Isolate::Current()); + TerminatorThread thread; thread.Start(); v8::HandleScope scope; @@ -196,8 +195,7 @@ TEST(TerminateOnlyV8ThreadFromOtherThread) { class LoopingThread : public v8::internal::Thread { public: - explicit LoopingThread(i::Isolate* isolate) - : Thread(isolate, "LoopingThread") { } + LoopingThread() : Thread("LoopingThread") { } void Run() { v8::Locker locker; v8::HandleScope scope; @@ -233,7 +231,7 @@ TEST(TerminateMultipleV8ThreadsDefaultIsolate) { const int kThreads = 2; i::List threads(kThreads); for (int i = 0; i < kThreads; i++) { - threads.Add(new LoopingThread(i::Isolate::Current())); + threads.Add(new LoopingThread()); } for (int i = 0; i < kThreads; i++) { threads[i]->Start(); diff --git a/test/cctest/test-threads.cc b/test/cctest/test-threads.cc index c6d5cb0..59d27ab 100644 --- a/test/cctest/test-threads.cc +++ b/test/cctest/test-threads.cc @@ -65,7 +65,7 @@ static Turn turn = FILL_CACHE; class ThreadA: public v8::internal::Thread { public: - explicit ThreadA(i::Isolate* isolate) : Thread(isolate, "ThreadA") { } + ThreadA() : Thread("ThreadA") { } void Run() { v8::Locker locker; v8::HandleScope scope; @@ -101,7 +101,7 @@ class ThreadA: public v8::internal::Thread { class ThreadB: public v8::internal::Thread { public: - explicit ThreadB(i::Isolate* isolate) : Thread(isolate, "ThreadB") { } + ThreadB() : Thread("ThreadB") { } void Run() { do { { @@ -126,8 +126,8 @@ class ThreadB: public v8::internal::Thread { TEST(JSFunctionResultCachesInTwoThreads) { v8::V8::Initialize(); - ThreadA threadA(i::Isolate::Current()); - ThreadB threadB(i::Isolate::Current()); + ThreadA threadA; + ThreadB threadB; threadA.Start(); threadB.Start(); @@ -144,7 +144,7 @@ class ThreadIdValidationThread : public v8::internal::Thread { i::List* refs, unsigned int thread_no, i::Semaphore* semaphore) - : Thread(NULL, "ThreadRefValidationThread"), + : Thread("ThreadRefValidationThread"), refs_(refs), thread_no_(thread_no), thread_to_start_(thread_to_start), semaphore_(semaphore) { } -- 2.7.4