| 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/globals.h" | 10 #include "src/globals.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 } | 128 } |
| 129 Address address_of_real_jslimit() { | 129 Address address_of_real_jslimit() { |
| 130 return reinterpret_cast<Address>(&thread_local_.real_jslimit_); | 130 return reinterpret_cast<Address>(&thread_local_.real_jslimit_); |
| 131 } | 131 } |
| 132 | 132 |
| 133 // If the stack guard is triggered, but it is not an actual | 133 // If the stack guard is triggered, but it is not an actual |
| 134 // stack overflow, then handle the interruption accordingly. | 134 // stack overflow, then handle the interruption accordingly. |
| 135 Object* HandleInterrupts(); | 135 Object* HandleInterrupts(); |
| 136 void HandleGCInterrupt(); | 136 void HandleGCInterrupt(); |
| 137 | 137 |
| 138 #if DEBUG |
| 139 uintptr_t stack_base_position() { return thread_local_.stack_base_position_; } |
| 140 #endif |
| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 uintptr_t climit() { | 211 uintptr_t climit() { |
| 208 return bit_cast<uintptr_t>(base::NoBarrier_Load(&climit_)); | 212 return bit_cast<uintptr_t>(base::NoBarrier_Load(&climit_)); |
| 209 } | 213 } |
| 210 void set_climit(uintptr_t limit) { | 214 void set_climit(uintptr_t limit) { |
| 211 return base::NoBarrier_Store(&climit_, | 215 return base::NoBarrier_Store(&climit_, |
| 212 static_cast<base::AtomicWord>(limit)); | 216 static_cast<base::AtomicWord>(limit)); |
| 213 } | 217 } |
| 214 | 218 |
| 215 PostponeInterruptsScope* postpone_interrupts_; | 219 PostponeInterruptsScope* postpone_interrupts_; |
| 216 int interrupt_flags_; | 220 int interrupt_flags_; |
| 221 #if DEBUG |
| 222 uintptr_t stack_base_position_; |
| 223 #endif |
| 217 }; | 224 }; |
| 218 | 225 |
| 219 // TODO(isolates): Technically this could be calculated directly from a | 226 // TODO(isolates): Technically this could be calculated directly from a |
| 220 // pointer to StackGuard. | 227 // pointer to StackGuard. |
| 221 Isolate* isolate_; | 228 Isolate* isolate_; |
| 222 ThreadLocal thread_local_; | 229 ThreadLocal thread_local_; |
| 223 | 230 |
| 224 friend class Isolate; | 231 friend class Isolate; |
| 225 friend class StackLimitCheck; | 232 friend class StackLimitCheck; |
| 226 friend class PostponeInterruptsScope; | 233 friend class PostponeInterruptsScope; |
| 227 | 234 |
| 228 DISALLOW_COPY_AND_ASSIGN(StackGuard); | 235 DISALLOW_COPY_AND_ASSIGN(StackGuard); |
| 229 }; | 236 }; |
| 230 | 237 |
| 231 } // namespace internal | 238 } // namespace internal |
| 232 } // namespace v8 | 239 } // namespace v8 |
| 233 | 240 |
| 234 #endif // V8_EXECUTION_H_ | 241 #endif // V8_EXECUTION_H_ |
| OLD | NEW |