| 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 10 matching lines...) Expand all Loading... |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_EXECUTION_H_ | 28 #ifndef V8_EXECUTION_H_ |
| 29 #define V8_EXECUTION_H_ | 29 #define V8_EXECUTION_H_ |
| 30 | 30 |
| 31 #include "allocation.h" |
| 32 |
| 31 namespace v8 { | 33 namespace v8 { |
| 32 namespace internal { | 34 namespace internal { |
| 33 | 35 |
| 34 | 36 |
| 35 // Flag used to set the interrupt causes. | 37 // Flag used to set the interrupt causes. |
| 36 enum InterruptFlag { | 38 enum InterruptFlag { |
| 37 INTERRUPT = 1 << 0, | 39 INTERRUPT = 1 << 0, |
| 38 DEBUGBREAK = 1 << 1, | 40 DEBUGBREAK = 1 << 1, |
| 39 DEBUGCOMMAND = 1 << 2, | 41 DEBUGCOMMAND = 1 << 2, |
| 40 PREEMPT = 1 << 3, | 42 PREEMPT = 1 << 3, |
| 41 TERMINATE = 1 << 4, | 43 TERMINATE = 1 << 4, |
| 42 RUNTIME_PROFILER_TICK = 1 << 5, | 44 RUNTIME_PROFILER_TICK = 1 << 5, |
| 43 GC_REQUEST = 1 << 6 | 45 GC_REQUEST = 1 << 6 |
| 44 }; | 46 }; |
| 45 | 47 |
| 46 class Execution : public AllStatic { | 48 class Execution : public AllStatic { |
| 47 public: | 49 public: |
| 48 // Call a function, the caller supplies a receiver and an array | 50 // Call a function, the caller supplies a receiver and an array |
| 49 // of arguments. Arguments are Object* type. After function returns, | 51 // of arguments. Arguments are Object* type. After function returns, |
| 50 // pointers in 'args' might be invalid. | 52 // pointers in 'args' might be invalid. |
| 51 // | 53 // |
| 52 // *pending_exception tells whether the invoke resulted in | 54 // *pending_exception tells whether the invoke resulted in |
| 53 // a pending exception. | 55 // a pending exception. |
| 54 // | 56 // |
| 55 static Handle<Object> Call(Handle<JSFunction> func, | 57 static Handle<Object> Call(Handle<Object> callable, |
| 56 Handle<Object> receiver, | 58 Handle<Object> receiver, |
| 57 int argc, | 59 int argc, |
| 58 Object*** args, | 60 Object*** args, |
| 59 bool* pending_exception); | 61 bool* pending_exception); |
| 60 | 62 |
| 61 // Construct object from function, the caller supplies an array of | 63 // Construct object from function, the caller supplies an array of |
| 62 // arguments. Arguments are Object* type. After function returns, | 64 // arguments. Arguments are Object* type. After function returns, |
| 63 // pointers in 'args' might be invalid. | 65 // pointers in 'args' might be invalid. |
| 64 // | 66 // |
| 65 // *pending_exception tells whether the invoke resulted in | 67 // *pending_exception tells whether the invoke resulted in |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 140 |
| 139 // Get a function delegate (or undefined) for the given non-function | 141 // Get a function delegate (or undefined) for the given non-function |
| 140 // object. Used for support calling objects as functions. | 142 // object. Used for support calling objects as functions. |
| 141 static Handle<Object> GetFunctionDelegate(Handle<Object> object); | 143 static Handle<Object> GetFunctionDelegate(Handle<Object> object); |
| 142 static Handle<Object> TryGetFunctionDelegate(Handle<Object> object, | 144 static Handle<Object> TryGetFunctionDelegate(Handle<Object> object, |
| 143 bool* has_pending_exception); | 145 bool* has_pending_exception); |
| 144 | 146 |
| 145 // Get a function delegate (or undefined) for the given non-function | 147 // Get a function delegate (or undefined) for the given non-function |
| 146 // object. Used for support calling objects as constructors. | 148 // object. Used for support calling objects as constructors. |
| 147 static Handle<Object> GetConstructorDelegate(Handle<Object> object); | 149 static Handle<Object> GetConstructorDelegate(Handle<Object> object); |
| 150 static Handle<Object> TryGetConstructorDelegate(Handle<Object> object, |
| 151 bool* has_pending_exception); |
| 148 }; | 152 }; |
| 149 | 153 |
| 150 | 154 |
| 151 class ExecutionAccess; | 155 class ExecutionAccess; |
| 152 class Isolate; | 156 class Isolate; |
| 153 | 157 |
| 154 | 158 |
| 155 // StackGuard contains the handling of the limits that are used to limit the | 159 // StackGuard contains the handling of the limits that are used to limit the |
| 156 // number of nested invocations of JavaScript and the stack size used in each | 160 // number of nested invocations of JavaScript and the stack size used in each |
| 157 // invocation. | 161 // invocation. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 #endif | 254 #endif |
| 251 | 255 |
| 252 class ThreadLocal { | 256 class ThreadLocal { |
| 253 public: | 257 public: |
| 254 ThreadLocal() { Clear(); } | 258 ThreadLocal() { Clear(); } |
| 255 // You should hold the ExecutionAccess lock when you call Initialize or | 259 // You should hold the ExecutionAccess lock when you call Initialize or |
| 256 // Clear. | 260 // Clear. |
| 257 void Clear(); | 261 void Clear(); |
| 258 | 262 |
| 259 // Returns true if the heap's stack limits should be set, false if not. | 263 // Returns true if the heap's stack limits should be set, false if not. |
| 260 bool Initialize(); | 264 bool Initialize(Isolate* isolate); |
| 261 | 265 |
| 262 // The stack limit is split into a JavaScript and a C++ stack limit. These | 266 // The stack limit is split into a JavaScript and a C++ stack limit. These |
| 263 // two are the same except when running on a simulator where the C++ and | 267 // two are the same except when running on a simulator where the C++ and |
| 264 // JavaScript stacks are separate. Each of the two stack limits have two | 268 // JavaScript stacks are separate. Each of the two stack limits have two |
| 265 // values. The one eith the real_ prefix is the actual stack limit | 269 // values. The one eith the real_ prefix is the actual stack limit |
| 266 // set for the VM. The one without the real_ prefix has the same value as | 270 // set for the VM. The one without the real_ prefix has the same value as |
| 267 // the actual stack limit except when there is an interruption (e.g. debug | 271 // the actual stack limit except when there is an interruption (e.g. debug |
| 268 // break or preemption) in which case it is lowered to make stack checks | 272 // break or preemption) in which case it is lowered to make stack checks |
| 269 // fail. Both the generated code and the runtime system check against the | 273 // fail. Both the generated code and the runtime system check against the |
| 270 // one without the real_ prefix. | 274 // one without the real_ prefix. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 287 friend class StackLimitCheck; | 291 friend class StackLimitCheck; |
| 288 friend class PostponeInterruptsScope; | 292 friend class PostponeInterruptsScope; |
| 289 | 293 |
| 290 DISALLOW_COPY_AND_ASSIGN(StackGuard); | 294 DISALLOW_COPY_AND_ASSIGN(StackGuard); |
| 291 }; | 295 }; |
| 292 | 296 |
| 293 | 297 |
| 294 } } // namespace v8::internal | 298 } } // namespace v8::internal |
| 295 | 299 |
| 296 #endif // V8_EXECUTION_H_ | 300 #endif // V8_EXECUTION_H_ |
| OLD | NEW |