OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_ARGUMENTS_H_ | 5 #ifndef V8_ARGUMENTS_H_ |
6 #define V8_ARGUMENTS_H_ | 6 #define V8_ARGUMENTS_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
10 | 10 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 typedef CustomArgumentsBase<T::kArgsLength> Super; | 122 typedef CustomArgumentsBase<T::kArgsLength> Super; |
123 ~CustomArguments() { | 123 ~CustomArguments() { |
124 this->begin()[kReturnValueOffset] = | 124 this->begin()[kReturnValueOffset] = |
125 reinterpret_cast<Object*>(kHandleZapValue); | 125 reinterpret_cast<Object*>(kHandleZapValue); |
126 } | 126 } |
127 | 127 |
128 protected: | 128 protected: |
129 explicit inline CustomArguments(Isolate* isolate) : Super(isolate) {} | 129 explicit inline CustomArguments(Isolate* isolate) : Super(isolate) {} |
130 | 130 |
131 template<typename V> | 131 template <typename V> |
132 v8::Handle<V> GetReturnValue(Isolate* isolate); | 132 v8::Local<V> GetReturnValue(Isolate* isolate); |
133 | 133 |
134 inline Isolate* isolate() { | 134 inline Isolate* isolate() { |
135 return reinterpret_cast<Isolate*>(this->begin()[T::kIsolateIndex]); | 135 return reinterpret_cast<Isolate*>(this->begin()[T::kIsolateIndex]); |
136 } | 136 } |
137 }; | 137 }; |
138 | 138 |
139 | 139 |
140 class PropertyCallbackArguments | 140 class PropertyCallbackArguments |
141 : public CustomArguments<PropertyCallbackInfo<Value> > { | 141 : public CustomArguments<PropertyCallbackInfo<Value> > { |
142 public: | 142 public: |
(...skipping 27 matching lines...) Expand all Loading... |
170 } | 170 } |
171 | 171 |
172 /* | 172 /* |
173 * The following Call functions wrap the calling of all callbacks to handle | 173 * The following Call functions wrap the calling of all callbacks to handle |
174 * calling either the old or the new style callbacks depending on which one | 174 * calling either the old or the new style callbacks depending on which one |
175 * has been registered. | 175 * has been registered. |
176 * For old callbacks which return an empty handle, the ReturnValue is checked | 176 * For old callbacks which return an empty handle, the ReturnValue is checked |
177 * and used if it's been set to anything inside the callback. | 177 * and used if it's been set to anything inside the callback. |
178 * New style callbacks always use the return value. | 178 * New style callbacks always use the return value. |
179 */ | 179 */ |
180 #define WRITE_CALL_0(Function, ReturnValue) \ | 180 #define WRITE_CALL_0(Function, ReturnValue) \ |
181 v8::Handle<ReturnValue> Call(Function f); \ | 181 v8::Local<ReturnValue> Call(Function f); |
182 | 182 |
183 #define WRITE_CALL_1(Function, ReturnValue, Arg1) \ | 183 #define WRITE_CALL_1(Function, ReturnValue, Arg1) \ |
184 v8::Handle<ReturnValue> Call(Function f, Arg1 arg1); \ | 184 v8::Local<ReturnValue> Call(Function f, Arg1 arg1); |
185 | 185 |
186 #define WRITE_CALL_2(Function, ReturnValue, Arg1, Arg2) \ | 186 #define WRITE_CALL_2(Function, ReturnValue, Arg1, Arg2) \ |
187 v8::Handle<ReturnValue> Call(Function f, Arg1 arg1, Arg2 arg2); \ | 187 v8::Local<ReturnValue> Call(Function f, Arg1 arg1, Arg2 arg2); |
188 | 188 |
189 #define WRITE_CALL_2_VOID(Function, ReturnValue, Arg1, Arg2) \ | 189 #define WRITE_CALL_2_VOID(Function, ReturnValue, Arg1, Arg2) \ |
190 void Call(Function f, Arg1 arg1, Arg2 arg2); \ | 190 void Call(Function f, Arg1 arg1, Arg2 arg2); \ |
191 | 191 |
192 FOR_EACH_CALLBACK_TABLE_MAPPING_0(WRITE_CALL_0) | 192 FOR_EACH_CALLBACK_TABLE_MAPPING_0(WRITE_CALL_0) |
193 FOR_EACH_CALLBACK_TABLE_MAPPING_1(WRITE_CALL_1) | 193 FOR_EACH_CALLBACK_TABLE_MAPPING_1(WRITE_CALL_1) |
194 FOR_EACH_CALLBACK_TABLE_MAPPING_2(WRITE_CALL_2) | 194 FOR_EACH_CALLBACK_TABLE_MAPPING_2(WRITE_CALL_2) |
195 FOR_EACH_CALLBACK_TABLE_MAPPING_2_VOID_RETURN(WRITE_CALL_2_VOID) | 195 FOR_EACH_CALLBACK_TABLE_MAPPING_2_VOID_RETURN(WRITE_CALL_2_VOID) |
196 | 196 |
197 #undef WRITE_CALL_0 | 197 #undef WRITE_CALL_0 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 } | 243 } |
244 | 244 |
245 /* | 245 /* |
246 * The following Call function wraps the calling of all callbacks to handle | 246 * The following Call function wraps the calling of all callbacks to handle |
247 * calling either the old or the new style callbacks depending on which one | 247 * calling either the old or the new style callbacks depending on which one |
248 * has been registered. | 248 * has been registered. |
249 * For old callbacks which return an empty handle, the ReturnValue is checked | 249 * For old callbacks which return an empty handle, the ReturnValue is checked |
250 * and used if it's been set to anything inside the callback. | 250 * and used if it's been set to anything inside the callback. |
251 * New style callbacks always use the return value. | 251 * New style callbacks always use the return value. |
252 */ | 252 */ |
253 v8::Handle<v8::Value> Call(FunctionCallback f); | 253 v8::Local<v8::Value> Call(FunctionCallback f); |
254 | 254 |
255 private: | 255 private: |
256 internal::Object** argv_; | 256 internal::Object** argv_; |
257 int argc_; | 257 int argc_; |
258 bool is_construct_call_; | 258 bool is_construct_call_; |
259 }; | 259 }; |
260 | 260 |
261 | 261 |
262 double ClobberDoubleRegisters(double x1, double x2, double x3, double x4); | 262 double ClobberDoubleRegisters(double x1, double x2, double x3, double x4); |
263 | 263 |
(...skipping 21 matching lines...) Expand all Loading... |
285 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) | 285 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) |
286 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ | 286 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ |
287 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) | 287 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) |
288 | 288 |
289 #define RUNTIME_ARGUMENTS(isolate, args) \ | 289 #define RUNTIME_ARGUMENTS(isolate, args) \ |
290 args.length(), args.arguments(), isolate | 290 args.length(), args.arguments(), isolate |
291 | 291 |
292 } } // namespace v8::internal | 292 } } // namespace v8::internal |
293 | 293 |
294 #endif // V8_ARGUMENTS_H_ | 294 #endif // V8_ARGUMENTS_H_ |
OLD | NEW |