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

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

Powered by Google App Engine
This is Rietveld 408576698