Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: src/execution.cc

Issue 309533009: Release execution lock before dispatching interrupt handling. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 359
360 void StackGuard::ClearInterrupt(int flagbit) { 360 void StackGuard::ClearInterrupt(int flagbit) {
361 ExecutionAccess access(isolate_); 361 ExecutionAccess access(isolate_);
362 thread_local_.interrupt_flags_ &= ~flagbit; 362 thread_local_.interrupt_flags_ &= ~flagbit;
363 if (!should_postpone_interrupts(access) && !has_pending_interrupts(access)) { 363 if (!should_postpone_interrupts(access) && !has_pending_interrupts(access)) {
364 reset_limits(access); 364 reset_limits(access);
365 } 365 }
366 } 366 }
367 367
368 368
369 bool StackGuard::CheckAndClearInterrupt(InterruptFlag flag, 369 bool StackGuard::CheckAndClearInterrupt(InterruptFlag flag) {
370 const ExecutionAccess& lock) { 370 ExecutionAccess access(isolate_);
371 int flagbit = 1 << flag; 371 int flagbit = 1 << flag;
372 bool result = (thread_local_.interrupt_flags_ & flagbit); 372 bool result = (thread_local_.interrupt_flags_ & flagbit);
373 thread_local_.interrupt_flags_ &= ~flagbit; 373 thread_local_.interrupt_flags_ &= ~flagbit;
374 if (!should_postpone_interrupts(lock) && !has_pending_interrupts(lock)) { 374 if (!should_postpone_interrupts(access) && !has_pending_interrupts(access)) {
375 reset_limits(lock); 375 reset_limits(access);
376 } 376 }
377 return result; 377 return result;
378 } 378 }
379 379
380 380
381 char* StackGuard::ArchiveStackGuard(char* to) { 381 char* StackGuard::ArchiveStackGuard(char* to) {
382 ExecutionAccess access(isolate_); 382 ExecutionAccess access(isolate_);
383 MemCopy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal)); 383 MemCopy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal));
384 ThreadLocal blank; 384 ThreadLocal blank;
385 385
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 if (debugger.FailedToEnter()) return; 702 if (debugger.FailedToEnter()) return;
703 703
704 // Notify the debug event listeners. Indicate auto continue if the break was 704 // Notify the debug event listeners. Indicate auto continue if the break was
705 // a debug command break. 705 // a debug command break.
706 isolate->debug()->OnDebugBreak(isolate->factory()->undefined_value(), 706 isolate->debug()->OnDebugBreak(isolate->factory()->undefined_value(),
707 debug_command_only); 707 debug_command_only);
708 } 708 }
709 709
710 710
711 Object* StackGuard::HandleInterrupts() { 711 Object* StackGuard::HandleInterrupts() {
712 bool has_api_interrupt = false;
713 { 712 {
714 ExecutionAccess access(isolate_); 713 ExecutionAccess access(isolate_);
715 if (should_postpone_interrupts(access)) { 714 if (should_postpone_interrupts(access)) {
716 return isolate_->heap()->undefined_value(); 715 return isolate_->heap()->undefined_value();
717 } 716 }
718
719 if (CheckAndClearInterrupt(GC_REQUEST, access)) {
720 isolate_->heap()->CollectAllGarbage(Heap::kNoGCFlags, "GC interrupt");
721 }
722
723 if (CheckDebugBreak() || CheckDebugCommand()) {
724 Execution::DebugBreakHelper(isolate_);
725 }
726
727 if (CheckAndClearInterrupt(TERMINATE_EXECUTION, access)) {
728 return isolate_->TerminateExecution();
729 }
730
731 if (CheckAndClearInterrupt(DEOPT_MARKED_ALLOCATION_SITES, access)) {
732 isolate_->heap()->DeoptMarkedAllocationSites();
733 }
734
735 if (CheckAndClearInterrupt(INSTALL_CODE, access)) {
736 ASSERT(isolate_->concurrent_recompilation_enabled());
737 isolate_->optimizing_compiler_thread()->InstallOptimizedFunctions();
738 }
739
740 has_api_interrupt = CheckAndClearInterrupt(API_INTERRUPT, access);
741
742 isolate_->counters()->stack_interrupts()->Increment();
743 isolate_->counters()->runtime_profiler_ticks()->Increment();
744 isolate_->runtime_profiler()->OptimizeNow();
745 } 717 }
746 718
747 if (has_api_interrupt) { 719 if (CheckAndClearInterrupt(GC_REQUEST)) {
720 isolate_->heap()->CollectAllGarbage(Heap::kNoGCFlags, "GC interrupt");
721 }
722
723 if (CheckDebugBreak() || CheckDebugCommand()) {
724 Execution::DebugBreakHelper(isolate_);
725 }
726
727 if (CheckAndClearInterrupt(TERMINATE_EXECUTION)) {
728 return isolate_->TerminateExecution();
729 }
730
731 if (CheckAndClearInterrupt(DEOPT_MARKED_ALLOCATION_SITES)) {
732 isolate_->heap()->DeoptMarkedAllocationSites();
733 }
734
735 if (CheckAndClearInterrupt(INSTALL_CODE)) {
736 ASSERT(isolate_->concurrent_recompilation_enabled());
737 isolate_->optimizing_compiler_thread()->InstallOptimizedFunctions();
738 }
739
740 if (CheckAndClearInterrupt(API_INTERRUPT)) {
748 // Callback must be invoked outside of ExecusionAccess lock. 741 // Callback must be invoked outside of ExecusionAccess lock.
749 isolate_->InvokeApiInterruptCallback(); 742 isolate_->InvokeApiInterruptCallback();
750 } 743 }
751 744
745 isolate_->counters()->stack_interrupts()->Increment();
746 isolate_->counters()->runtime_profiler_ticks()->Increment();
747 isolate_->runtime_profiler()->OptimizeNow();
748
752 return isolate_->heap()->undefined_value(); 749 return isolate_->heap()->undefined_value();
753 } 750 }
754 751
755 } } // namespace v8::internal 752 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/execution.h ('k') | test/cctest/test-debug.cc » ('j') | test/cctest/test-debug.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698