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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 | 71 |
72 bool Locker::IsLocked() { | 72 bool Locker::IsLocked() { |
73 return internal::ThreadManager::IsLockedByCurrentThread(); | 73 return internal::ThreadManager::IsLockedByCurrentThread(); |
74 } | 74 } |
75 | 75 |
76 | 76 |
77 Locker::~Locker() { | 77 Locker::~Locker() { |
78 ASSERT(internal::ThreadManager::IsLockedByCurrentThread()); | 78 ASSERT(internal::ThreadManager::IsLockedByCurrentThread()); |
79 if (has_lock_) { | 79 if (has_lock_) { |
80 if (!top_level_) { | 80 if (top_level_) { |
| 81 internal::ThreadManager::FreeThreadResources(); |
| 82 } else { |
81 internal::ThreadManager::ArchiveThread(); | 83 internal::ThreadManager::ArchiveThread(); |
82 } | 84 } |
83 internal::ThreadManager::Unlock(); | 85 internal::ThreadManager::Unlock(); |
84 } | 86 } |
85 } | 87 } |
86 | 88 |
87 | 89 |
88 Unlocker::Unlocker() { | 90 Unlocker::Unlocker() { |
89 ASSERT(internal::ThreadManager::IsLockedByCurrentThread()); | 91 ASSERT(internal::ThreadManager::IsLockedByCurrentThread()); |
90 internal::ThreadManager::ArchiveThread(); | 92 internal::ThreadManager::ArchiveThread(); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 to = Debug::ArchiveDebug(to); | 279 to = Debug::ArchiveDebug(to); |
278 #endif | 280 #endif |
279 to = StackGuard::ArchiveStackGuard(to); | 281 to = StackGuard::ArchiveStackGuard(to); |
280 to = RegExpStack::ArchiveStack(to); | 282 to = RegExpStack::ArchiveStack(to); |
281 to = Bootstrapper::ArchiveState(to); | 283 to = Bootstrapper::ArchiveState(to); |
282 lazily_archived_thread_.Initialize(ThreadHandle::INVALID); | 284 lazily_archived_thread_.Initialize(ThreadHandle::INVALID); |
283 lazily_archived_thread_state_ = NULL; | 285 lazily_archived_thread_state_ = NULL; |
284 } | 286 } |
285 | 287 |
286 | 288 |
| 289 void ThreadManager::FreeThreadResources() { |
| 290 HandleScopeImplementer::FreeThreadResources(); |
| 291 Top::FreeThreadResources(); |
| 292 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 293 Debug::FreeThreadResources(); |
| 294 #endif |
| 295 StackGuard::FreeThreadResources(); |
| 296 RegExpStack::FreeThreadResources(); |
| 297 Bootstrapper::FreeThreadResources(); |
| 298 } |
| 299 |
| 300 |
287 bool ThreadManager::IsArchived() { | 301 bool ThreadManager::IsArchived() { |
288 return Thread::HasThreadLocal(thread_state_key); | 302 return Thread::HasThreadLocal(thread_state_key); |
289 } | 303 } |
290 | 304 |
291 | 305 |
292 void ThreadManager::Iterate(ObjectVisitor* v) { | 306 void ThreadManager::Iterate(ObjectVisitor* v) { |
293 // Expecting no threads during serialization/deserialization | 307 // Expecting no threads during serialization/deserialization |
294 for (ThreadState* state = ThreadState::FirstInUse(); | 308 for (ThreadState* state = ThreadState::FirstInUse(); |
295 state != NULL; | 309 state != NULL; |
296 state = state->Next()) { | 310 state = state->Next()) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 // Acknowledge the preemption by the receiving thread. | 425 // Acknowledge the preemption by the receiving thread. |
412 void ContextSwitcher::PreemptionReceived() { | 426 void ContextSwitcher::PreemptionReceived() { |
413 ASSERT(Locker::IsLocked()); | 427 ASSERT(Locker::IsLocked()); |
414 // There is currently no accounting being done for this. But could be in the | 428 // There is currently no accounting being done for this. But could be in the |
415 // future, which is why we leave this in. | 429 // future, which is why we leave this in. |
416 } | 430 } |
417 | 431 |
418 | 432 |
419 } // namespace internal | 433 } // namespace internal |
420 } // namespace v8 | 434 } // namespace v8 |
OLD | NEW |