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

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
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 static MaybeHandle<Object> TryCall(Handle<JSFunction> func,
66 Handle<Object> receiver, 65 Handle<Object> receiver,
67 int argc, 66 int argc,
68 Handle<Object> argv[], 67 Handle<Object> argv[]);
69 bool* caught_exception);
70 68
71 // ECMA-262 9.3 69 // ECMA-262 9.3
72 static Handle<Object> ToNumber( 70 MUST_USE_RESULT static MaybeHandle<Object> ToNumber(
73 Isolate* isolate, Handle<Object> obj, bool* exc); 71 Isolate* isolate, Handle<Object> obj);
74 72
75 // ECMA-262 9.4 73 // ECMA-262 9.4
76 static Handle<Object> ToInteger( 74 MUST_USE_RESULT static MaybeHandle<Object> ToInteger(
77 Isolate* isolate, Handle<Object> obj, bool* exc); 75 Isolate* isolate, Handle<Object> obj);
78 76
79 // ECMA-262 9.5 77 // ECMA-262 9.5
80 static Handle<Object> ToInt32( 78 MUST_USE_RESULT static MaybeHandle<Object> ToInt32(
81 Isolate* isolate, Handle<Object> obj, bool* exc); 79 Isolate* isolate, Handle<Object> obj);
82 80
83 // ECMA-262 9.6 81 // ECMA-262 9.6
84 static Handle<Object> ToUint32( 82 MUST_USE_RESULT static MaybeHandle<Object> ToUint32(
85 Isolate* isolate, Handle<Object> obj, bool* exc); 83 Isolate* isolate, Handle<Object> obj);
86 84
87 // ECMA-262 9.8 85 // ECMA-262 9.8
88 static Handle<Object> ToString( 86 MUST_USE_RESULT static MaybeHandle<Object> ToString(
89 Isolate* isolate, Handle<Object> obj, bool* exc); 87 Isolate* isolate, Handle<Object> obj);
90 88
91 // ECMA-262 9.8 89 // ECMA-262 9.8
92 static Handle<Object> ToDetailString( 90 MUST_USE_RESULT static MaybeHandle<Object> ToDetailString(
93 Isolate* isolate, Handle<Object> obj, bool* exc); 91 Isolate* isolate, Handle<Object> obj);
94 92
95 // ECMA-262 9.9 93 // ECMA-262 9.9
96 static Handle<Object> ToObject( 94 MUST_USE_RESULT static MaybeHandle<Object> ToObject(
97 Isolate* isolate, Handle<Object> obj, bool* exc); 95 Isolate* isolate, Handle<Object> obj);
98 96
99 // Create a new date object from 'time'. 97 // Create a new date object from 'time'.
100 static Handle<Object> NewDate( 98 MUST_USE_RESULT static MaybeHandle<Object> NewDate(
101 Isolate* isolate, double time, bool* exc); 99 Isolate* isolate, double time);
102 100
103 // Create a new regular expression object from 'pattern' and 'flags'. 101 // Create a new regular expression object from 'pattern' and 'flags'.
104 static Handle<JSRegExp> NewJSRegExp(Handle<String> pattern, 102 MUST_USE_RESULT static MaybeHandle<JSRegExp> NewJSRegExp(
105 Handle<String> flags, 103 Handle<String> pattern, Handle<String> flags);
106 bool* exc);
107 104
108 // Used to implement [] notation on strings (calls JS code) 105 // Used to implement [] notation on strings (calls JS code)
109 static Handle<Object> CharAt(Handle<String> str, uint32_t index); 106 static Handle<Object> CharAt(Handle<String> str, uint32_t index);
110 107
111 static Handle<Object> GetFunctionFor(); 108 static Handle<Object> GetFunctionFor();
112 static Handle<JSFunction> InstantiateFunction( 109 MUST_USE_RESULT static MaybeHandle<JSFunction> InstantiateFunction(
113 Handle<FunctionTemplateInfo> data, bool* exc); 110 Handle<FunctionTemplateInfo> data);
114 static Handle<JSObject> InstantiateObject(Handle<ObjectTemplateInfo> data, 111 MUST_USE_RESULT static MaybeHandle<JSObject> InstantiateObject(
115 bool* exc); 112 Handle<ObjectTemplateInfo> data);
116 static void ConfigureInstance(Isolate* isolate, 113 MUST_USE_RESULT static MaybeHandle<Object> ConfigureInstance(
117 Handle<Object> instance, 114 Isolate* isolate, Handle<Object> instance, Handle<Object> data);
118 Handle<Object> data,
119 bool* exc);
120 static Handle<String> GetStackTraceLine(Handle<Object> recv, 115 static Handle<String> GetStackTraceLine(Handle<Object> recv,
121 Handle<JSFunction> fun, 116 Handle<JSFunction> fun,
122 Handle<Object> pos, 117 Handle<Object> pos,
123 Handle<Object> is_global); 118 Handle<Object> is_global);
124 #ifdef ENABLE_DEBUGGER_SUPPORT 119 #ifdef ENABLE_DEBUGGER_SUPPORT
125 static Object* DebugBreakHelper(Isolate* isolate); 120 static Object* DebugBreakHelper(Isolate* isolate);
126 static void ProcessDebugMessages(Isolate* isolate, bool debug_command_only); 121 static void ProcessDebugMessages(Isolate* isolate, bool debug_command_only);
127 #endif 122 #endif
128 123
129 // If the stack guard is triggered, but it is not an actual 124 // If the stack guard is triggered, but it is not an actual
130 // stack overflow, then handle the interruption accordingly. 125 // stack overflow, then handle the interruption accordingly.
131 MUST_USE_RESULT static MaybeObject* HandleStackGuardInterrupt( 126 MUST_USE_RESULT static MaybeObject* HandleStackGuardInterrupt(
132 Isolate* isolate); 127 Isolate* isolate);
133 128
134 // Get a function delegate (or undefined) for the given non-function 129 // Get a function delegate (or undefined) for the given non-function
135 // object. Used for support calling objects as functions. 130 // object. Used for support calling objects as functions.
136 static Handle<Object> GetFunctionDelegate(Isolate* isolate, 131 static Handle<Object> GetFunctionDelegate(Isolate* isolate,
137 Handle<Object> object); 132 Handle<Object> object);
138 static Handle<Object> TryGetFunctionDelegate(Isolate* isolate, 133 MUST_USE_RESULT static MaybeHandle<Object> TryGetFunctionDelegate(
139 Handle<Object> object, 134 Isolate* isolate,
140 bool* has_pending_exception); 135 Handle<Object> object);
141 136
142 // Get a function delegate (or undefined) for the given non-function 137 // Get a function delegate (or undefined) for the given non-function
143 // object. Used for support calling objects as constructors. 138 // object. Used for support calling objects as constructors.
144 static Handle<Object> GetConstructorDelegate(Isolate* isolate, 139 static Handle<Object> GetConstructorDelegate(Isolate* isolate,
145 Handle<Object> object); 140 Handle<Object> object);
146 static Handle<Object> TryGetConstructorDelegate(Isolate* isolate, 141 static MaybeHandle<Object> TryGetConstructorDelegate(Isolate* isolate,
147 Handle<Object> object, 142 Handle<Object> object);
148 bool* has_pending_exception);
149 143
150 static void RunMicrotasks(Isolate* isolate); 144 static void RunMicrotasks(Isolate* isolate);
151 static void EnqueueMicrotask(Isolate* isolate, Handle<Object> microtask); 145 static void EnqueueMicrotask(Isolate* isolate, Handle<Object> microtask);
152 }; 146 };
153 147
154 148
155 class ExecutionAccess; 149 class ExecutionAccess;
156 150
157 151
158 // StackGuard contains the handling of the limits that are used to limit the 152 // 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; 297 friend class Isolate;
304 friend class StackLimitCheck; 298 friend class StackLimitCheck;
305 friend class PostponeInterruptsScope; 299 friend class PostponeInterruptsScope;
306 300
307 DISALLOW_COPY_AND_ASSIGN(StackGuard); 301 DISALLOW_COPY_AND_ASSIGN(StackGuard);
308 }; 302 };
309 303
310 } } // namespace v8::internal 304 } } // namespace v8::internal
311 305
312 #endif // V8_EXECUTION_H_ 306 #endif // V8_EXECUTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698