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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // had prepared back in the free list, since we didn't need it after all. | 113 // had prepared back in the free list, since we didn't need it after all. |
114 if (lazily_archived_thread_.IsSelf()) { | 114 if (lazily_archived_thread_.IsSelf()) { |
115 lazily_archived_thread_.Initialize(ThreadHandle::INVALID); | 115 lazily_archived_thread_.Initialize(ThreadHandle::INVALID); |
116 ASSERT(Thread::GetThreadLocal(thread_state_key) == | 116 ASSERT(Thread::GetThreadLocal(thread_state_key) == |
117 lazily_archived_thread_state_); | 117 lazily_archived_thread_state_); |
118 lazily_archived_thread_state_->LinkInto(ThreadState::FREE_LIST); | 118 lazily_archived_thread_state_->LinkInto(ThreadState::FREE_LIST); |
119 lazily_archived_thread_state_ = NULL; | 119 lazily_archived_thread_state_ = NULL; |
120 Thread::SetThreadLocal(thread_state_key, NULL); | 120 Thread::SetThreadLocal(thread_state_key, NULL); |
121 return true; | 121 return true; |
122 } | 122 } |
123 | 123 |
124 // Make sure that the preemption thread cannot modify the thread state while | 124 // Make sure that the preemption thread cannot modify the thread state while |
125 // it is being archived or restored. | 125 // it is being archived or restored. |
126 ExecutionAccess access; | 126 ExecutionAccess access; |
127 | 127 |
128 // If there is another thread that was lazily archived then we have to really | 128 // If there is another thread that was lazily archived then we have to really |
129 // archive it now. | 129 // archive it now. |
130 if (lazily_archived_thread_.IsValid()) { | 130 if (lazily_archived_thread_.IsValid()) { |
131 EagerlyArchiveThread(); | 131 EagerlyArchiveThread(); |
132 } | 132 } |
133 ThreadState* state = | 133 ThreadState* state = |
134 reinterpret_cast<ThreadState*>(Thread::GetThreadLocal(thread_state_key)); | 134 reinterpret_cast<ThreadState*>(Thread::GetThreadLocal(thread_state_key)); |
135 if (state == NULL) { | 135 if (state == NULL) { |
136 return false; | 136 return false; |
137 } | 137 } |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 // Acknowledge the preemption by the receiving thread. | 346 // Acknowledge the preemption by the receiving thread. |
347 void ContextSwitcher::PreemptionReceived() { | 347 void ContextSwitcher::PreemptionReceived() { |
348 ASSERT(Locker::IsLocked()); | 348 ASSERT(Locker::IsLocked()); |
349 // There is currently no accounting being done for this. But could be in the | 349 // There is currently no accounting being done for this. But could be in the |
350 // future, which is why we leave this in. | 350 // future, which is why we leave this in. |
351 } | 351 } |
352 | 352 |
353 | 353 |
354 } // namespace internal | 354 } // namespace internal |
355 } // namespace v8 | 355 } // namespace v8 |
OLD | NEW |