OLD | NEW |
---|---|
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 static bool IsTerminateExecution(); | 168 static bool IsTerminateExecution(); |
169 static void TerminateExecution(); | 169 static void TerminateExecution(); |
170 #ifdef ENABLE_DEBUGGER_SUPPORT | 170 #ifdef ENABLE_DEBUGGER_SUPPORT |
171 static bool IsDebugBreak(); | 171 static bool IsDebugBreak(); |
172 static void DebugBreak(); | 172 static void DebugBreak(); |
173 static bool IsDebugCommand(); | 173 static bool IsDebugCommand(); |
174 static void DebugCommand(); | 174 static void DebugCommand(); |
175 #endif | 175 #endif |
176 static void Continue(InterruptFlag after_what); | 176 static void Continue(InterruptFlag after_what); |
177 | 177 |
178 static uintptr_t jslimit() { | |
179 return thread_local_.jslimit_; | |
180 } | |
181 | |
178 private: | 182 private: |
179 // You should hold the ExecutionAccess lock when calling this method. | 183 // You should hold the ExecutionAccess lock when calling this method. |
180 static bool IsSet(const ExecutionAccess& lock); | 184 static bool IsSet(const ExecutionAccess& lock); |
181 | 185 |
182 // This provides an asynchronous read of the stack limit for the current | 186 // This provides an asynchronous read of the stack limit for the current |
183 // thread. There are no locks protecting this, but it is assumed that you | 187 // thread. There are no locks protecting this, but it is assumed that you |
184 // have the global V8 lock if you are using multiple V8 threads. | 188 // have the global V8 lock if you are using multiple V8 threads. |
185 static uintptr_t climit() { | 189 static uintptr_t climit() { |
186 return thread_local_.climit_; | 190 return thread_local_.climit_; |
187 } | 191 } |
188 | 192 |
189 // You should hold the ExecutionAccess lock when calling this method. | 193 // You should hold the ExecutionAccess lock when calling this method. |
190 static void set_limits(uintptr_t value, const ExecutionAccess& lock) { | 194 static void set_limits(uintptr_t value, const ExecutionAccess& lock) { |
195 Heap::SetStackLimit(value); | |
191 thread_local_.jslimit_ = value; | 196 thread_local_.jslimit_ = value; |
192 thread_local_.climit_ = value; | 197 thread_local_.climit_ = value; |
193 } | 198 } |
194 | 199 |
195 // Reset limits to initial values. For example after handling interrupt. | 200 // Reset limits to initial values. For example after handling interrupt. |
196 // You should hold the ExecutionAccess lock when calling this method. | 201 // You should hold the ExecutionAccess lock when calling this method. |
197 static void reset_limits(const ExecutionAccess& lock) { | 202 static void reset_limits(const ExecutionAccess& lock) { |
198 if (thread_local_.nesting_ == 0) { | 203 if (thread_local_.nesting_ == 0) { |
199 // No limits have been set yet. | 204 // No limits have been set yet. |
200 set_limits(kIllegalLimit, lock); | 205 set_limits(kIllegalLimit, lock); |
201 } else { | 206 } else { |
202 thread_local_.jslimit_ = thread_local_.initial_jslimit_; | 207 thread_local_.jslimit_ = thread_local_.initial_jslimit_; |
208 Heap::SetStackLimit(thread_local_.jslimit_); | |
203 thread_local_.climit_ = thread_local_.initial_climit_; | 209 thread_local_.climit_ = thread_local_.initial_climit_; |
204 } | 210 } |
205 } | 211 } |
206 | 212 |
207 // Enable or disable interrupts. | 213 // Enable or disable interrupts. |
208 static void EnableInterrupts(); | 214 static void EnableInterrupts(); |
209 static void DisableInterrupts(); | 215 static void DisableInterrupts(); |
210 | 216 |
211 static const uintptr_t kLimitSize = kPointerSize * 128 * KB; | 217 static const uintptr_t kLimitSize = kPointerSize * 128 * KB; |
212 #ifdef V8_TARGET_ARCH_X64 | 218 #ifdef V8_TARGET_ARCH_X64 |
213 static const uintptr_t kInterruptLimit = V8_UINT64_C(0xfffffffffffffffe); | 219 static const uintptr_t kInterruptLimit = V8_UINT64_C(0xfffffffffffffffe); |
214 static const uintptr_t kIllegalLimit = V8_UINT64_C(0xffffffffffffffff); | 220 static const uintptr_t kIllegalLimit = V8_UINT64_C(0xffffffffffffffff); |
215 #else | 221 #else |
216 static const uintptr_t kInterruptLimit = 0xfffffffe; | 222 static const uintptr_t kInterruptLimit = 0xfffffffe; |
217 static const uintptr_t kIllegalLimit = 0xffffffff; | 223 static const uintptr_t kIllegalLimit = 0xffffffff; |
218 #endif | 224 #endif |
219 | 225 |
220 class ThreadLocal { | 226 class ThreadLocal { |
221 public: | 227 public: |
222 ThreadLocal() | 228 ThreadLocal() |
223 : initial_jslimit_(kIllegalLimit), | 229 : initial_jslimit_(kIllegalLimit), |
Mads Ager (chromium)
2009/08/26 10:09:28
I know this has not been introduced in this change
| |
224 jslimit_(kIllegalLimit), | 230 jslimit_(kIllegalLimit), |
225 initial_climit_(kIllegalLimit), | 231 initial_climit_(kIllegalLimit), |
226 climit_(kIllegalLimit), | 232 climit_(kIllegalLimit), |
227 nesting_(0), | 233 nesting_(0), |
228 postpone_interrupts_nesting_(0), | 234 postpone_interrupts_nesting_(0), |
229 interrupt_flags_(0) {} | 235 interrupt_flags_(0) { |
236 Heap::SetStackLimit(kIllegalLimit); | |
237 } | |
230 uintptr_t initial_jslimit_; | 238 uintptr_t initial_jslimit_; |
231 uintptr_t jslimit_; | 239 uintptr_t jslimit_; |
232 uintptr_t initial_climit_; | 240 uintptr_t initial_climit_; |
233 uintptr_t climit_; | 241 uintptr_t climit_; |
234 int nesting_; | 242 int nesting_; |
235 int postpone_interrupts_nesting_; | 243 int postpone_interrupts_nesting_; |
236 int interrupt_flags_; | 244 int interrupt_flags_; |
237 }; | 245 }; |
238 | 246 |
239 static ThreadLocal thread_local_; | 247 static ThreadLocal thread_local_; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 v8::Handle<v8::String> name); | 291 v8::Handle<v8::String> name); |
284 static v8::Handle<v8::Value> GC(const v8::Arguments& args); | 292 static v8::Handle<v8::Value> GC(const v8::Arguments& args); |
285 private: | 293 private: |
286 static const char* kSource; | 294 static const char* kSource; |
287 }; | 295 }; |
288 | 296 |
289 | 297 |
290 } } // namespace v8::internal | 298 } } // namespace v8::internal |
291 | 299 |
292 #endif // V8_EXECUTION_H_ | 300 #endif // V8_EXECUTION_H_ |
OLD | NEW |