Revision: 8254
Author: [email protected]
Date: Fri Jun 10 02:35:31 2011
Log: remove isolate reference from threads
http://code.google.com/p/v8/source/detail?r=8254
Modified:
/branches/bleeding_edge/samples/shell.cc
/branches/bleeding_edge/src/cpu-profiler.cc
/branches/bleeding_edge/src/cpu-profiler.h
/branches/bleeding_edge/src/debug-agent.cc
/branches/bleeding_edge/src/debug-agent.h
/branches/bleeding_edge/src/debug.cc
/branches/bleeding_edge/src/isolate.cc
/branches/bleeding_edge/src/log.cc
/branches/bleeding_edge/src/platform-linux.cc
/branches/bleeding_edge/src/platform.h
/branches/bleeding_edge/src/v8threads.cc
/branches/bleeding_edge/src/v8threads.h
=======================================
--- /branches/bleeding_edge/samples/shell.cc Mon Jun 6 13:47:30 2011
+++ /branches/bleeding_edge/samples/shell.cc Fri Jun 10 02:35:31 2011
@@ -170,7 +170,7 @@
class IsolateThread : public v8::internal::Thread {
public:
explicit IsolateThread(SourceGroup* group)
- : v8::internal::Thread(NULL, GetThreadOptions()), group_(group) {}
+ : v8::internal::Thread(GetThreadOptions()), group_(group) {}
virtual void Run() {
group_->ExecuteInThread();
=======================================
--- /branches/bleeding_edge/src/cpu-profiler.cc Thu May 19 01:25:38 2011
+++ /branches/bleeding_edge/src/cpu-profiler.cc Fri Jun 10 02:35:31 2011
@@ -46,9 +46,8 @@
static const int kTickSamplesBufferChunksCount = 16;
-ProfilerEventsProcessor::ProfilerEventsProcessor(Isolate* isolate,
- ProfileGenerator*
generator)
- : Thread(isolate, "v8:ProfEvntProc"),
+ProfilerEventsProcessor::ProfilerEventsProcessor(ProfileGenerator*
generator)
+ : Thread("v8:ProfEvntProc"),
generator_(generator),
running_(true),
ticks_buffer_(sizeof(TickSampleEventRecord),
@@ -507,7 +506,7 @@
saved_logging_nesting_ = isolate->logger()->logging_nesting_;
isolate->logger()->logging_nesting_ = 0;
generator_ = new ProfileGenerator(profiles_);
- processor_ = new ProfilerEventsProcessor(isolate, generator_);
+ processor_ = new ProfilerEventsProcessor(generator_);
NoBarrier_Store(&is_profiling_, true);
processor_->Start();
// Enumerate stuff we already have in the heap.
=======================================
--- /branches/bleeding_edge/src/cpu-profiler.h Fri May 20 08:11:00 2011
+++ /branches/bleeding_edge/src/cpu-profiler.h Fri Jun 10 02:35:31 2011
@@ -134,8 +134,7 @@
// methods called by event producers: VM and stack sampler threads.
class ProfilerEventsProcessor : public Thread {
public:
- ProfilerEventsProcessor(Isolate* isolate,
- ProfileGenerator* generator);
+ explicit ProfilerEventsProcessor(ProfileGenerator* generator);
virtual ~ProfilerEventsProcessor() {}
// Thread control.
=======================================
--- /branches/bleeding_edge/src/debug-agent.cc Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/src/debug-agent.cc Fri Jun 10 02:35:31 2011
@@ -116,7 +116,7 @@
}
// Create a new session and hook up the debug message handler.
- session_ = new DebuggerAgentSession(isolate(), this, client);
+ session_ = new DebuggerAgentSession(this, client);
v8::Debug::SetMessageHandler2(DebuggerAgentMessageHandler);
session_->Start();
}
=======================================
--- /branches/bleeding_edge/src/debug-agent.h Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/src/debug-agent.h Fri Jun 10 02:35:31 2011
@@ -43,8 +43,8 @@
// handles connection from a remote debugger.
class DebuggerAgent: public Thread {
public:
- DebuggerAgent(Isolate* isolate, const char* name, int port)
- : Thread(isolate, name),
+ DebuggerAgent(const char* name, int port)
+ : Thread(name),
name_(StrDup(name)), port_(port),
server_(OS::CreateSocket()), terminate_(false),
session_access_(OS::CreateMutex()), session_(NULL),
@@ -88,8 +88,8 @@
// debugger and sends debugger events/responses to the remote debugger.
class DebuggerAgentSession: public Thread {
public:
- DebuggerAgentSession(Isolate* isolate, DebuggerAgent* agent, Socket*
client)
- : Thread(isolate, "v8:DbgAgntSessn"),
+ DebuggerAgentSession(DebuggerAgent* agent, Socket* client)
+ : Thread("v8:DbgAgntSessn"),
agent_(agent), client_(client) {}
void DebuggerMessage(Vector<uint16_t> message);
=======================================
--- /branches/bleeding_edge/src/debug.cc Tue May 24 07:01:36 2011
+++ /branches/bleeding_edge/src/debug.cc Fri Jun 10 02:35:31 2011
@@ -2820,7 +2820,7 @@
if (Socket::Setup()) {
if (agent_ == NULL) {
- agent_ = new DebuggerAgent(isolate_, name, port);
+ agent_ = new DebuggerAgent(name, port);
agent_->Start();
}
return true;
@@ -3122,7 +3122,7 @@
MessageDispatchHelperThread::MessageDispatchHelperThread(Isolate* isolate)
- : Thread(isolate, "v8:MsgDispHelpr"),
+ : Thread("v8:MsgDispHelpr"),
sem_(OS::CreateSemaphore(0)), mutex_(OS::CreateMutex()),
already_signalled_(false) {
}
=======================================
--- /branches/bleeding_edge/src/isolate.cc Tue Jun 7 11:33:03 2011
+++ /branches/bleeding_edge/src/isolate.cc Fri Jun 10 02:35:31 2011
@@ -190,8 +190,8 @@
private:
- explicit PreallocatedMemoryThread(Isolate* isolate)
- : Thread(isolate, "v8:PreallocMem"),
+ PreallocatedMemoryThread()
+ : Thread("v8:PreallocMem"),
keep_running_(true),
wait_for_ever_semaphore_(OS::CreateSemaphore(0)),
data_ready_semaphore_(OS::CreateSemaphore(0)),
@@ -219,7 +219,7 @@
void Isolate::PreallocatedMemoryThreadStart() {
if (preallocated_memory_thread_ != NULL) return;
- preallocated_memory_thread_ = new PreallocatedMemoryThread(this);
+ preallocated_memory_thread_ = new PreallocatedMemoryThread();
preallocated_memory_thread_->Start();
}
=======================================
--- /branches/bleeding_edge/src/log.cc Mon May 30 07:33:23 2011
+++ /branches/bleeding_edge/src/log.cc Fri Jun 10 02:35:31 2011
@@ -83,7 +83,7 @@
//
class Profiler: public Thread {
public:
- explicit Profiler(Isolate* isolate);
+ Profiler();
void Engage();
void Disengage();
@@ -270,8 +270,8 @@
//
// Profiler implementation.
//
-Profiler::Profiler(Isolate* isolate)
- : Thread(isolate, "v8:Profiler"),
+Profiler::Profiler()
+ : Thread("v8:Profiler"),
head_(0),
tail_(0),
overflow_(false),
@@ -1858,7 +1858,7 @@
}
if (FLAG_prof) {
- profiler_ = new Profiler(isolate);
+ profiler_ = new Profiler();
if (!FLAG_prof_auto) {
profiler_->pause();
} else {
=======================================
--- /branches/bleeding_edge/src/platform-linux.cc Tue Jun 7 00:17:46 2011
+++ /branches/bleeding_edge/src/platform-linux.cc Fri Jun 10 02:35:31 2011
@@ -653,17 +653,15 @@
pthread_t thread_; // Thread handle for pthread.
};
-Thread::Thread(Isolate* isolate, const Options& options)
+Thread::Thread(const Options& options)
: data_(new PlatformData()),
- isolate_(isolate),
stack_size_(options.stack_size) {
set_name(options.name);
}
-Thread::Thread(Isolate* isolate, const char* name)
+Thread::Thread(const char* name)
: data_(new PlatformData()),
- isolate_(isolate),
stack_size_(0) {
set_name(name);
}
@@ -684,7 +682,6 @@
0, 0, 0);
thread->data()->thread_ = pthread_self();
ASSERT(thread->data()->thread_ != kNoThread);
- Thread::SetThreadLocal(Isolate::isolate_key(), thread->isolate());
thread->Run();
return NULL;
}
@@ -974,7 +971,7 @@
};
explicit SignalSender(int interval)
- : Thread(NULL, "SignalSender"),
+ : Thread("SignalSender"),
vm_tgid_(getpid()),
interval_(interval) {}
=======================================
--- /branches/bleeding_edge/src/platform.h Wed Jun 8 00:28:31 2011
+++ /branches/bleeding_edge/src/platform.h Fri Jun 10 02:35:31 2011
@@ -384,9 +384,9 @@
int stack_size;
};
- // Create new thread (with a value for storing in the TLS isolate field).
- Thread(Isolate* isolate, const Options& options);
- Thread(Isolate* isolate, const char* name);
+ // Create new thread.
+ explicit Thread(const Options& options);
+ explicit Thread(const char* name);
virtual ~Thread();
// Start new thread by calling the Run() method in the new thread.
@@ -433,7 +433,6 @@
// A hint to the scheduler to let another thread run.
static void YieldCPU();
- Isolate* isolate() const { return isolate_; }
// The thread name length is limited to 16 based on Linux's
implementation of
// prctl().
@@ -447,7 +446,6 @@
PlatformData* data_;
- Isolate* isolate_;
char name_[kMaxThreadNameLength];
int stack_size_;
=======================================
--- /branches/bleeding_edge/src/v8threads.cc Mon Jun 6 01:45:42 2011
+++ /branches/bleeding_edge/src/v8threads.cc Fri Jun 10 02:35:31 2011
@@ -401,9 +401,10 @@
ContextSwitcher::ContextSwitcher(Isolate* isolate, int every_n_ms)
- : Thread(isolate, "v8:CtxtSwitcher"),
+ : Thread("v8:CtxtSwitcher"),
keep_going_(true),
- sleep_ms_(every_n_ms) {
+ sleep_ms_(every_n_ms),
+ isolate_(isolate) {
}
=======================================
--- /branches/bleeding_edge/src/v8threads.h Mon Apr 11 16:46:22 2011
+++ /branches/bleeding_edge/src/v8threads.h Fri Jun 10 02:35:31 2011
@@ -150,14 +150,17 @@
// Preempted thread needs to call back to the ContextSwitcher to
acknowledge
// the handling of a preemption request.
static void PreemptionReceived();
-
+
private:
- explicit ContextSwitcher(Isolate* isolate, int every_n_ms);
+ ContextSwitcher(Isolate* isolate, int every_n_ms);
+
+ Isolate* isolate() const { return isolate_; }
void Run();
bool keep_going_;
int sleep_ms_;
+ Isolate* isolate_;
};
} } // namespace v8::internal
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev