| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 ASSERT(IsLockedByCurrentThread()); | 220 ASSERT(IsLockedByCurrentThread()); |
| 221 } | 221 } |
| 222 | 222 |
| 223 | 223 |
| 224 void ThreadManager::Unlock() { | 224 void ThreadManager::Unlock() { |
| 225 mutex_owner_ = ThreadId::Invalid(); | 225 mutex_owner_ = ThreadId::Invalid(); |
| 226 mutex_.Unlock(); | 226 mutex_.Unlock(); |
| 227 } | 227 } |
| 228 | 228 |
| 229 | 229 |
| 230 static int ArchiveSpacePerThread(Isolate* isolate) { | 230 static int ArchiveSpacePerThread() { |
| 231 return HandleScopeImplementer::ArchiveSpacePerThread() + | 231 return HandleScopeImplementer::ArchiveSpacePerThread() + |
| 232 Isolate::ArchiveSpacePerThread() + | 232 Isolate::ArchiveSpacePerThread() + |
| 233 #ifdef ENABLE_DEBUGGER_SUPPORT | 233 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 234 Debug::ArchiveSpacePerThread() + | 234 Debug::ArchiveSpacePerThread() + |
| 235 #endif | 235 #endif |
| 236 StackGuard::ArchiveSpacePerThread() + | 236 StackGuard::ArchiveSpacePerThread() + |
| 237 RegExpStack::ArchiveSpacePerThread() + | 237 RegExpStack::ArchiveSpacePerThread() + |
| 238 Bootstrapper::ArchiveSpacePerThread() + | 238 Bootstrapper::ArchiveSpacePerThread() + |
| 239 Relocatable::ArchiveSpacePerThread(isolate); | 239 Relocatable::ArchiveSpacePerThread(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 | 242 |
| 243 ThreadState::ThreadState(ThreadManager* thread_manager) | 243 ThreadState::ThreadState(ThreadManager* thread_manager) |
| 244 : id_(ThreadId::Invalid()), | 244 : id_(ThreadId::Invalid()), |
| 245 terminate_on_restore_(false), | 245 terminate_on_restore_(false), |
| 246 data_(NULL), | 246 data_(NULL), |
| 247 next_(this), | 247 next_(this), |
| 248 previous_(this), | 248 previous_(this), |
| 249 thread_manager_(thread_manager) { | 249 thread_manager_(thread_manager) { |
| 250 } | 250 } |
| 251 | 251 |
| 252 | 252 |
| 253 ThreadState::~ThreadState() { | 253 ThreadState::~ThreadState() { |
| 254 DeleteArray<char>(data_); | 254 DeleteArray<char>(data_); |
| 255 } | 255 } |
| 256 | 256 |
| 257 | 257 |
| 258 void ThreadState::AllocateSpace() { | 258 void ThreadState::AllocateSpace() { |
| 259 data_ = NewArray<char>(ArchiveSpacePerThread(Isolate::Current())); | 259 data_ = NewArray<char>(ArchiveSpacePerThread()); |
| 260 } | 260 } |
| 261 | 261 |
| 262 | 262 |
| 263 void ThreadState::Unlink() { | 263 void ThreadState::Unlink() { |
| 264 next_->previous_ = previous_; | 264 next_->previous_ = previous_; |
| 265 previous_->next_ = next_; | 265 previous_->next_ = next_; |
| 266 } | 266 } |
| 267 | 267 |
| 268 | 268 |
| 269 void ThreadState::LinkInto(List list) { | 269 void ThreadState::LinkInto(List list) { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 | 389 |
| 390 | 390 |
| 391 void ThreadManager::Iterate(ObjectVisitor* v) { | 391 void ThreadManager::Iterate(ObjectVisitor* v) { |
| 392 // Expecting no threads during serialization/deserialization | 392 // Expecting no threads during serialization/deserialization |
| 393 for (ThreadState* state = FirstThreadStateInUse(); | 393 for (ThreadState* state = FirstThreadStateInUse(); |
| 394 state != NULL; | 394 state != NULL; |
| 395 state = state->Next()) { | 395 state = state->Next()) { |
| 396 char* data = state->data(); | 396 char* data = state->data(); |
| 397 data = HandleScopeImplementer::Iterate(v, data); | 397 data = HandleScopeImplementer::Iterate(v, data); |
| 398 data = isolate_->Iterate(v, data); | 398 data = isolate_->Iterate(v, data); |
| 399 data = Relocatable::Iterate(Isolate::Current(), v, data); | 399 data = Relocatable::Iterate(v, data); |
| 400 } | 400 } |
| 401 } | 401 } |
| 402 | 402 |
| 403 | 403 |
| 404 void ThreadManager::IterateArchivedThreads(ThreadVisitor* v) { | 404 void ThreadManager::IterateArchivedThreads(ThreadVisitor* v) { |
| 405 for (ThreadState* state = FirstThreadStateInUse(); | 405 for (ThreadState* state = FirstThreadStateInUse(); |
| 406 state != NULL; | 406 state != NULL; |
| 407 state = state->Next()) { | 407 state = state->Next()) { |
| 408 char* data = state->data(); | 408 char* data = state->data(); |
| 409 data += HandleScopeImplementer::ArchiveSpacePerThread(); | 409 data += HandleScopeImplementer::ArchiveSpacePerThread(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 // Acknowledge the preemption by the receiving thread. | 482 // Acknowledge the preemption by the receiving thread. |
| 483 void ContextSwitcher::PreemptionReceived() { | 483 void ContextSwitcher::PreemptionReceived() { |
| 484 ASSERT(Locker::IsLocked(i::Isolate::GetDefaultIsolateForLocking())); | 484 ASSERT(Locker::IsLocked(i::Isolate::GetDefaultIsolateForLocking())); |
| 485 // There is currently no accounting being done for this. But could be in the | 485 // There is currently no accounting being done for this. But could be in the |
| 486 // future, which is why we leave this in. | 486 // future, which is why we leave this in. |
| 487 } | 487 } |
| 488 | 488 |
| 489 | 489 |
| 490 } // namespace internal | 490 } // namespace internal |
| 491 } // namespace v8 | 491 } // namespace v8 |
| OLD | NEW |