| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 192 } |
| 193 static Address address_of_jslimit() { | 193 static Address address_of_jslimit() { |
| 194 return reinterpret_cast<Address>(&thread_local_.jslimit_); | 194 return reinterpret_cast<Address>(&thread_local_.jslimit_); |
| 195 } | 195 } |
| 196 static Address address_of_real_jslimit() { | 196 static Address address_of_real_jslimit() { |
| 197 return reinterpret_cast<Address>(&thread_local_.real_jslimit_); | 197 return reinterpret_cast<Address>(&thread_local_.real_jslimit_); |
| 198 } | 198 } |
| 199 | 199 |
| 200 private: | 200 private: |
| 201 // You should hold the ExecutionAccess lock when calling this method. | 201 // You should hold the ExecutionAccess lock when calling this method. |
| 202 static bool IsSet(const ExecutionAccess& lock); | 202 static bool has_pending_interrupts(const ExecutionAccess& lock) { |
| 203 // Sanity check: We shouldn't be asking about pending interrupts |
| 204 // unless we're not postponing them anymore. |
| 205 ASSERT(!should_postpone_interrupts(lock)); |
| 206 return thread_local_.interrupt_flags_ != 0; |
| 207 } |
| 203 | 208 |
| 204 // You should hold the ExecutionAccess lock when calling this method. | 209 // You should hold the ExecutionAccess lock when calling this method. |
| 205 static void set_limits(uintptr_t value, const ExecutionAccess& lock) { | 210 static bool should_postpone_interrupts(const ExecutionAccess& lock) { |
| 206 thread_local_.jslimit_ = value; | 211 return thread_local_.postpone_interrupts_nesting_ > 0; |
| 207 thread_local_.climit_ = value; | 212 } |
| 213 |
| 214 // You should hold the ExecutionAccess lock when calling this method. |
| 215 static void set_interrupt_limits(const ExecutionAccess& lock) { |
| 216 // Ignore attempts to interrupt when interrupts are postponed. |
| 217 if (should_postpone_interrupts(lock)) return; |
| 218 thread_local_.jslimit_ = kInterruptLimit; |
| 219 thread_local_.climit_ = kInterruptLimit; |
| 208 Heap::SetStackLimits(); | 220 Heap::SetStackLimits(); |
| 209 } | 221 } |
| 210 | 222 |
| 211 // Reset limits to actual values. For example after handling interrupt. | 223 // Reset limits to actual values. For example after handling interrupt. |
| 212 // You should hold the ExecutionAccess lock when calling this method. | 224 // You should hold the ExecutionAccess lock when calling this method. |
| 213 static void reset_limits(const ExecutionAccess& lock) { | 225 static void reset_limits(const ExecutionAccess& lock) { |
| 214 thread_local_.jslimit_ = thread_local_.real_jslimit_; | 226 thread_local_.jslimit_ = thread_local_.real_jslimit_; |
| 215 thread_local_.climit_ = thread_local_.real_climit_; | 227 thread_local_.climit_ = thread_local_.real_climit_; |
| 216 Heap::SetStackLimits(); | 228 Heap::SetStackLimits(); |
| 217 } | 229 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 v8::Handle<v8::String> name); | 316 v8::Handle<v8::String> name); |
| 305 static v8::Handle<v8::Value> GC(const v8::Arguments& args); | 317 static v8::Handle<v8::Value> GC(const v8::Arguments& args); |
| 306 private: | 318 private: |
| 307 static const char* kSource; | 319 static const char* kSource; |
| 308 }; | 320 }; |
| 309 | 321 |
| 310 | 322 |
| 311 } } // namespace v8::internal | 323 } } // namespace v8::internal |
| 312 | 324 |
| 313 #endif // V8_EXECUTION_H_ | 325 #endif // V8_EXECUTION_H_ |
| OLD | NEW |