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();
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),
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.
// 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.
}
// 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();
}
// 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),
// 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);
if (Socket::Setup()) {
if (agent_ == NULL) {
- agent_ = new DebuggerAgent(isolate_, name, port);
+ agent_ = new DebuggerAgent(name, port);
agent_->Start();
}
return true;
MessageDispatchHelperThread::MessageDispatchHelperThread(Isolate* isolate)
- : Thread(isolate, "v8:MsgDispHelpr"),
+ : Thread("v8:MsgDispHelpr"),
sem_(OS::CreateSemaphore(0)), mutex_(OS::CreateMutex()),
already_signalled_(false) {
}
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)),
void Isolate::PreallocatedMemoryThreadStart() {
if (preallocated_memory_thread_ != NULL) return;
- preallocated_memory_thread_ = new PreallocatedMemoryThread(this);
+ preallocated_memory_thread_ = new PreallocatedMemoryThread();
preallocated_memory_thread_->Start();
}
//
class Profiler: public Thread {
public:
- explicit Profiler(Isolate* isolate);
+ Profiler();
void Engage();
void Disengage();
//
// Profiler implementation.
//
-Profiler::Profiler(Isolate* isolate)
- : Thread(isolate, "v8:Profiler"),
+Profiler::Profiler()
+ : Thread("v8:Profiler"),
head_(0),
tail_(0),
overflow_(false),
}
if (FLAG_prof) {
- profiler_ = new Profiler(isolate);
+ profiler_ = new Profiler();
if (!FLAG_prof_auto) {
profiler_->pause();
} else {
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);
}
0, 0, 0);
thread->data()->thread_ = pthread_self();
ASSERT(thread->data()->thread_ != kNoThread);
- Thread::SetThreadLocal(Isolate::isolate_key(), thread->isolate());
thread->Run();
return NULL;
}
};
explicit SignalSender(int interval)
- : Thread(NULL, "SignalSender"),
+ : Thread("SignalSender"),
vm_tgid_(getpid()),
interval_(interval) {}
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.
// 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().
PlatformData* data_;
- Isolate* isolate_;
char name_[kMaxThreadNameLength];
int stack_size_;
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) {
}
// 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