| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/thread.h" | 5 #include "vm/thread.h" |
| 6 | 6 |
| 7 #include "vm/compiler_stats.h" | 7 #include "vm/compiler_stats.h" |
| 8 #include "vm/dart_api_state.h" | 8 #include "vm/dart_api_state.h" |
| 9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| 11 #include "vm/lockers.h" | 11 #include "vm/lockers.h" |
| 12 #include "vm/log.h" | 12 #include "vm/log.h" |
| 13 #include "vm/message_handler.h" | 13 #include "vm/message_handler.h" |
| 14 #include "vm/native_entry.h" | 14 #include "vm/native_entry.h" |
| 15 #include "vm/object.h" | 15 #include "vm/object.h" |
| 16 #include "vm/os_thread.h" | 16 #include "vm/os_thread.h" |
| 17 #include "vm/profiler.h" | 17 #include "vm/profiler.h" |
| 18 #include "vm/runtime_entry.h" | 18 #include "vm/runtime_entry.h" |
| 19 #include "vm/stub_code.h" | 19 #include "vm/stub_code.h" |
| 20 #include "vm/symbols.h" | 20 #include "vm/symbols.h" |
| 21 #include "vm/thread_interrupter.h" | 21 #include "vm/thread_interrupter.h" |
| 22 #include "vm/thread_registry.h" | 22 #include "vm/thread_registry.h" |
| 23 #include "vm/timeline.h" | 23 #include "vm/timeline.h" |
| 24 #include "vm/zone.h" |
| 24 | 25 |
| 25 namespace dart { | 26 namespace dart { |
| 26 | 27 |
| 27 | 28 |
| 28 DECLARE_FLAG(bool, trace_service); | 29 DECLARE_FLAG(bool, trace_service); |
| 29 DECLARE_FLAG(bool, trace_service_verbose); | 30 DECLARE_FLAG(bool, trace_service_verbose); |
| 30 | 31 |
| 31 | 32 |
| 32 Thread::~Thread() { | 33 Thread::~Thread() { |
| 33 // We should cleanly exit any isolate before destruction. | 34 // We should cleanly exit any isolate before destruction. |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 MonitorLocker ml(thread_lock_); | 417 MonitorLocker ml(thread_lock_); |
| 417 if (stack_limit_ == saved_stack_limit_) { | 418 if (stack_limit_ == saved_stack_limit_) { |
| 418 return 0; // No interrupt was requested. | 419 return 0; // No interrupt was requested. |
| 419 } | 420 } |
| 420 uword interrupt_bits = stack_limit_ & kInterruptsMask; | 421 uword interrupt_bits = stack_limit_ & kInterruptsMask; |
| 421 stack_limit_ = saved_stack_limit_; | 422 stack_limit_ = saved_stack_limit_; |
| 422 return interrupt_bits; | 423 return interrupt_bits; |
| 423 } | 424 } |
| 424 | 425 |
| 425 | 426 |
| 427 bool Thread::ZoneIsOwnedByThread(Zone* zone) const { |
| 428 ASSERT(zone != NULL); |
| 429 Zone* current = zone_; |
| 430 while (current != NULL) { |
| 431 if (current == zone) { |
| 432 return true; |
| 433 } |
| 434 current = current->previous(); |
| 435 } |
| 436 return false; |
| 437 } |
| 438 |
| 439 |
| 426 void Thread::DeferOOBMessageInterrupts() { | 440 void Thread::DeferOOBMessageInterrupts() { |
| 427 MonitorLocker ml(thread_lock_); | 441 MonitorLocker ml(thread_lock_); |
| 428 defer_oob_messages_count_++; | 442 defer_oob_messages_count_++; |
| 429 if (defer_oob_messages_count_ > 1) { | 443 if (defer_oob_messages_count_ > 1) { |
| 430 // OOB message interrupts are already deferred. | 444 // OOB message interrupts are already deferred. |
| 431 return; | 445 return; |
| 432 } | 446 } |
| 433 ASSERT(deferred_interrupts_mask_ == 0); | 447 ASSERT(deferred_interrupts_mask_ == 0); |
| 434 deferred_interrupts_mask_ = kMessageInterrupt; | 448 deferred_interrupts_mask_ = kMessageInterrupt; |
| 435 | 449 |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 | 772 |
| 759 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { | 773 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { |
| 760 if (thread() != NULL) { | 774 if (thread() != NULL) { |
| 761 OSThread* os_thread = thread()->os_thread(); | 775 OSThread* os_thread = thread()->os_thread(); |
| 762 ASSERT(os_thread != NULL); | 776 ASSERT(os_thread != NULL); |
| 763 os_thread->EnableThreadInterrupts(); | 777 os_thread->EnableThreadInterrupts(); |
| 764 } | 778 } |
| 765 } | 779 } |
| 766 | 780 |
| 767 } // namespace dart | 781 } // namespace dart |
| OLD | NEW |