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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 typedef CustomArguments<T> Super; | 213 typedef CustomArguments<T> Super; |
214 static const int kArgsLength = T::kArgsLength; | 214 static const int kArgsLength = T::kArgsLength; |
215 static const int kHolderIndex = T::kHolderIndex; | 215 static const int kHolderIndex = T::kHolderIndex; |
216 static const int kDataIndex = T::kDataIndex; | 216 static const int kDataIndex = T::kDataIndex; |
217 static const int kReturnValueDefaultValueIndex = | 217 static const int kReturnValueDefaultValueIndex = |
218 T::kReturnValueDefaultValueIndex; | 218 T::kReturnValueDefaultValueIndex; |
219 static const int kIsolateIndex = T::kIsolateIndex; | 219 static const int kIsolateIndex = T::kIsolateIndex; |
220 static const int kCalleeIndex = T::kCalleeIndex; | 220 static const int kCalleeIndex = T::kCalleeIndex; |
221 static const int kContextSaveIndex = T::kContextSaveIndex; | 221 static const int kContextSaveIndex = T::kContextSaveIndex; |
222 | 222 |
223 FunctionCallbackArguments(internal::Isolate* isolate, | 223 FunctionCallbackArguments(internal::Isolate* isolate, internal::Object* data, |
224 internal::Object* data, | 224 internal::HeapObject* callee, |
225 internal::JSFunction* callee, | 225 internal::Object* holder, internal::Object** argv, |
226 internal::Object* holder, | 226 int argc, bool is_construct_call) |
227 internal::Object** argv, | 227 : Super(isolate), |
228 int argc, | 228 argv_(argv), |
229 bool is_construct_call) | 229 argc_(argc), |
230 : Super(isolate), | 230 is_construct_call_(is_construct_call) { |
231 argv_(argv), | |
232 argc_(argc), | |
233 is_construct_call_(is_construct_call) { | |
234 Object** values = begin(); | 231 Object** values = begin(); |
235 values[T::kDataIndex] = data; | 232 values[T::kDataIndex] = data; |
236 values[T::kCalleeIndex] = callee; | 233 values[T::kCalleeIndex] = callee; |
237 values[T::kHolderIndex] = holder; | 234 values[T::kHolderIndex] = holder; |
238 values[T::kContextSaveIndex] = isolate->heap()->the_hole_value(); | 235 values[T::kContextSaveIndex] = isolate->heap()->the_hole_value(); |
239 values[T::kIsolateIndex] = reinterpret_cast<internal::Object*>(isolate); | 236 values[T::kIsolateIndex] = reinterpret_cast<internal::Object*>(isolate); |
240 // Here the hole is set as default value. | 237 // Here the hole is set as default value. |
241 // It cannot escape into js as it's remove in Call below. | 238 // It cannot escape into js as it's remove in Call below. |
242 values[T::kReturnValueDefaultValueIndex] = | 239 values[T::kReturnValueDefaultValueIndex] = |
243 isolate->heap()->the_hole_value(); | 240 isolate->heap()->the_hole_value(); |
244 values[T::kReturnValueIndex] = isolate->heap()->the_hole_value(); | 241 values[T::kReturnValueIndex] = isolate->heap()->the_hole_value(); |
245 DCHECK(values[T::kCalleeIndex]->IsJSFunction()); | 242 DCHECK(values[T::kCalleeIndex]->IsJSFunction() || |
| 243 values[T::kCalleeIndex]->IsFunctionTemplateInfo()); |
246 DCHECK(values[T::kHolderIndex]->IsHeapObject()); | 244 DCHECK(values[T::kHolderIndex]->IsHeapObject()); |
247 DCHECK(values[T::kIsolateIndex]->IsSmi()); | 245 DCHECK(values[T::kIsolateIndex]->IsSmi()); |
248 } | 246 } |
249 | 247 |
250 /* | 248 /* |
251 * The following Call function wraps the calling of all callbacks to handle | 249 * The following Call function wraps the calling of all callbacks to handle |
252 * calling either the old or the new style callbacks depending on which one | 250 * calling either the old or the new style callbacks depending on which one |
253 * has been registered. | 251 * has been registered. |
254 * For old callbacks which return an empty handle, the ReturnValue is checked | 252 * For old callbacks which return an empty handle, the ReturnValue is checked |
255 * and used if it's been set to anything inside the callback. | 253 * and used if it's been set to anything inside the callback. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) | 300 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) |
303 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ | 301 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ |
304 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) | 302 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) |
305 #define RUNTIME_FUNCTION_RETURN_TRIPLE(Name) \ | 303 #define RUNTIME_FUNCTION_RETURN_TRIPLE(Name) \ |
306 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectTriple, Name) | 304 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectTriple, Name) |
307 | 305 |
308 } // namespace internal | 306 } // namespace internal |
309 } // namespace v8 | 307 } // namespace v8 |
310 | 308 |
311 #endif // V8_ARGUMENTS_H_ | 309 #endif // V8_ARGUMENTS_H_ |
OLD | NEW |