| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 return false; | 156 return false; |
| 157 } | 157 } |
| 158 char* from = state->data(); | 158 char* from = state->data(); |
| 159 from = isolate_->handle_scope_implementer()->RestoreThread(from); | 159 from = isolate_->handle_scope_implementer()->RestoreThread(from); |
| 160 from = isolate_->RestoreThread(from); | 160 from = isolate_->RestoreThread(from); |
| 161 from = Relocatable::RestoreState(from); | 161 from = Relocatable::RestoreState(from); |
| 162 #ifdef ENABLE_DEBUGGER_SUPPORT | 162 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 163 from = isolate_->debug()->RestoreDebug(from); | 163 from = isolate_->debug()->RestoreDebug(from); |
| 164 #endif | 164 #endif |
| 165 from = isolate_->stack_guard()->RestoreStackGuard(from); | 165 from = isolate_->stack_guard()->RestoreStackGuard(from); |
| 166 from = RegExpStack::RestoreStack(from); | 166 from = isolate_->regexp_stack()->RestoreStack(from); |
| 167 from = isolate_->bootstrapper()->RestoreState(from); | 167 from = isolate_->bootstrapper()->RestoreState(from); |
| 168 Thread::SetThreadLocal(thread_state_key_, NULL); | 168 Thread::SetThreadLocal(thread_state_key_, NULL); |
| 169 if (state->terminate_on_restore()) { | 169 if (state->terminate_on_restore()) { |
| 170 isolate_->stack_guard()->TerminateExecution(); | 170 isolate_->stack_guard()->TerminateExecution(); |
| 171 state->set_terminate_on_restore(false); | 171 state->set_terminate_on_restore(false); |
| 172 } | 172 } |
| 173 state->set_id(kInvalidId); | 173 state->set_id(kInvalidId); |
| 174 state->Unlink(); | 174 state->Unlink(); |
| 175 state->LinkInto(ThreadState::FREE_LIST); | 175 state->LinkInto(ThreadState::FREE_LIST); |
| 176 return true; | 176 return true; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 char* to = state->data(); | 300 char* to = state->data(); |
| 301 // Ensure that data containing GC roots are archived first, and handle them | 301 // Ensure that data containing GC roots are archived first, and handle them |
| 302 // in ThreadManager::Iterate(ObjectVisitor*). | 302 // in ThreadManager::Iterate(ObjectVisitor*). |
| 303 to = isolate_->handle_scope_implementer()->ArchiveThread(to); | 303 to = isolate_->handle_scope_implementer()->ArchiveThread(to); |
| 304 to = isolate_->ArchiveThread(to); | 304 to = isolate_->ArchiveThread(to); |
| 305 to = Relocatable::ArchiveState(to); | 305 to = Relocatable::ArchiveState(to); |
| 306 #ifdef ENABLE_DEBUGGER_SUPPORT | 306 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 307 to = isolate_->debug()->ArchiveDebug(to); | 307 to = isolate_->debug()->ArchiveDebug(to); |
| 308 #endif | 308 #endif |
| 309 to = isolate_->stack_guard()->ArchiveStackGuard(to); | 309 to = isolate_->stack_guard()->ArchiveStackGuard(to); |
| 310 to = RegExpStack::ArchiveStack(to); | 310 to = isolate_->regexp_stack()->ArchiveStack(to); |
| 311 to = isolate_->bootstrapper()->ArchiveState(to); | 311 to = isolate_->bootstrapper()->ArchiveState(to); |
| 312 lazily_archived_thread_.Initialize(ThreadHandle::INVALID); | 312 lazily_archived_thread_.Initialize(ThreadHandle::INVALID); |
| 313 lazily_archived_thread_state_ = NULL; | 313 lazily_archived_thread_state_ = NULL; |
| 314 } | 314 } |
| 315 | 315 |
| 316 | 316 |
| 317 void ThreadManager::FreeThreadResources() { | 317 void ThreadManager::FreeThreadResources() { |
| 318 isolate_->handle_scope_implementer()->FreeThreadResources(); | 318 isolate_->handle_scope_implementer()->FreeThreadResources(); |
| 319 isolate_->FreeThreadResources(); | 319 isolate_->FreeThreadResources(); |
| 320 #ifdef ENABLE_DEBUGGER_SUPPORT | 320 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 321 isolate_->debug()->FreeThreadResources(); | 321 isolate_->debug()->FreeThreadResources(); |
| 322 #endif | 322 #endif |
| 323 isolate_->stack_guard()->FreeThreadResources(); | 323 isolate_->stack_guard()->FreeThreadResources(); |
| 324 RegExpStack::FreeThreadResources(); | 324 isolate_->regexp_stack()->FreeThreadResources(); |
| 325 isolate_->bootstrapper()->FreeThreadResources(); | 325 isolate_->bootstrapper()->FreeThreadResources(); |
| 326 } | 326 } |
| 327 | 327 |
| 328 | 328 |
| 329 bool ThreadManager::IsArchived() { | 329 bool ThreadManager::IsArchived() { |
| 330 return Thread::HasThreadLocal(thread_state_key_); | 330 return Thread::HasThreadLocal(thread_state_key_); |
| 331 } | 331 } |
| 332 | 332 |
| 333 | 333 |
| 334 void ThreadManager::Iterate(ObjectVisitor* v) { | 334 void ThreadManager::Iterate(ObjectVisitor* v) { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 // Acknowledge the preemption by the receiving thread. | 469 // Acknowledge the preemption by the receiving thread. |
| 470 void ContextSwitcher::PreemptionReceived() { | 470 void ContextSwitcher::PreemptionReceived() { |
| 471 ASSERT(Locker::IsLocked()); | 471 ASSERT(Locker::IsLocked()); |
| 472 // There is currently no accounting being done for this. But could be in the | 472 // There is currently no accounting being done for this. But could be in the |
| 473 // future, which is why we leave this in. | 473 // future, which is why we leave this in. |
| 474 } | 474 } |
| 475 | 475 |
| 476 | 476 |
| 477 } // namespace internal | 477 } // namespace internal |
| 478 } // namespace v8 | 478 } // namespace v8 |
| OLD | NEW |