| 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 state != NULL; | 383 state != NULL; |
| 384 state = state->Next()) { | 384 state = state->Next()) { |
| 385 if (thread_id == state->id()) { | 385 if (thread_id == state->id()) { |
| 386 state->set_terminate_on_restore(true); | 386 state->set_terminate_on_restore(true); |
| 387 } | 387 } |
| 388 } | 388 } |
| 389 } | 389 } |
| 390 | 390 |
| 391 | 391 |
| 392 ContextSwitcher::ContextSwitcher(Isolate* isolate, int every_n_ms) | 392 ContextSwitcher::ContextSwitcher(Isolate* isolate, int every_n_ms) |
| 393 : Thread(isolate), | 393 : Thread(isolate, "v8:CtxtSwitcher"), |
| 394 keep_going_(true), | 394 keep_going_(true), |
| 395 sleep_ms_(every_n_ms) { | 395 sleep_ms_(every_n_ms) { |
| 396 } | 396 } |
| 397 | 397 |
| 398 | 398 |
| 399 // Set the scheduling interval of V8 threads. This function starts the | 399 // Set the scheduling interval of V8 threads. This function starts the |
| 400 // ContextSwitcher thread if needed. | 400 // ContextSwitcher thread if needed. |
| 401 void ContextSwitcher::StartPreemption(int every_n_ms) { | 401 void ContextSwitcher::StartPreemption(int every_n_ms) { |
| 402 Isolate* isolate = Isolate::Current(); | 402 Isolate* isolate = Isolate::Current(); |
| 403 ASSERT(Locker::IsLocked()); | 403 ASSERT(Locker::IsLocked()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 // Acknowledge the preemption by the receiving thread. | 444 // Acknowledge the preemption by the receiving thread. |
| 445 void ContextSwitcher::PreemptionReceived() { | 445 void ContextSwitcher::PreemptionReceived() { |
| 446 ASSERT(Locker::IsLocked()); | 446 ASSERT(Locker::IsLocked()); |
| 447 // There is currently no accounting being done for this. But could be in the | 447 // There is currently no accounting being done for this. But could be in the |
| 448 // future, which is why we leave this in. | 448 // future, which is why we leave this in. |
| 449 } | 449 } |
| 450 | 450 |
| 451 | 451 |
| 452 } // namespace internal | 452 } // namespace internal |
| 453 } // namespace v8 | 453 } // namespace v8 |
| OLD | NEW |