5 #ifndef V8_EXECUTION_H_ 6 #define V8_EXECUTION_H_ 8 #include "src/base/atomicops.h" 9 #include "src/globals.h" 20 enum class MessageHandling { kReport, kKeepPending };
21 enum class Target { kCallable, kRunMicrotasks };
52 MessageHandling message_handling,
54 Target target = Target::kCallable);
57 MessageHandling message_handling,
79 void AdjustStackLimitForSimulator();
82 char* ArchiveStackGuard(
char* to);
83 char* RestoreStackGuard(
char* from);
84 static int ArchiveSpacePerThread() {
return sizeof(ThreadLocal); }
85 void FreeThreadResources();
93 #define INTERRUPT_LIST(V) \ 94 V(TERMINATE_EXECUTION, TerminateExecution, 0) \ 95 V(GC_REQUEST, GC, 1) \ 96 V(INSTALL_CODE, InstallCode, 2) \ 97 V(API_INTERRUPT, ApiInterrupt, 3) \ 98 V(DEOPT_MARKED_ALLOCATION_SITES, DeoptMarkedAllocationSites, 4) 100 #define V(NAME, Name, id) \ 101 inline bool Check##Name() { return CheckInterrupt(NAME); } \ 102 inline bool CheckAndClear##Name() { return CheckAndClearInterrupt(NAME); } \ 103 inline void Request##Name() { RequestInterrupt(NAME); } \ 104 inline void Clear##Name() { ClearInterrupt(NAME); } 110 #define V(NAME, Name, id) NAME = (1 << id), 113 #define V(NAME, Name, id) NAME | 114 ALL_INTERRUPTS = INTERRUPT_LIST(
V) 0
118 uintptr_t climit() {
return thread_local_.climit(); }
119 uintptr_t jslimit() {
return thread_local_.jslimit(); }
124 return thread_local_.real_climit_;
127 return thread_local_.real_jslimit_;
130 return reinterpret_cast<Address>(&thread_local_.jslimit_);
132 Address address_of_real_jslimit() {
133 return reinterpret_cast<Address>(&thread_local_.real_jslimit_);
138 Object* HandleInterrupts();
141 bool CheckInterrupt(InterruptFlag flag);
142 void RequestInterrupt(InterruptFlag flag);
143 void ClearInterrupt(InterruptFlag flag);
144 bool CheckAndClearInterrupt(InterruptFlag flag);
148 return thread_local_.interrupt_flags_ != 0;
159 void EnableInterrupts();
160 void DisableInterrupts();
162 #if V8_TARGET_ARCH_64_BIT 166 static const uintptr_t kInterruptLimit = 0xfffffffe;
167 static const uintptr_t kIllegalLimit = 0xfffffff8;
171 void PopInterruptsScope();
173 class ThreadLocal final {
175 ThreadLocal() { Clear(); }
181 bool Initialize(
Isolate* isolate);
197 base::AtomicWord jslimit_;
198 base::AtomicWord climit_;
201 return bit_cast<
uintptr_t>(base::Relaxed_Load(&jslimit_));
204 return base::Relaxed_Store(&jslimit_,
205 static_cast<base::AtomicWord>(limit));
208 return bit_cast<
uintptr_t>(base::Relaxed_Load(&climit_));
211 return base::Relaxed_Store(&climit_,
212 static_cast<base::AtomicWord>(limit));
216 int interrupt_flags_;
222 ThreadLocal thread_local_;
234 #endif // V8_EXECUTION_H_