OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "execution.h" | 5 #include "execution.h" |
6 | 6 |
7 #include "bootstrapper.h" | 7 #include "bootstrapper.h" |
8 #include "codegen.h" | 8 #include "codegen.h" |
9 #include "deoptimizer.h" | 9 #include "deoptimizer.h" |
10 #include "isolate-inl.h" | 10 #include "isolate-inl.h" |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 if (debugger.FailedToEnter()) return; | 706 if (debugger.FailedToEnter()) return; |
707 | 707 |
708 // Notify the debug event listeners. Indicate auto continue if the break was | 708 // Notify the debug event listeners. Indicate auto continue if the break was |
709 // a debug command break. | 709 // a debug command break. |
710 isolate->debugger()->OnDebugBreak(isolate->factory()->undefined_value(), | 710 isolate->debugger()->OnDebugBreak(isolate->factory()->undefined_value(), |
711 debug_command_only); | 711 debug_command_only); |
712 } | 712 } |
713 | 713 |
714 | 714 |
715 Object* StackGuard::HandleInterrupts() { | 715 Object* StackGuard::HandleInterrupts() { |
716 ExecutionAccess access(isolate_); | 716 bool has_api_interrupt = false; |
717 if (should_postpone_interrupts(access)) { | 717 { |
718 return isolate_->heap()->undefined_value(); | 718 ExecutionAccess access(isolate_); |
| 719 if (should_postpone_interrupts(access)) { |
| 720 return isolate_->heap()->undefined_value(); |
| 721 } |
| 722 |
| 723 if (CheckAndClearInterrupt(GC_REQUEST, access)) { |
| 724 isolate_->heap()->CollectAllGarbage(Heap::kNoGCFlags, "GC interrupt"); |
| 725 } |
| 726 |
| 727 if (CheckDebugBreak() || CheckDebugCommand()) { |
| 728 Execution::DebugBreakHelper(isolate_); |
| 729 } |
| 730 |
| 731 if (CheckAndClearInterrupt(TERMINATE_EXECUTION, access)) { |
| 732 return isolate_->TerminateExecution(); |
| 733 } |
| 734 |
| 735 if (CheckAndClearInterrupt(FULL_DEOPT, access)) { |
| 736 Deoptimizer::DeoptimizeAll(isolate_); |
| 737 } |
| 738 |
| 739 if (CheckAndClearInterrupt(DEOPT_MARKED_ALLOCATION_SITES, access)) { |
| 740 isolate_->heap()->DeoptMarkedAllocationSites(); |
| 741 } |
| 742 |
| 743 if (CheckAndClearInterrupt(INSTALL_CODE, access)) { |
| 744 ASSERT(isolate_->concurrent_recompilation_enabled()); |
| 745 isolate_->optimizing_compiler_thread()->InstallOptimizedFunctions(); |
| 746 } |
| 747 |
| 748 has_api_interrupt = CheckAndClearInterrupt(API_INTERRUPT, access); |
| 749 |
| 750 isolate_->counters()->stack_interrupts()->Increment(); |
| 751 isolate_->counters()->runtime_profiler_ticks()->Increment(); |
| 752 isolate_->runtime_profiler()->OptimizeNow(); |
719 } | 753 } |
720 | 754 |
721 if (CheckAndClearInterrupt(API_INTERRUPT, access)) { | 755 if (has_api_interrupt) { |
| 756 // Callback must be invoked outside of ExecusionAccess lock. |
722 isolate_->InvokeApiInterruptCallback(); | 757 isolate_->InvokeApiInterruptCallback(); |
723 } | 758 } |
724 | 759 |
725 if (CheckAndClearInterrupt(GC_REQUEST, access)) { | |
726 isolate_->heap()->CollectAllGarbage(Heap::kNoGCFlags, "GC interrupt"); | |
727 } | |
728 | |
729 if (CheckDebugBreak() || CheckDebugCommand()) { | |
730 Execution::DebugBreakHelper(isolate_); | |
731 } | |
732 | |
733 if (CheckAndClearInterrupt(TERMINATE_EXECUTION, access)) { | |
734 return isolate_->TerminateExecution(); | |
735 } | |
736 | |
737 if (CheckAndClearInterrupt(FULL_DEOPT, access)) { | |
738 Deoptimizer::DeoptimizeAll(isolate_); | |
739 } | |
740 | |
741 if (CheckAndClearInterrupt(DEOPT_MARKED_ALLOCATION_SITES, access)) { | |
742 isolate_->heap()->DeoptMarkedAllocationSites(); | |
743 } | |
744 | |
745 if (CheckAndClearInterrupt(INSTALL_CODE, access)) { | |
746 ASSERT(isolate_->concurrent_recompilation_enabled()); | |
747 isolate_->optimizing_compiler_thread()->InstallOptimizedFunctions(); | |
748 } | |
749 | |
750 isolate_->counters()->stack_interrupts()->Increment(); | |
751 isolate_->counters()->runtime_profiler_ticks()->Increment(); | |
752 isolate_->runtime_profiler()->OptimizeNow(); | |
753 return isolate_->heap()->undefined_value(); | 760 return isolate_->heap()->undefined_value(); |
754 } | 761 } |
755 | 762 |
756 } } // namespace v8::internal | 763 } } // namespace v8::internal |
OLD | NEW |