From cb2bec3b476defb45c63fd745f6ce805aa343d42 Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Mon, 12 May 2014 11:52:44 +0000 Subject: [PATCH] Revert "Revert interrupt handling code changed in r21208." This reverts commit r21252. R=svenpanne@chromium.org Review URL: https://codereview.chromium.org/284483002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21264 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/execution.cc | 37 +++++++++++++++++++++---------------- src/execution.h | 1 + 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/execution.cc b/src/execution.cc index ee359e7..ee6cb97 100644 --- a/src/execution.cc +++ b/src/execution.cc @@ -388,6 +388,18 @@ void StackGuard::ClearInterrupt(int flagbit) { } +bool StackGuard::CheckAndClearInterrupt(InterruptFlag flag, + const ExecutionAccess& lock) { + int flagbit = 1 << flag; + bool result = (thread_local_.interrupt_flags_ & flagbit); + thread_local_.interrupt_flags_ &= ~flagbit; + if (!should_postpone_interrupts(lock) && !has_pending_interrupts(lock)) { + reset_limits(lock); + } + return result; +} + + char* StackGuard::ArchiveStackGuard(char* to) { ExecutionAccess access(isolate_); OS::MemCopy(to, reinterpret_cast(&thread_local_), sizeof(ThreadLocal)); @@ -720,44 +732,37 @@ void Execution::ProcessDebugMessages(Isolate* isolate, Object* StackGuard::HandleInterrupts() { - { ExecutionAccess access(isolate_); - if (should_postpone_interrupts(access)) { - return isolate_->heap()->undefined_value(); - } + ExecutionAccess access(isolate_); + if (should_postpone_interrupts(access)) { + return isolate_->heap()->undefined_value(); } - if (CheckApiInterrupt()) { - ClearApiInterrupt(); + if (CheckAndClearInterrupt(API_INTERRUPT, access)) { isolate_->InvokeApiInterruptCallback(); } - if (CheckGC()) { + if (CheckAndClearInterrupt(GC_REQUEST, access)) { isolate_->heap()->CollectAllGarbage(Heap::kNoGCFlags, "GC interrupt"); - ClearGC(); } if (CheckDebugBreak() || CheckDebugCommand()) { Execution::DebugBreakHelper(isolate_); } - if (CheckTerminateExecution()) { - ClearTerminateExecution(); + if (CheckAndClearInterrupt(TERMINATE_EXECUTION, access)) { return isolate_->TerminateExecution(); } - if (CheckFullDeopt()) { - ClearFullDeopt(); + if (CheckAndClearInterrupt(FULL_DEOPT, access)) { Deoptimizer::DeoptimizeAll(isolate_); } - if (CheckDeoptMarkedAllocationSites()) { - ClearDeoptMarkedAllocationSites(); + if (CheckAndClearInterrupt(DEOPT_MARKED_ALLOCATION_SITES, access)) { isolate_->heap()->DeoptMarkedAllocationSites(); } - if (CheckInstallCode()) { + if (CheckAndClearInterrupt(INSTALL_CODE, access)) { ASSERT(isolate_->concurrent_recompilation_enabled()); - ClearInstallCode(); isolate_->optimizing_compiler_thread()->InstallOptimizedFunctions(); } diff --git a/src/execution.h b/src/execution.h index 8aaa7b4..6d0b15f 100644 --- a/src/execution.h +++ b/src/execution.h @@ -210,6 +210,7 @@ enum InterruptFlag { bool CheckInterrupt(int flagbit); void RequestInterrupt(int flagbit); void ClearInterrupt(int flagbit); + bool CheckAndClearInterrupt(InterruptFlag flag, const ExecutionAccess& lock); void InvokeApiInterruptCallback(); -- 2.7.4