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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 EagerlyArchiveThread(); | 139 EagerlyArchiveThread(); |
140 } | 140 } |
141 ThreadState* state = | 141 ThreadState* state = |
142 reinterpret_cast<ThreadState*>(Thread::GetThreadLocal(thread_state_key)); | 142 reinterpret_cast<ThreadState*>(Thread::GetThreadLocal(thread_state_key)); |
143 if (state == NULL) { | 143 if (state == NULL) { |
144 return false; | 144 return false; |
145 } | 145 } |
146 char* from = state->data(); | 146 char* from = state->data(); |
147 from = HandleScopeImplementer::RestoreThread(from); | 147 from = HandleScopeImplementer::RestoreThread(from); |
148 from = Top::RestoreThread(from); | 148 from = Top::RestoreThread(from); |
| 149 from = Relocatable::RestoreState(from); |
149 #ifdef ENABLE_DEBUGGER_SUPPORT | 150 #ifdef ENABLE_DEBUGGER_SUPPORT |
150 from = Debug::RestoreDebug(from); | 151 from = Debug::RestoreDebug(from); |
151 #endif | 152 #endif |
152 from = StackGuard::RestoreStackGuard(from); | 153 from = StackGuard::RestoreStackGuard(from); |
153 from = RegExpStack::RestoreStack(from); | 154 from = RegExpStack::RestoreStack(from); |
154 from = Bootstrapper::RestoreState(from); | 155 from = Bootstrapper::RestoreState(from); |
155 Thread::SetThreadLocal(thread_state_key, NULL); | 156 Thread::SetThreadLocal(thread_state_key, NULL); |
156 if (state->terminate_on_restore()) { | 157 if (state->terminate_on_restore()) { |
157 StackGuard::TerminateExecution(); | 158 StackGuard::TerminateExecution(); |
158 state->set_terminate_on_restore(false); | 159 state->set_terminate_on_restore(false); |
(...skipping 19 matching lines...) Expand all Loading... |
178 | 179 |
179 | 180 |
180 static int ArchiveSpacePerThread() { | 181 static int ArchiveSpacePerThread() { |
181 return HandleScopeImplementer::ArchiveSpacePerThread() + | 182 return HandleScopeImplementer::ArchiveSpacePerThread() + |
182 Top::ArchiveSpacePerThread() + | 183 Top::ArchiveSpacePerThread() + |
183 #ifdef ENABLE_DEBUGGER_SUPPORT | 184 #ifdef ENABLE_DEBUGGER_SUPPORT |
184 Debug::ArchiveSpacePerThread() + | 185 Debug::ArchiveSpacePerThread() + |
185 #endif | 186 #endif |
186 StackGuard::ArchiveSpacePerThread() + | 187 StackGuard::ArchiveSpacePerThread() + |
187 RegExpStack::ArchiveSpacePerThread() + | 188 RegExpStack::ArchiveSpacePerThread() + |
188 Bootstrapper::ArchiveSpacePerThread(); | 189 Bootstrapper::ArchiveSpacePerThread() + |
| 190 Relocatable::ArchiveSpacePerThread(); |
189 } | 191 } |
190 | 192 |
191 | 193 |
192 ThreadState* ThreadState::free_anchor_ = new ThreadState(); | 194 ThreadState* ThreadState::free_anchor_ = new ThreadState(); |
193 ThreadState* ThreadState::in_use_anchor_ = new ThreadState(); | 195 ThreadState* ThreadState::in_use_anchor_ = new ThreadState(); |
194 | 196 |
195 | 197 |
196 ThreadState::ThreadState() : id_(ThreadManager::kInvalidId), | 198 ThreadState::ThreadState() : id_(ThreadManager::kInvalidId), |
197 terminate_on_restore_(false), | 199 terminate_on_restore_(false), |
198 next_(this), previous_(this) { | 200 next_(this), previous_(this) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 270 |
269 | 271 |
270 void ThreadManager::EagerlyArchiveThread() { | 272 void ThreadManager::EagerlyArchiveThread() { |
271 ThreadState* state = lazily_archived_thread_state_; | 273 ThreadState* state = lazily_archived_thread_state_; |
272 state->LinkInto(ThreadState::IN_USE_LIST); | 274 state->LinkInto(ThreadState::IN_USE_LIST); |
273 char* to = state->data(); | 275 char* to = state->data(); |
274 // Ensure that data containing GC roots are archived first, and handle them | 276 // Ensure that data containing GC roots are archived first, and handle them |
275 // in ThreadManager::Iterate(ObjectVisitor*). | 277 // in ThreadManager::Iterate(ObjectVisitor*). |
276 to = HandleScopeImplementer::ArchiveThread(to); | 278 to = HandleScopeImplementer::ArchiveThread(to); |
277 to = Top::ArchiveThread(to); | 279 to = Top::ArchiveThread(to); |
| 280 to = Relocatable::ArchiveState(to); |
278 #ifdef ENABLE_DEBUGGER_SUPPORT | 281 #ifdef ENABLE_DEBUGGER_SUPPORT |
279 to = Debug::ArchiveDebug(to); | 282 to = Debug::ArchiveDebug(to); |
280 #endif | 283 #endif |
281 to = StackGuard::ArchiveStackGuard(to); | 284 to = StackGuard::ArchiveStackGuard(to); |
282 to = RegExpStack::ArchiveStack(to); | 285 to = RegExpStack::ArchiveStack(to); |
283 to = Bootstrapper::ArchiveState(to); | 286 to = Bootstrapper::ArchiveState(to); |
284 lazily_archived_thread_.Initialize(ThreadHandle::INVALID); | 287 lazily_archived_thread_.Initialize(ThreadHandle::INVALID); |
285 lazily_archived_thread_state_ = NULL; | 288 lazily_archived_thread_state_ = NULL; |
286 } | 289 } |
287 | 290 |
(...skipping 16 matching lines...) Expand all Loading... |
304 | 307 |
305 | 308 |
306 void ThreadManager::Iterate(ObjectVisitor* v) { | 309 void ThreadManager::Iterate(ObjectVisitor* v) { |
307 // Expecting no threads during serialization/deserialization | 310 // Expecting no threads during serialization/deserialization |
308 for (ThreadState* state = ThreadState::FirstInUse(); | 311 for (ThreadState* state = ThreadState::FirstInUse(); |
309 state != NULL; | 312 state != NULL; |
310 state = state->Next()) { | 313 state = state->Next()) { |
311 char* data = state->data(); | 314 char* data = state->data(); |
312 data = HandleScopeImplementer::Iterate(v, data); | 315 data = HandleScopeImplementer::Iterate(v, data); |
313 data = Top::Iterate(v, data); | 316 data = Top::Iterate(v, data); |
| 317 data = Relocatable::Iterate(v, data); |
314 } | 318 } |
315 } | 319 } |
316 | 320 |
317 | 321 |
318 void ThreadManager::MarkCompactPrologue(bool is_compacting) { | 322 void ThreadManager::MarkCompactPrologue(bool is_compacting) { |
319 for (ThreadState* state = ThreadState::FirstInUse(); | 323 for (ThreadState* state = ThreadState::FirstInUse(); |
320 state != NULL; | 324 state != NULL; |
321 state = state->Next()) { | 325 state = state->Next()) { |
322 char* data = state->data(); | 326 char* data = state->data(); |
323 data += HandleScopeImplementer::ArchiveSpacePerThread(); | 327 data += HandleScopeImplementer::ArchiveSpacePerThread(); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 // Acknowledge the preemption by the receiving thread. | 429 // Acknowledge the preemption by the receiving thread. |
426 void ContextSwitcher::PreemptionReceived() { | 430 void ContextSwitcher::PreemptionReceived() { |
427 ASSERT(Locker::IsLocked()); | 431 ASSERT(Locker::IsLocked()); |
428 // There is currently no accounting being done for this. But could be in the | 432 // There is currently no accounting being done for this. But could be in the |
429 // future, which is why we leave this in. | 433 // future, which is why we leave this in. |
430 } | 434 } |
431 | 435 |
432 | 436 |
433 } // namespace internal | 437 } // namespace internal |
434 } // namespace v8 | 438 } // namespace v8 |
OLD | NEW |