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