| Index: src/execution.h
|
| diff --git a/src/execution.h b/src/execution.h
|
| index 81fbbb8de5a740f9ff0e34e137f213fd4f9d6664..8d7b69362d9ec8dc1fdb7becae6999d16a5a4140 100644
|
| --- a/src/execution.h
|
| +++ b/src/execution.h
|
| @@ -122,6 +122,7 @@ class Execution V8_FINAL : public AllStatic {
|
|
|
|
|
| class ExecutionAccess;
|
| +class PostponeInterruptsScope;
|
|
|
|
|
| // StackGuard contains the handling of the limits that are used to limit the
|
| @@ -145,22 +146,32 @@ class StackGuard V8_FINAL {
|
| // it has been set up.
|
| void ClearThread(const ExecutionAccess& lock);
|
|
|
| -#define INTERRUPT_LIST(V) \
|
| - V(DEBUGBREAK, DebugBreak) \
|
| - V(DEBUGCOMMAND, DebugCommand) \
|
| - V(TERMINATE_EXECUTION, TerminateExecution) \
|
| - V(GC_REQUEST, GC) \
|
| - V(INSTALL_CODE, InstallCode) \
|
| - V(API_INTERRUPT, ApiInterrupt) \
|
| - V(DEOPT_MARKED_ALLOCATION_SITES, DeoptMarkedAllocationSites)
|
| -
|
| -#define V(NAME, Name) \
|
| - inline bool Check##Name() { return CheckInterrupt(1 << NAME); } \
|
| - inline void Request##Name() { RequestInterrupt(1 << NAME); } \
|
| - inline void Clear##Name() { ClearInterrupt(1 << NAME); }
|
| +#define INTERRUPT_LIST(V) \
|
| + V(DEBUGBREAK, DebugBreak, 0) \
|
| + V(DEBUGCOMMAND, DebugCommand, 1) \
|
| + V(TERMINATE_EXECUTION, TerminateExecution, 2) \
|
| + V(GC_REQUEST, GC, 3) \
|
| + V(INSTALL_CODE, InstallCode, 4) \
|
| + V(API_INTERRUPT, ApiInterrupt, 5) \
|
| + V(DEOPT_MARKED_ALLOCATION_SITES, DeoptMarkedAllocationSites, 6)
|
| +
|
| +#define V(NAME, Name, id) \
|
| + inline bool Check##Name() { return CheckInterrupt(NAME); } \
|
| + inline void Request##Name() { RequestInterrupt(NAME); } \
|
| + inline void Clear##Name() { ClearInterrupt(NAME); }
|
| INTERRUPT_LIST(V)
|
| #undef V
|
|
|
| + // Flag used to set the interrupt causes.
|
| + enum InterruptFlag {
|
| + #define V(NAME, Name, id) NAME = (1 << id),
|
| + INTERRUPT_LIST(V)
|
| + #undef V
|
| + #define V(NAME, Name, id) NAME |
|
| + ALL_INTERRUPTS = INTERRUPT_LIST(V) 0
|
| + #undef V
|
| + };
|
| +
|
| // This provides an asynchronous read of the stack limits for the current
|
| // thread. There are no locks protecting this, but it is assumed that you
|
| // have the global V8 lock if you are using multiple V8 threads.
|
| @@ -190,33 +201,17 @@ class StackGuard V8_FINAL {
|
| private:
|
| StackGuard();
|
|
|
| -// Flag used to set the interrupt causes.
|
| -enum InterruptFlag {
|
| -#define V(NAME, Name) NAME,
|
| - INTERRUPT_LIST(V)
|
| -#undef V
|
| - NUMBER_OF_INTERRUPTS
|
| -};
|
| -
|
| - bool CheckInterrupt(int flagbit);
|
| - void RequestInterrupt(int flagbit);
|
| - void ClearInterrupt(int flagbit);
|
| + bool CheckInterrupt(InterruptFlag flag);
|
| + void RequestInterrupt(InterruptFlag flag);
|
| + void ClearInterrupt(InterruptFlag flag);
|
| bool CheckAndClearInterrupt(InterruptFlag flag);
|
|
|
| // You should hold the ExecutionAccess lock when calling this method.
|
| bool has_pending_interrupts(const ExecutionAccess& lock) {
|
| - // Sanity check: We shouldn't be asking about pending interrupts
|
| - // unless we're not postponing them anymore.
|
| - ASSERT(!should_postpone_interrupts(lock));
|
| return thread_local_.interrupt_flags_ != 0;
|
| }
|
|
|
| // You should hold the ExecutionAccess lock when calling this method.
|
| - bool should_postpone_interrupts(const ExecutionAccess& lock) {
|
| - return thread_local_.postpone_interrupts_nesting_ > 0;
|
| - }
|
| -
|
| - // You should hold the ExecutionAccess lock when calling this method.
|
| inline void set_interrupt_limits(const ExecutionAccess& lock);
|
|
|
| // Reset limits to actual values. For example after handling interrupt.
|
| @@ -235,6 +230,9 @@ enum InterruptFlag {
|
| static const uintptr_t kIllegalLimit = 0xfffffff8;
|
| #endif
|
|
|
| + void PushPostponeInterruptsScope(PostponeInterruptsScope* scope);
|
| + void PopPostponeInterruptsScope();
|
| +
|
| class ThreadLocal V8_FINAL {
|
| public:
|
| ThreadLocal() { Clear(); }
|
| @@ -259,8 +257,7 @@ enum InterruptFlag {
|
| uintptr_t real_climit_; // Actual C++ stack limit set for the VM.
|
| uintptr_t climit_;
|
|
|
| - int nesting_;
|
| - int postpone_interrupts_nesting_;
|
| + PostponeInterruptsScope* postpone_interrupts_;
|
| int interrupt_flags_;
|
| };
|
|
|
|
|