| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 EagerlyArchiveThread(); | 149 EagerlyArchiveThread(); |
| 150 } | 150 } |
| 151 ThreadState* state = | 151 ThreadState* state = |
| 152 reinterpret_cast<ThreadState*>(Thread::GetThreadLocal(thread_state_key)); | 152 reinterpret_cast<ThreadState*>(Thread::GetThreadLocal(thread_state_key)); |
| 153 if (state == NULL) { | 153 if (state == NULL) { |
| 154 // This is a new thread. | 154 // This is a new thread. |
| 155 StackGuard::InitThread(access); | 155 StackGuard::InitThread(access); |
| 156 return false; | 156 return false; |
| 157 } | 157 } |
| 158 char* from = state->data(); | 158 char* from = state->data(); |
| 159 printf("Restore from %p\n", (void*)state->data()); |
| 159 from = HandleScopeImplementer::RestoreThread(from); | 160 from = HandleScopeImplementer::RestoreThread(from); |
| 160 from = Top::RestoreThread(from); | 161 from = Top::RestoreThread(from); |
| 161 from = Relocatable::RestoreState(from); | 162 from = Relocatable::RestoreState(from); |
| 162 #ifdef ENABLE_DEBUGGER_SUPPORT | 163 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 163 from = Debug::RestoreDebug(from); | 164 from = Debug::RestoreDebug(from); |
| 164 #endif | 165 #endif |
| 165 from = StackGuard::RestoreStackGuard(from); | 166 from = StackGuard::RestoreStackGuard(from); |
| 166 from = RegExpStack::RestoreStack(from); | 167 from = RegExpStack::RestoreStack(from); |
| 167 from = Bootstrapper::RestoreState(from); | 168 from = Bootstrapper::RestoreState(from); |
| 168 Thread::SetThreadLocal(thread_state_key, NULL); | 169 Thread::SetThreadLocal(thread_state_key, NULL); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 lazily_archived_thread_state_ = state; | 278 lazily_archived_thread_state_ = state; |
| 278 ASSERT(state->id() == kInvalidId); | 279 ASSERT(state->id() == kInvalidId); |
| 279 state->set_id(CurrentId()); | 280 state->set_id(CurrentId()); |
| 280 ASSERT(state->id() != kInvalidId); | 281 ASSERT(state->id() != kInvalidId); |
| 281 } | 282 } |
| 282 | 283 |
| 283 | 284 |
| 284 void ThreadManager::EagerlyArchiveThread() { | 285 void ThreadManager::EagerlyArchiveThread() { |
| 285 ThreadState* state = lazily_archived_thread_state_; | 286 ThreadState* state = lazily_archived_thread_state_; |
| 286 state->LinkInto(ThreadState::IN_USE_LIST); | 287 state->LinkInto(ThreadState::IN_USE_LIST); |
| 288 printf("Archive into %p\n", (void*)state->data()); |
| 287 char* to = state->data(); | 289 char* to = state->data(); |
| 288 // Ensure that data containing GC roots are archived first, and handle them | 290 // Ensure that data containing GC roots are archived first, and handle them |
| 289 // in ThreadManager::Iterate(ObjectVisitor*). | 291 // in ThreadManager::Iterate(ObjectVisitor*). |
| 290 to = HandleScopeImplementer::ArchiveThread(to); | 292 to = HandleScopeImplementer::ArchiveThread(to); |
| 291 to = Top::ArchiveThread(to); | 293 to = Top::ArchiveThread(to); |
| 292 to = Relocatable::ArchiveState(to); | 294 to = Relocatable::ArchiveState(to); |
| 293 #ifdef ENABLE_DEBUGGER_SUPPORT | 295 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 294 to = Debug::ArchiveDebug(to); | 296 to = Debug::ArchiveDebug(to); |
| 295 #endif | 297 #endif |
| 296 to = StackGuard::ArchiveStackGuard(to); | 298 to = StackGuard::ArchiveStackGuard(to); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 317 return Thread::HasThreadLocal(thread_state_key); | 319 return Thread::HasThreadLocal(thread_state_key); |
| 318 } | 320 } |
| 319 | 321 |
| 320 | 322 |
| 321 void ThreadManager::Iterate(ObjectVisitor* v) { | 323 void ThreadManager::Iterate(ObjectVisitor* v) { |
| 322 // Expecting no threads during serialization/deserialization | 324 // Expecting no threads during serialization/deserialization |
| 323 for (ThreadState* state = ThreadState::FirstInUse(); | 325 for (ThreadState* state = ThreadState::FirstInUse(); |
| 324 state != NULL; | 326 state != NULL; |
| 325 state = state->Next()) { | 327 state = state->Next()) { |
| 326 char* data = state->data(); | 328 char* data = state->data(); |
| 329 printf("Iterate over %p\n", (void*)state->data()); |
| 327 data = HandleScopeImplementer::Iterate(v, data); | 330 data = HandleScopeImplementer::Iterate(v, data); |
| 328 data = Top::Iterate(v, data); | 331 data = Top::Iterate(v, data); |
| 329 data = Relocatable::Iterate(v, data); | 332 data = Relocatable::Iterate(v, data); |
| 330 } | 333 } |
| 331 } | 334 } |
| 332 | 335 |
| 333 | 336 |
| 334 void ThreadManager::MarkCompactPrologue(bool is_compacting) { | 337 void ThreadManager::MarkCompactPrologue(bool is_compacting) { |
| 335 for (ThreadState* state = ThreadState::FirstInUse(); | 338 for (ThreadState* state = ThreadState::FirstInUse(); |
| 336 state != NULL; | 339 state != NULL; |
| 337 state = state->Next()) { | 340 state = state->Next()) { |
| 338 char* data = state->data(); | 341 char* data = state->data(); |
| 342 printf("Mark compact prologue %p\n", (void*)state->data()); |
| 339 data += HandleScopeImplementer::ArchiveSpacePerThread(); | 343 data += HandleScopeImplementer::ArchiveSpacePerThread(); |
| 340 Top::MarkCompactPrologue(is_compacting, data); | 344 Top::MarkCompactPrologue(is_compacting, data); |
| 341 } | 345 } |
| 342 } | 346 } |
| 343 | 347 |
| 344 | 348 |
| 345 void ThreadManager::MarkCompactEpilogue(bool is_compacting) { | 349 void ThreadManager::MarkCompactEpilogue(bool is_compacting) { |
| 346 for (ThreadState* state = ThreadState::FirstInUse(); | 350 for (ThreadState* state = ThreadState::FirstInUse(); |
| 347 state != NULL; | 351 state != NULL; |
| 348 state = state->Next()) { | 352 state = state->Next()) { |
| 349 char* data = state->data(); | 353 char* data = state->data(); |
| 354 printf("Mark compact epilogue %p\n", (void*)state->data()); |
| 350 data += HandleScopeImplementer::ArchiveSpacePerThread(); | 355 data += HandleScopeImplementer::ArchiveSpacePerThread(); |
| 351 Top::MarkCompactEpilogue(is_compacting, data); | 356 Top::MarkCompactEpilogue(is_compacting, data); |
| 352 } | 357 } |
| 353 } | 358 } |
| 354 | 359 |
| 355 | 360 |
| 356 int ThreadManager::CurrentId() { | 361 int ThreadManager::CurrentId() { |
| 357 return Thread::GetThreadLocalInt(thread_id_key); | 362 return Thread::GetThreadLocalInt(thread_id_key); |
| 358 } | 363 } |
| 359 | 364 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 // Acknowledge the preemption by the receiving thread. | 446 // Acknowledge the preemption by the receiving thread. |
| 442 void ContextSwitcher::PreemptionReceived() { | 447 void ContextSwitcher::PreemptionReceived() { |
| 443 ASSERT(Locker::IsLocked()); | 448 ASSERT(Locker::IsLocked()); |
| 444 // There is currently no accounting being done for this. But could be in the | 449 // There is currently no accounting being done for this. But could be in the |
| 445 // future, which is why we leave this in. | 450 // future, which is why we leave this in. |
| 446 } | 451 } |
| 447 | 452 |
| 448 | 453 |
| 449 } // namespace internal | 454 } // namespace internal |
| 450 } // namespace v8 | 455 } // namespace v8 |
| OLD | NEW |