Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/execution.h

Issue 231883007: Return MaybeHandle from Invoke. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/debug-debugger.js ('k') | src/execution.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "handles.h" 8 #include "handles.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 20 matching lines...) Expand all
31 // of arguments. Arguments are Object* type. After function returns, 31 // of arguments. Arguments are Object* type. After function returns,
32 // pointers in 'args' might be invalid. 32 // pointers in 'args' might be invalid.
33 // 33 //
34 // *pending_exception tells whether the invoke resulted in 34 // *pending_exception tells whether the invoke resulted in
35 // a pending exception. 35 // a pending exception.
36 // 36 //
37 // When convert_receiver is set, and the receiver is not an object, 37 // When convert_receiver is set, and the receiver is not an object,
38 // and the function called is not in strict mode, receiver is converted to 38 // and the function called is not in strict mode, receiver is converted to
39 // an object. 39 // an object.
40 // 40 //
41 static Handle<Object> Call(Isolate* isolate, 41 MUST_USE_RESULT static MaybeHandle<Object> Call(
42 Handle<Object> callable, 42 Isolate* isolate,
43 Handle<Object> receiver, 43 Handle<Object> callable,
44 int argc, 44 Handle<Object> receiver,
45 Handle<Object> argv[], 45 int argc,
46 bool* pending_exception, 46 Handle<Object> argv[],
47 bool convert_receiver = false); 47 bool convert_receiver = false);
48 48
49 // Construct object from function, the caller supplies an array of 49 // Construct object from function, the caller supplies an array of
50 // arguments. Arguments are Object* type. After function returns, 50 // arguments. Arguments are Object* type. After function returns,
51 // pointers in 'args' might be invalid. 51 // pointers in 'args' might be invalid.
52 // 52 //
53 // *pending_exception tells whether the invoke resulted in 53 // *pending_exception tells whether the invoke resulted in
54 // a pending exception. 54 // a pending exception.
55 // 55 //
56 static Handle<Object> New(Handle<JSFunction> func, 56 MUST_USE_RESULT static MaybeHandle<Object> New(Handle<JSFunction> func,
57 int argc, 57 int argc,
58 Handle<Object> argv[], 58 Handle<Object> argv[]);
59 bool* pending_exception);
60 59
61 // Call a function, just like Call(), but make sure to silently catch 60 // Call a function, just like Call(), but make sure to silently catch
62 // any thrown exceptions. The return value is either the result of 61 // any thrown exceptions. The return value is either the result of
63 // calling the function (if caught exception is false) or the exception 62 // calling the function (if caught exception is false) or the exception
64 // that occurred (if caught exception is true). 63 // that occurred (if caught exception is true).
65 static Handle<Object> TryCall(Handle<JSFunction> func, 64 MUST_USE_RESULT static MaybeHandle<Object> TryCall(
66 Handle<Object> receiver, 65 Handle<JSFunction> func,
67 int argc, 66 Handle<Object> receiver,
68 Handle<Object> argv[], 67 int argc,
69 bool* caught_exception); 68 Handle<Object> argv[],
69 Handle<Object>* exception_out = NULL);
70 70
71 // ECMA-262 9.3 71 // ECMA-262 9.3
72 static Handle<Object> ToNumber( 72 MUST_USE_RESULT static MaybeHandle<Object> ToNumber(
73 Isolate* isolate, Handle<Object> obj, bool* exc); 73 Isolate* isolate, Handle<Object> obj);
74 74
75 // ECMA-262 9.4 75 // ECMA-262 9.4
76 static Handle<Object> ToInteger( 76 MUST_USE_RESULT static MaybeHandle<Object> ToInteger(
77 Isolate* isolate, Handle<Object> obj, bool* exc); 77 Isolate* isolate, Handle<Object> obj);
78 78
79 // ECMA-262 9.5 79 // ECMA-262 9.5
80 static Handle<Object> ToInt32( 80 MUST_USE_RESULT static MaybeHandle<Object> ToInt32(
81 Isolate* isolate, Handle<Object> obj, bool* exc); 81 Isolate* isolate, Handle<Object> obj);
82 82
83 // ECMA-262 9.6 83 // ECMA-262 9.6
84 static Handle<Object> ToUint32( 84 MUST_USE_RESULT static MaybeHandle<Object> ToUint32(
85 Isolate* isolate, Handle<Object> obj, bool* exc); 85 Isolate* isolate, Handle<Object> obj);
86 86
87 // ECMA-262 9.8 87 // ECMA-262 9.8
88 static Handle<Object> ToString( 88 MUST_USE_RESULT static MaybeHandle<Object> ToString(
89 Isolate* isolate, Handle<Object> obj, bool* exc); 89 Isolate* isolate, Handle<Object> obj);
90 90
91 // ECMA-262 9.8 91 // ECMA-262 9.8
92 static Handle<Object> ToDetailString( 92 MUST_USE_RESULT static MaybeHandle<Object> ToDetailString(
93 Isolate* isolate, Handle<Object> obj, bool* exc); 93 Isolate* isolate, Handle<Object> obj);
94 94
95 // ECMA-262 9.9 95 // ECMA-262 9.9
96 static Handle<Object> ToObject( 96 MUST_USE_RESULT static MaybeHandle<Object> ToObject(
97 Isolate* isolate, Handle<Object> obj, bool* exc); 97 Isolate* isolate, Handle<Object> obj);
98 98
99 // Create a new date object from 'time'. 99 // Create a new date object from 'time'.
100 static Handle<Object> NewDate( 100 MUST_USE_RESULT static MaybeHandle<Object> NewDate(
101 Isolate* isolate, double time, bool* exc); 101 Isolate* isolate, double time);
102 102
103 // Create a new regular expression object from 'pattern' and 'flags'. 103 // Create a new regular expression object from 'pattern' and 'flags'.
104 static Handle<JSRegExp> NewJSRegExp(Handle<String> pattern, 104 MUST_USE_RESULT static MaybeHandle<JSRegExp> NewJSRegExp(
105 Handle<String> flags, 105 Handle<String> pattern, Handle<String> flags);
106 bool* exc);
107 106
108 // Used to implement [] notation on strings (calls JS code) 107 // Used to implement [] notation on strings (calls JS code)
109 static Handle<Object> CharAt(Handle<String> str, uint32_t index); 108 static Handle<Object> CharAt(Handle<String> str, uint32_t index);
110 109
111 static Handle<Object> GetFunctionFor(); 110 static Handle<Object> GetFunctionFor();
112 static Handle<JSFunction> InstantiateFunction( 111 MUST_USE_RESULT static MaybeHandle<JSFunction> InstantiateFunction(
113 Handle<FunctionTemplateInfo> data, bool* exc); 112 Handle<FunctionTemplateInfo> data);
114 static Handle<JSObject> InstantiateObject(Handle<ObjectTemplateInfo> data, 113 MUST_USE_RESULT static MaybeHandle<JSObject> InstantiateObject(
115 bool* exc); 114 Handle<ObjectTemplateInfo> data);
116 static void ConfigureInstance(Isolate* isolate, 115 MUST_USE_RESULT static MaybeHandle<Object> ConfigureInstance(
117 Handle<Object> instance, 116 Isolate* isolate, Handle<Object> instance, Handle<Object> data);
118 Handle<Object> data,
119 bool* exc);
120 static Handle<String> GetStackTraceLine(Handle<Object> recv, 117 static Handle<String> GetStackTraceLine(Handle<Object> recv,
121 Handle<JSFunction> fun, 118 Handle<JSFunction> fun,
122 Handle<Object> pos, 119 Handle<Object> pos,
123 Handle<Object> is_global); 120 Handle<Object> is_global);
124 #ifdef ENABLE_DEBUGGER_SUPPORT 121 #ifdef ENABLE_DEBUGGER_SUPPORT
125 static Object* DebugBreakHelper(Isolate* isolate); 122 static Object* DebugBreakHelper(Isolate* isolate);
126 static void ProcessDebugMessages(Isolate* isolate, bool debug_command_only); 123 static void ProcessDebugMessages(Isolate* isolate, bool debug_command_only);
127 #endif 124 #endif
128 125
129 // If the stack guard is triggered, but it is not an actual 126 // If the stack guard is triggered, but it is not an actual
130 // stack overflow, then handle the interruption accordingly. 127 // stack overflow, then handle the interruption accordingly.
131 MUST_USE_RESULT static MaybeObject* HandleStackGuardInterrupt( 128 MUST_USE_RESULT static MaybeObject* HandleStackGuardInterrupt(
132 Isolate* isolate); 129 Isolate* isolate);
133 130
134 // Get a function delegate (or undefined) for the given non-function 131 // Get a function delegate (or undefined) for the given non-function
135 // object. Used for support calling objects as functions. 132 // object. Used for support calling objects as functions.
136 static Handle<Object> GetFunctionDelegate(Isolate* isolate, 133 static Handle<Object> GetFunctionDelegate(Isolate* isolate,
137 Handle<Object> object); 134 Handle<Object> object);
138 static Handle<Object> TryGetFunctionDelegate(Isolate* isolate, 135 MUST_USE_RESULT static MaybeHandle<Object> TryGetFunctionDelegate(
139 Handle<Object> object, 136 Isolate* isolate,
140 bool* has_pending_exception); 137 Handle<Object> object);
141 138
142 // Get a function delegate (or undefined) for the given non-function 139 // Get a function delegate (or undefined) for the given non-function
143 // object. Used for support calling objects as constructors. 140 // object. Used for support calling objects as constructors.
144 static Handle<Object> GetConstructorDelegate(Isolate* isolate, 141 static Handle<Object> GetConstructorDelegate(Isolate* isolate,
145 Handle<Object> object); 142 Handle<Object> object);
146 static Handle<Object> TryGetConstructorDelegate(Isolate* isolate, 143 static MaybeHandle<Object> TryGetConstructorDelegate(Isolate* isolate,
147 Handle<Object> object, 144 Handle<Object> object);
148 bool* has_pending_exception);
149 145
150 static void RunMicrotasks(Isolate* isolate); 146 static void RunMicrotasks(Isolate* isolate);
151 static void EnqueueMicrotask(Isolate* isolate, Handle<Object> microtask); 147 static void EnqueueMicrotask(Isolate* isolate, Handle<Object> microtask);
152 }; 148 };
153 149
154 150
155 class ExecutionAccess; 151 class ExecutionAccess;
156 152
157 153
158 // StackGuard contains the handling of the limits that are used to limit the 154 // StackGuard contains the handling of the limits that are used to limit the
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 friend class Isolate; 299 friend class Isolate;
304 friend class StackLimitCheck; 300 friend class StackLimitCheck;
305 friend class PostponeInterruptsScope; 301 friend class PostponeInterruptsScope;
306 302
307 DISALLOW_COPY_AND_ASSIGN(StackGuard); 303 DISALLOW_COPY_AND_ASSIGN(StackGuard);
308 }; 304 };
309 305
310 } } // namespace v8::internal 306 } } // namespace v8::internal
311 307
312 #endif // V8_EXECUTION_H_ 308 #endif // V8_EXECUTION_H_
OLDNEW
« no previous file with comments | « src/debug-debugger.js ('k') | src/execution.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698