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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 : public CustomArguments<FunctionCallbackInfo<Value> > { | 208 : public CustomArguments<FunctionCallbackInfo<Value> > { |
209 public: | 209 public: |
210 typedef FunctionCallbackInfo<Value> T; | 210 typedef FunctionCallbackInfo<Value> T; |
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; | |
219 static const int kContextSaveIndex = T::kContextSaveIndex; | 218 static const int kContextSaveIndex = T::kContextSaveIndex; |
220 | 219 |
221 FunctionCallbackArguments(internal::Isolate* isolate, | 220 FunctionCallbackArguments(internal::Isolate* isolate, |
222 internal::Object* data, | 221 internal::Object* data, |
223 internal::JSFunction* callee, | |
224 internal::Object* holder, | 222 internal::Object* holder, |
225 internal::Object** argv, | 223 internal::Object** argv, |
226 int argc, | 224 int argc, |
227 bool is_construct_call) | 225 bool is_construct_call) |
228 : Super(isolate), | 226 : Super(isolate), |
229 argv_(argv), | 227 argv_(argv), |
230 argc_(argc), | 228 argc_(argc), |
231 is_construct_call_(is_construct_call) { | 229 is_construct_call_(is_construct_call) { |
232 Object** values = begin(); | 230 Object** values = begin(); |
233 values[T::kDataIndex] = data; | 231 values[T::kDataIndex] = data; |
234 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()); | |
244 DCHECK(values[T::kHolderIndex]->IsHeapObject()); | 240 DCHECK(values[T::kHolderIndex]->IsHeapObject()); |
245 DCHECK(values[T::kIsolateIndex]->IsSmi()); | 241 DCHECK(values[T::kIsolateIndex]->IsSmi()); |
246 } | 242 } |
247 | 243 |
248 /* | 244 /* |
249 * The following Call function wraps the calling of all callbacks to handle | 245 * 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 | 246 * calling either the old or the new style callbacks depending on which one |
251 * has been registered. | 247 * has been registered. |
252 * For old callbacks which return an empty handle, the ReturnValue is checked | 248 * 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. | 249 * and used if it's been set to anything inside the callback. |
(...skipping 29 matching lines...) Expand all Loading... |
283 | 279 |
284 | 280 |
285 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) | 281 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) |
286 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ | 282 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ |
287 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) | 283 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) |
288 | 284 |
289 } // namespace internal | 285 } // namespace internal |
290 } // namespace v8 | 286 } // namespace v8 |
291 | 287 |
292 #endif // V8_ARGUMENTS_H_ | 288 #endif // V8_ARGUMENTS_H_ |
OLD | NEW |