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