| 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 #ifndef V8_EXECUTION_H_ | 5 #ifndef V8_EXECUTION_H_ |
| 6 #define V8_EXECUTION_H_ | 6 #define V8_EXECUTION_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/base/atomicops.h" | 9 #include "src/base/atomicops.h" |
| 10 #include "src/handles.h" | 10 #include "src/handles.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 char* RestoreStackGuard(char* from); | 79 char* RestoreStackGuard(char* from); |
| 80 static int ArchiveSpacePerThread() { return sizeof(ThreadLocal); } | 80 static int ArchiveSpacePerThread() { return sizeof(ThreadLocal); } |
| 81 void FreeThreadResources(); | 81 void FreeThreadResources(); |
| 82 // Sets up the default stack guard for this thread if it has not | 82 // Sets up the default stack guard for this thread if it has not |
| 83 // already been set up. | 83 // already been set up. |
| 84 void InitThread(const ExecutionAccess& lock); | 84 void InitThread(const ExecutionAccess& lock); |
| 85 // Clears the stack guard for this thread so it does not look as if | 85 // Clears the stack guard for this thread so it does not look as if |
| 86 // it has been set up. | 86 // it has been set up. |
| 87 void ClearThread(const ExecutionAccess& lock); | 87 void ClearThread(const ExecutionAccess& lock); |
| 88 | 88 |
| 89 #define INTERRUPT_LIST(V) \ | 89 #define INTERRUPT_LIST(V) \ |
| 90 V(DEBUGBREAK, DebugBreak, 0) \ | 90 V(DEBUGBREAK, DebugBreak, 0) \ |
| 91 V(DEBUGCOMMAND, DebugCommand, 1) \ | 91 V(DEBUGCOMMAND, DebugCommand, 1) \ |
| 92 V(TERMINATE_EXECUTION, TerminateExecution, 2) \ | 92 V(TERMINATE_EXECUTION, TerminateExecution, 2) \ |
| 93 V(GC_REQUEST, GC, 3) \ | 93 V(GC_REQUEST, GC, 3) \ |
| 94 V(INSTALL_CODE, InstallCode, 4) \ | 94 V(INSTALL_CODE, InstallCode, 4) \ |
| 95 V(API_INTERRUPT, ApiInterrupt, 5) \ | 95 V(API_INTERRUPT, ApiInterrupt, 5) \ |
| 96 V(DEOPT_MARKED_ALLOCATION_SITES, DeoptMarkedAllocationSites, 6) | 96 V(DEOPT_MARKED_ALLOCATION_SITES, DeoptMarkedAllocationSites, 6) \ |
| 97 V(MEMORY_PRESSURE_INTERRUPT, MemoryPressureInterrupt, 7) |
| 97 | 98 |
| 98 #define V(NAME, Name, id) \ | 99 #define V(NAME, Name, id) \ |
| 99 inline bool Check##Name() { return CheckInterrupt(NAME); } \ | 100 inline bool Check##Name() { return CheckInterrupt(NAME); } \ |
| 100 inline void Request##Name() { RequestInterrupt(NAME); } \ | 101 inline void Request##Name() { RequestInterrupt(NAME); } \ |
| 101 inline void Clear##Name() { ClearInterrupt(NAME); } | 102 inline void Clear##Name() { ClearInterrupt(NAME); } |
| 102 INTERRUPT_LIST(V) | 103 INTERRUPT_LIST(V) |
| 103 #undef V | 104 #undef V |
| 104 | 105 |
| 105 // Flag used to set the interrupt causes. | 106 // Flag used to set the interrupt causes. |
| 106 enum InterruptFlag { | 107 enum InterruptFlag { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 128 } | 129 } |
| 129 Address address_of_real_jslimit() { | 130 Address address_of_real_jslimit() { |
| 130 return reinterpret_cast<Address>(&thread_local_.real_jslimit_); | 131 return reinterpret_cast<Address>(&thread_local_.real_jslimit_); |
| 131 } | 132 } |
| 132 | 133 |
| 133 // If the stack guard is triggered, but it is not an actual | 134 // If the stack guard is triggered, but it is not an actual |
| 134 // stack overflow, then handle the interruption accordingly. | 135 // stack overflow, then handle the interruption accordingly. |
| 135 Object* HandleInterrupts(); | 136 Object* HandleInterrupts(); |
| 136 void HandleGCInterrupt(); | 137 void HandleGCInterrupt(); |
| 137 | 138 |
| 139 bool NeedMemoryPressureGC(); |
| 140 void MemoryPressureGCDone(); |
| 141 |
| 138 private: | 142 private: |
| 139 StackGuard(); | 143 StackGuard(); |
| 140 | 144 |
| 141 bool CheckInterrupt(InterruptFlag flag); | 145 bool CheckInterrupt(InterruptFlag flag); |
| 142 void RequestInterrupt(InterruptFlag flag); | 146 void RequestInterrupt(InterruptFlag flag); |
| 143 void ClearInterrupt(InterruptFlag flag); | 147 void ClearInterrupt(InterruptFlag flag); |
| 144 bool CheckAndClearInterrupt(InterruptFlag flag); | 148 bool CheckAndClearInterrupt(InterruptFlag flag); |
| 145 | 149 |
| 146 // You should hold the ExecutionAccess lock when calling this method. | 150 // You should hold the ExecutionAccess lock when calling this method. |
| 147 bool has_pending_interrupts(const ExecutionAccess& lock) { | 151 bool has_pending_interrupts(const ExecutionAccess& lock) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 friend class StackLimitCheck; | 229 friend class StackLimitCheck; |
| 226 friend class PostponeInterruptsScope; | 230 friend class PostponeInterruptsScope; |
| 227 | 231 |
| 228 DISALLOW_COPY_AND_ASSIGN(StackGuard); | 232 DISALLOW_COPY_AND_ASSIGN(StackGuard); |
| 229 }; | 233 }; |
| 230 | 234 |
| 231 } // namespace internal | 235 } // namespace internal |
| 232 } // namespace v8 | 236 } // namespace v8 |
| 233 | 237 |
| 234 #endif // V8_EXECUTION_H_ | 238 #endif // V8_EXECUTION_H_ |
| OLD | NEW |