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