42 bool Locker::active_ =
false;
51 isolate_ =
reinterpret_cast<i::Isolate*
>(isolate);
73 internal::ExecutionAccess access(isolate_);
116 isolate_ =
reinterpret_cast<i::Isolate*
>(isolate);
149 ASSERT(per_thread->thread_state() == lazily_archived_thread_state_);
152 lazily_archived_thread_state_ =
NULL;
153 per_thread->set_thread_state(
NULL);
159 ExecutionAccess access(isolate_);
163 if (lazily_archived_thread_.IsValid()) {
164 EagerlyArchiveThread();
168 if (per_thread ==
NULL || per_thread->thread_state() ==
NULL) {
174 char* from = state->
data();
177 from = Relocatable::RestoreState(isolate_, from);
178 #ifdef ENABLE_DEBUGGER_SUPPORT
179 from = isolate_->debug()->RestoreDebug(from);
184 per_thread->set_thread_state(
NULL);
209 static int ArchiveSpacePerThread() {
212 #ifdef ENABLE_DEBUGGER_SUPPORT
213 Debug::ArchiveSpacePerThread() +
218 Relocatable::ArchiveSpacePerThread();
222 ThreadState::ThreadState(ThreadManager* thread_manager)
223 : id_(ThreadId::Invalid()),
224 terminate_on_restore_(
false),
228 thread_manager_(thread_manager) {
232 ThreadState::~ThreadState() {
233 DeleteArray<char>(data_);
237 void ThreadState::AllocateSpace() {
238 data_ = NewArray<char>(ArchiveSpacePerThread());
243 next_->previous_ = previous_;
244 previous_->next_ = next_;
250 list ==
FREE_LIST ? thread_manager_->free_anchor_
251 : thread_manager_->in_use_anchor_;
252 next_ = flying_anchor->next_;
253 previous_ = flying_anchor;
254 flying_anchor->next_ =
this;
255 next_->previous_ =
this;
261 if (gotten == free_anchor_) {
263 new_thread_state->AllocateSpace();
264 return new_thread_state;
272 return in_use_anchor_->
Next();
277 if (next_ == thread_manager_->in_use_anchor_)
return NULL;
285 ThreadManager::ThreadManager()
286 : mutex_owner_(
ThreadId::Invalid()),
287 lazily_archived_thread_(
ThreadId::Invalid()),
288 lazily_archived_thread_state_(
NULL),
290 in_use_anchor_(
NULL) {
296 ThreadManager::~ThreadManager() {
297 DeleteThreadStateList(free_anchor_);
298 DeleteThreadStateList(in_use_anchor_);
302 void ThreadManager::DeleteThreadStateList(ThreadState* anchor) {
304 for (
ThreadState* current = anchor->next_; current != anchor;) {
320 isolate_->FindOrAllocatePerThreadDataForThisThread();
321 per_thread->set_thread_state(state);
323 lazily_archived_thread_state_ = state;
330 void ThreadManager::EagerlyArchiveThread() {
332 ThreadState* state = lazily_archived_thread_state_;
334 char* to = state->
data();
339 to = Relocatable::ArchiveState(isolate_, to);
340 #ifdef ENABLE_DEBUGGER_SUPPORT
341 to = isolate_->debug()->ArchiveDebug(to);
347 lazily_archived_thread_state_ =
NULL;
354 #ifdef ENABLE_DEBUGGER_SUPPORT
366 return data !=
NULL && data->thread_state() !=
NULL;
374 state = state->
Next()) {
375 char* data = state->
data();
377 data = isolate_->
Iterate(v, data);
378 data = Relocatable::Iterate(v, data);
386 state = state->
Next()) {
387 char* data = state->
data();
402 state = state->
Next()) {
403 if (thread_id.Equals(state->
id())) {
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
char * ArchiveState(char *to)
HandleScopeImplementer * handle_scope_implementer()
char * ArchiveThread(char *to)
char * RestoreThread(char *from)
static int ArchiveSpacePerThread()
void FreeThreadResources()
Bootstrapper * bootstrapper()
PerIsolateThreadData * FindPerThreadDataForThisThread()
RegExpStack * regexp_stack()
#define ASSERT(condition)
char * RestoreState(char *from)
ThreadManager * thread_manager()
bool IsDefaultIsolate() const
void IterateArchivedThreads(ThreadVisitor *v)
StackGuard * stack_guard()
void FreeThreadResources()
static bool IsLocked(Isolate *isolate)
void TerminateExecution(ThreadId thread_id)
void FreeThreadResources()
char * RestoreStackGuard(char *from)
void ClearThread(const ExecutionAccess &lock)
char * ArchiveStack(char *to)
char * ArchiveStackGuard(char *to)
static ThreadId Current()
bool terminate_on_restore()
static void EnterDefaultIsolate()
void TerminateExecution()
static int ArchiveSpacePerThread()
void IterateThread(ThreadVisitor *v, char *t)
void Iterate(ObjectVisitor *v)
char * RestoreStack(char *from)
void Iterate(ObjectVisitor *v)
bool IsLockedByCurrentThread()
ThreadState * GetFreeThreadState()
static int ArchiveSpacePerThread()
void FreeThreadResources()
void FreeThreadResources()
void Iterate(v8::internal::ObjectVisitor *v)
static int ArchiveSpacePerThread()
char * ArchiveThread(char *to)
static ThreadId Invalid()
char * RestoreThread(char *from)
void FreeThreadResources()
void set_terminate_on_restore(bool terminate_on_restore)
ThreadState * FirstThreadStateInUse()
static int ArchiveSpacePerThread()
void InitThread(const ExecutionAccess &lock)