| 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/handles.h" | 10 #include "src/handles.h" |
| 11 #include "src/utils.h" | 11 #include "src/utils.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 class Execution final : public AllStatic { | 16 class Execution final : public AllStatic { |
| 17 public: | 17 public: |
| 18 // Whether to report pending messages, or keep them pending on the isolate. |
| 19 enum class MessageHandling { kReport, kKeepPending }; |
| 20 |
| 18 // Call a function, the caller supplies a receiver and an array | 21 // Call a function, the caller supplies a receiver and an array |
| 19 // of arguments. | 22 // of arguments. |
| 20 // | 23 // |
| 21 // When the function called is not in strict mode, receiver is | 24 // When the function called is not in strict mode, receiver is |
| 22 // converted to an object. | 25 // converted to an object. |
| 23 // | 26 // |
| 24 V8_EXPORT_PRIVATE MUST_USE_RESULT static MaybeHandle<Object> Call( | 27 V8_EXPORT_PRIVATE MUST_USE_RESULT static MaybeHandle<Object> Call( |
| 25 Isolate* isolate, Handle<Object> callable, Handle<Object> receiver, | 28 Isolate* isolate, Handle<Object> callable, Handle<Object> receiver, |
| 26 int argc, Handle<Object> argv[]); | 29 int argc, Handle<Object> argv[]); |
| 27 | 30 |
| 28 // Construct object from function, the caller supplies an array of | 31 // Construct object from function, the caller supplies an array of |
| 29 // arguments. | 32 // arguments. |
| 30 MUST_USE_RESULT static MaybeHandle<Object> New(Handle<JSFunction> constructor, | 33 MUST_USE_RESULT static MaybeHandle<Object> New(Handle<JSFunction> constructor, |
| 31 int argc, | 34 int argc, |
| 32 Handle<Object> argv[]); | 35 Handle<Object> argv[]); |
| 33 MUST_USE_RESULT static MaybeHandle<Object> New(Isolate* isolate, | 36 MUST_USE_RESULT static MaybeHandle<Object> New(Isolate* isolate, |
| 34 Handle<Object> constructor, | 37 Handle<Object> constructor, |
| 35 Handle<Object> new_target, | 38 Handle<Object> new_target, |
| 36 int argc, | 39 int argc, |
| 37 Handle<Object> argv[]); | 40 Handle<Object> argv[]); |
| 38 | 41 |
| 39 // Call a function, just like Call(), but make sure to silently catch | 42 // Call a function, just like Call(), but handle don't report exceptions |
| 40 // any thrown exceptions. The return value is either the result of | 43 // externally. |
| 41 // calling the function (if caught exception is false) or the exception | 44 // The return value is either the result of calling the function (if no |
| 42 // that occurred (if caught exception is true). | 45 // exception occurred), or an empty handle. |
| 43 // In the exception case, exception_out holds the caught exceptions, unless | 46 // If message_handling is MessageHandling::kReport, exceptions (except for |
| 44 // it is a termination exception. | 47 // termination exceptions) will be stored in exception_out (if not a |
| 48 // nullptr). |
| 45 static MaybeHandle<Object> TryCall(Isolate* isolate, Handle<Object> callable, | 49 static MaybeHandle<Object> TryCall(Isolate* isolate, Handle<Object> callable, |
| 46 Handle<Object> receiver, int argc, | 50 Handle<Object> receiver, int argc, |
| 47 Handle<Object> argv[], | 51 Handle<Object> argv[], |
| 48 MaybeHandle<Object>* exception_out = NULL); | 52 MessageHandling message_handling, |
| 53 MaybeHandle<Object>* exception_out); |
| 49 }; | 54 }; |
| 50 | 55 |
| 51 | 56 |
| 52 class ExecutionAccess; | 57 class ExecutionAccess; |
| 53 class PostponeInterruptsScope; | 58 class PostponeInterruptsScope; |
| 54 | 59 |
| 55 | 60 |
| 56 // StackGuard contains the handling of the limits that are used to limit the | 61 // StackGuard contains the handling of the limits that are used to limit the |
| 57 // number of nested invocations of JavaScript and the stack size used in each | 62 // number of nested invocations of JavaScript and the stack size used in each |
| 58 // invocation. | 63 // invocation. |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 friend class StackLimitCheck; | 223 friend class StackLimitCheck; |
| 219 friend class PostponeInterruptsScope; | 224 friend class PostponeInterruptsScope; |
| 220 | 225 |
| 221 DISALLOW_COPY_AND_ASSIGN(StackGuard); | 226 DISALLOW_COPY_AND_ASSIGN(StackGuard); |
| 222 }; | 227 }; |
| 223 | 228 |
| 224 } // namespace internal | 229 } // namespace internal |
| 225 } // namespace v8 | 230 } // namespace v8 |
| 226 | 231 |
| 227 #endif // V8_EXECUTION_H_ | 232 #endif // V8_EXECUTION_H_ |
| OLD | NEW |