| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 } | 157 } |
| 158 char* from = state->data(); | 158 char* from = state->data(); |
| 159 from = HandleScopeImplementer::RestoreThread(from); | 159 from = HandleScopeImplementer::RestoreThread(from); |
| 160 from = Top::RestoreThread(from); | 160 from = Top::RestoreThread(from); |
| 161 from = Relocatable::RestoreState(from); | 161 from = Relocatable::RestoreState(from); |
| 162 #ifdef ENABLE_DEBUGGER_SUPPORT | 162 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 163 from = Debug::RestoreDebug(from); | 163 from = Debug::RestoreDebug(from); |
| 164 #endif | 164 #endif |
| 165 from = StackGuard::RestoreStackGuard(from); | 165 from = StackGuard::RestoreStackGuard(from); |
| 166 from = RegExpStack::RestoreStack(from); | 166 from = RegExpStack::RestoreStack(from); |
| 167 from = Bootstrapper::RestoreState(from); | 167 from = Isolate::Current()->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 StackGuard::TerminateExecution(); | 170 StackGuard::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; |
| 177 } | 177 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 191 | 191 |
| 192 | 192 |
| 193 static int ArchiveSpacePerThread() { | 193 static int ArchiveSpacePerThread() { |
| 194 return HandleScopeImplementer::ArchiveSpacePerThread() + | 194 return HandleScopeImplementer::ArchiveSpacePerThread() + |
| 195 Top::ArchiveSpacePerThread() + | 195 Top::ArchiveSpacePerThread() + |
| 196 #ifdef ENABLE_DEBUGGER_SUPPORT | 196 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 197 Debug::ArchiveSpacePerThread() + | 197 Debug::ArchiveSpacePerThread() + |
| 198 #endif | 198 #endif |
| 199 StackGuard::ArchiveSpacePerThread() + | 199 StackGuard::ArchiveSpacePerThread() + |
| 200 RegExpStack::ArchiveSpacePerThread() + | 200 RegExpStack::ArchiveSpacePerThread() + |
| 201 Bootstrapper::ArchiveSpacePerThread() + | 201 Isolate::Current()->bootstrapper()-> |
| 202 ArchiveSpacePerThread() + |
| 202 Relocatable::ArchiveSpacePerThread(); | 203 Relocatable::ArchiveSpacePerThread(); |
| 203 } | 204 } |
| 204 | 205 |
| 205 | 206 |
| 206 ThreadState* ThreadState::free_anchor_ = new ThreadState(); | 207 ThreadState* ThreadState::free_anchor_ = new ThreadState(); |
| 207 ThreadState* ThreadState::in_use_anchor_ = new ThreadState(); | 208 ThreadState* ThreadState::in_use_anchor_ = new ThreadState(); |
| 208 | 209 |
| 209 | 210 |
| 210 ThreadState::ThreadState() : id_(ThreadManager::kInvalidId), | 211 ThreadState::ThreadState() : id_(ThreadManager::kInvalidId), |
| 211 terminate_on_restore_(false), | 212 terminate_on_restore_(false), |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 // Ensure that data containing GC roots are archived first, and handle them | 289 // Ensure that data containing GC roots are archived first, and handle them |
| 289 // in ThreadManager::Iterate(ObjectVisitor*). | 290 // in ThreadManager::Iterate(ObjectVisitor*). |
| 290 to = HandleScopeImplementer::ArchiveThread(to); | 291 to = HandleScopeImplementer::ArchiveThread(to); |
| 291 to = Top::ArchiveThread(to); | 292 to = Top::ArchiveThread(to); |
| 292 to = Relocatable::ArchiveState(to); | 293 to = Relocatable::ArchiveState(to); |
| 293 #ifdef ENABLE_DEBUGGER_SUPPORT | 294 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 294 to = Debug::ArchiveDebug(to); | 295 to = Debug::ArchiveDebug(to); |
| 295 #endif | 296 #endif |
| 296 to = StackGuard::ArchiveStackGuard(to); | 297 to = StackGuard::ArchiveStackGuard(to); |
| 297 to = RegExpStack::ArchiveStack(to); | 298 to = RegExpStack::ArchiveStack(to); |
| 298 to = Bootstrapper::ArchiveState(to); | 299 to = Isolate::Current()->bootstrapper()->ArchiveState(to); |
| 299 lazily_archived_thread_.Initialize(ThreadHandle::INVALID); | 300 lazily_archived_thread_.Initialize(ThreadHandle::INVALID); |
| 300 lazily_archived_thread_state_ = NULL; | 301 lazily_archived_thread_state_ = NULL; |
| 301 } | 302 } |
| 302 | 303 |
| 303 | 304 |
| 304 void ThreadManager::FreeThreadResources() { | 305 void ThreadManager::FreeThreadResources() { |
| 305 HandleScopeImplementer::FreeThreadResources(); | 306 HandleScopeImplementer::FreeThreadResources(); |
| 306 Top::FreeThreadResources(); | 307 Top::FreeThreadResources(); |
| 307 #ifdef ENABLE_DEBUGGER_SUPPORT | 308 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 308 Debug::FreeThreadResources(); | 309 Debug::FreeThreadResources(); |
| 309 #endif | 310 #endif |
| 310 StackGuard::FreeThreadResources(); | 311 StackGuard::FreeThreadResources(); |
| 311 RegExpStack::FreeThreadResources(); | 312 RegExpStack::FreeThreadResources(); |
| 312 Bootstrapper::FreeThreadResources(); | 313 Isolate::Current()->bootstrapper()->FreeThreadResources(); |
| 313 } | 314 } |
| 314 | 315 |
| 315 | 316 |
| 316 bool ThreadManager::IsArchived() { | 317 bool ThreadManager::IsArchived() { |
| 317 return Thread::HasThreadLocal(thread_state_key); | 318 return Thread::HasThreadLocal(thread_state_key); |
| 318 } | 319 } |
| 319 | 320 |
| 320 | 321 |
| 321 void ThreadManager::Iterate(ObjectVisitor* v) { | 322 void ThreadManager::Iterate(ObjectVisitor* v) { |
| 322 // Expecting no threads during serialization/deserialization | 323 // Expecting no threads during serialization/deserialization |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 // Acknowledge the preemption by the receiving thread. | 453 // Acknowledge the preemption by the receiving thread. |
| 453 void ContextSwitcher::PreemptionReceived() { | 454 void ContextSwitcher::PreemptionReceived() { |
| 454 ASSERT(Locker::IsLocked()); | 455 ASSERT(Locker::IsLocked()); |
| 455 // There is currently no accounting being done for this. But could be in the | 456 // There is currently no accounting being done for this. But could be in the |
| 456 // future, which is why we leave this in. | 457 // future, which is why we leave this in. |
| 457 } | 458 } |
| 458 | 459 |
| 459 | 460 |
| 460 } // namespace internal | 461 } // namespace internal |
| 461 } // namespace v8 | 462 } // namespace v8 |
| OLD | NEW |