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" |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 | 503 |
504 // Clear deferrable interrupts, if present. | 504 // Clear deferrable interrupts, if present. |
505 stack_limit_ &= ~deferred_interrupts_mask_; | 505 stack_limit_ &= ~deferred_interrupts_mask_; |
506 | 506 |
507 if ((stack_limit_ & kInterruptsMask) == 0) { | 507 if ((stack_limit_ & kInterruptsMask) == 0) { |
508 // No other pending interrupts. Restore normal stack limit. | 508 // No other pending interrupts. Restore normal stack limit. |
509 stack_limit_ = saved_stack_limit_; | 509 stack_limit_ = saved_stack_limit_; |
510 } | 510 } |
511 } | 511 } |
512 if (FLAG_trace_service && FLAG_trace_service_verbose) { | 512 if (FLAG_trace_service && FLAG_trace_service_verbose) { |
513 OS::Print("[+%" Pd64 "ms] Isolate %s deferring OOB interrupts\n", | 513 OS::PrintErr("[+%" Pd64 "ms] Isolate %s deferring OOB interrupts\n", |
514 Dart::UptimeMillis(), isolate()->name()); | 514 Dart::UptimeMillis(), isolate()->name()); |
515 } | 515 } |
516 } | 516 } |
517 | 517 |
518 void Thread::RestoreOOBMessageInterrupts() { | 518 void Thread::RestoreOOBMessageInterrupts() { |
519 MonitorLocker ml(thread_lock_); | 519 MonitorLocker ml(thread_lock_); |
520 defer_oob_messages_count_--; | 520 defer_oob_messages_count_--; |
521 if (defer_oob_messages_count_ > 0) { | 521 if (defer_oob_messages_count_ > 0) { |
522 return; | 522 return; |
523 } | 523 } |
524 ASSERT(defer_oob_messages_count_ == 0); | 524 ASSERT(defer_oob_messages_count_ == 0); |
525 ASSERT(deferred_interrupts_mask_ == kMessageInterrupt); | 525 ASSERT(deferred_interrupts_mask_ == kMessageInterrupt); |
526 deferred_interrupts_mask_ = 0; | 526 deferred_interrupts_mask_ = 0; |
527 if (deferred_interrupts_ != 0) { | 527 if (deferred_interrupts_ != 0) { |
528 if (stack_limit_ == saved_stack_limit_) { | 528 if (stack_limit_ == saved_stack_limit_) { |
529 stack_limit_ = kInterruptStackLimit & ~kInterruptsMask; | 529 stack_limit_ = kInterruptStackLimit & ~kInterruptsMask; |
530 } | 530 } |
531 stack_limit_ |= deferred_interrupts_; | 531 stack_limit_ |= deferred_interrupts_; |
532 deferred_interrupts_ = 0; | 532 deferred_interrupts_ = 0; |
533 } | 533 } |
534 if (FLAG_trace_service && FLAG_trace_service_verbose) { | 534 if (FLAG_trace_service && FLAG_trace_service_verbose) { |
535 OS::Print("[+%" Pd64 "ms] Isolate %s restoring OOB interrupts\n", | 535 OS::PrintErr("[+%" Pd64 "ms] Isolate %s restoring OOB interrupts\n", |
536 Dart::UptimeMillis(), isolate()->name()); | 536 Dart::UptimeMillis(), isolate()->name()); |
537 } | 537 } |
538 } | 538 } |
539 | 539 |
540 RawError* Thread::HandleInterrupts() { | 540 RawError* Thread::HandleInterrupts() { |
541 uword interrupt_bits = GetAndClearInterrupts(); | 541 uword interrupt_bits = GetAndClearInterrupts(); |
542 if ((interrupt_bits & kVMInterrupt) != 0) { | 542 if ((interrupt_bits & kVMInterrupt) != 0) { |
543 if (isolate()->store_buffer()->Overflowed()) { | 543 if (isolate()->store_buffer()->Overflowed()) { |
544 if (FLAG_verbose_gc) { | 544 if (FLAG_verbose_gc) { |
545 OS::PrintErr("Scavenge scheduled by store buffer overflow.\n"); | 545 OS::PrintErr("Scavenge scheduled by store buffer overflow.\n"); |
546 } | 546 } |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 | 859 |
860 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { | 860 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { |
861 if (thread() != NULL) { | 861 if (thread() != NULL) { |
862 OSThread* os_thread = thread()->os_thread(); | 862 OSThread* os_thread = thread()->os_thread(); |
863 ASSERT(os_thread != NULL); | 863 ASSERT(os_thread != NULL); |
864 os_thread->EnableThreadInterrupts(); | 864 os_thread->EnableThreadInterrupts(); |
865 } | 865 } |
866 } | 866 } |
867 | 867 |
868 } // namespace dart | 868 } // namespace dart |
OLD | NEW |