remove isolate reference from threads
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8254 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
bc4156ca7c
commit
f05fd92994
@ -170,7 +170,7 @@ class SourceGroup {
|
||||
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();
|
||||
|
@ -46,9 +46,8 @@ static const int kTickSamplesBufferChunkSize = 64*KB;
|
||||
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 @@ void CpuProfiler::StartProcessorIfNotStarted() {
|
||||
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.
|
||||
|
@ -134,8 +134,7 @@ class TickSampleEventRecord BASE_EMBEDDED {
|
||||
// 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.
|
||||
|
@ -116,7 +116,7 @@ void DebuggerAgent::CreateSession(Socket* client) {
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
@ -43,8 +43,8 @@ class DebuggerAgentSession;
|
||||
// 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 @@ class DebuggerAgent: public Thread {
|
||||
// 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);
|
||||
|
@ -2820,7 +2820,7 @@ bool Debugger::StartAgent(const char* name, int port,
|
||||
|
||||
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 @@ void LockingCommandMessageQueue::Clear() {
|
||||
|
||||
|
||||
MessageDispatchHelperThread::MessageDispatchHelperThread(Isolate* isolate)
|
||||
: Thread(isolate, "v8:MsgDispHelpr"),
|
||||
: Thread("v8:MsgDispHelpr"),
|
||||
sem_(OS::CreateSemaphore(0)), mutex_(OS::CreateMutex()),
|
||||
already_signalled_(false) {
|
||||
}
|
||||
|
@ -190,8 +190,8 @@ class PreallocatedMemoryThread: public Thread {
|
||||
|
||||
|
||||
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 @@ class PreallocatedMemoryThread: public Thread {
|
||||
|
||||
void Isolate::PreallocatedMemoryThreadStart() {
|
||||
if (preallocated_memory_thread_ != NULL) return;
|
||||
preallocated_memory_thread_ = new PreallocatedMemoryThread(this);
|
||||
preallocated_memory_thread_ = new PreallocatedMemoryThread();
|
||||
preallocated_memory_thread_->Start();
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ class SlidingStateWindow {
|
||||
//
|
||||
class Profiler: public Thread {
|
||||
public:
|
||||
explicit Profiler(Isolate* isolate);
|
||||
Profiler();
|
||||
void Engage();
|
||||
void Disengage();
|
||||
|
||||
@ -270,8 +270,8 @@ void SlidingStateWindow::AddState(StateTag state) {
|
||||
//
|
||||
// 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 @@ bool Logger::Setup() {
|
||||
}
|
||||
|
||||
if (FLAG_prof) {
|
||||
profiler_ = new Profiler(isolate);
|
||||
profiler_ = new Profiler();
|
||||
if (!FLAG_prof_auto) {
|
||||
profiler_->pause();
|
||||
} else {
|
||||
|
@ -653,17 +653,15 @@ class Thread::PlatformData : public Malloced {
|
||||
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 @@ static void* ThreadEntry(void* arg) {
|
||||
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 @@ class SignalSender : public Thread {
|
||||
};
|
||||
|
||||
explicit SignalSender(int interval)
|
||||
: Thread(NULL, "SignalSender"),
|
||||
: Thread("SignalSender"),
|
||||
vm_tgid_(getpid()),
|
||||
interval_(interval) {}
|
||||
|
||||
|
@ -384,9 +384,9 @@ class Thread {
|
||||
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 @@ class Thread {
|
||||
// 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 @@ class Thread {
|
||||
|
||||
PlatformData* data_;
|
||||
|
||||
Isolate* isolate_;
|
||||
char name_[kMaxThreadNameLength];
|
||||
int stack_size_;
|
||||
|
||||
|
@ -401,9 +401,10 @@ void ThreadManager::TerminateExecution(ThreadId thread_id) {
|
||||
|
||||
|
||||
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) {
|
||||
}
|
||||
|
||||
|
||||
|
@ -152,12 +152,15 @@ class ContextSwitcher: public Thread {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user