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 /** \mainpage V8 API Reference Guide | 5 /** \mainpage V8 API Reference Guide |
6 * | 6 * |
7 * V8 is Google's open source JavaScript engine. | 7 * V8 is Google's open source JavaScript engine. |
8 * | 8 * |
9 * This set of documents provides reference material generated from the | 9 * This set of documents provides reference material generated from the |
10 * V8 header file, include/v8.h. | 10 * V8 header file, include/v8.h. |
(...skipping 3120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3131 * The argument information given to function call callbacks. This | 3131 * The argument information given to function call callbacks. This |
3132 * class provides access to information about the context of the call, | 3132 * class provides access to information about the context of the call, |
3133 * including the receiver, the number and values of arguments, and | 3133 * including the receiver, the number and values of arguments, and |
3134 * the holder of the function. | 3134 * the holder of the function. |
3135 */ | 3135 */ |
3136 template<typename T> | 3136 template<typename T> |
3137 class FunctionCallbackInfo { | 3137 class FunctionCallbackInfo { |
3138 public: | 3138 public: |
3139 V8_INLINE int Length() const; | 3139 V8_INLINE int Length() const; |
3140 V8_INLINE Local<Value> operator[](int i) const; | 3140 V8_INLINE Local<Value> operator[](int i) const; |
| 3141 V8_INLINE Local<Function> Callee() const; |
3141 V8_INLINE Local<Object> This() const; | 3142 V8_INLINE Local<Object> This() const; |
3142 V8_INLINE Local<Object> Holder() const; | 3143 V8_INLINE Local<Object> Holder() const; |
3143 V8_INLINE bool IsConstructCall() const; | 3144 V8_INLINE bool IsConstructCall() const; |
3144 V8_INLINE Local<Value> Data() const; | 3145 V8_INLINE Local<Value> Data() const; |
3145 V8_INLINE Isolate* GetIsolate() const; | 3146 V8_INLINE Isolate* GetIsolate() const; |
3146 V8_INLINE ReturnValue<T> GetReturnValue() const; | 3147 V8_INLINE ReturnValue<T> GetReturnValue() const; |
3147 // This shouldn't be public, but the arm compiler needs it. | 3148 // This shouldn't be public, but the arm compiler needs it. |
3148 static const int kArgsLength = 6; | 3149 static const int kArgsLength = 7; |
3149 | 3150 |
3150 protected: | 3151 protected: |
3151 friend class internal::FunctionCallbackArguments; | 3152 friend class internal::FunctionCallbackArguments; |
3152 friend class internal::CustomArguments<FunctionCallbackInfo>; | 3153 friend class internal::CustomArguments<FunctionCallbackInfo>; |
3153 static const int kHolderIndex = 0; | 3154 static const int kHolderIndex = 0; |
3154 static const int kIsolateIndex = 1; | 3155 static const int kIsolateIndex = 1; |
3155 static const int kReturnValueDefaultValueIndex = 2; | 3156 static const int kReturnValueDefaultValueIndex = 2; |
3156 static const int kReturnValueIndex = 3; | 3157 static const int kReturnValueIndex = 3; |
3157 static const int kDataIndex = 4; | 3158 static const int kDataIndex = 4; |
3158 static const int kContextSaveIndex = 5; | 3159 static const int kCalleeIndex = 5; |
| 3160 static const int kContextSaveIndex = 6; |
3159 | 3161 |
3160 V8_INLINE FunctionCallbackInfo(internal::Object** implicit_args, | 3162 V8_INLINE FunctionCallbackInfo(internal::Object** implicit_args, |
3161 internal::Object** values, | 3163 internal::Object** values, |
3162 int length, | 3164 int length, |
3163 bool is_construct_call); | 3165 bool is_construct_call); |
3164 internal::Object** implicit_args_; | 3166 internal::Object** implicit_args_; |
3165 internal::Object** values_; | 3167 internal::Object** values_; |
3166 int length_; | 3168 int length_; |
3167 int is_construct_call_; | 3169 int is_construct_call_; |
3168 }; | 3170 }; |
(...skipping 4407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7576 | 7578 |
7577 | 7579 |
7578 template<typename T> | 7580 template<typename T> |
7579 Local<Value> FunctionCallbackInfo<T>::operator[](int i) const { | 7581 Local<Value> FunctionCallbackInfo<T>::operator[](int i) const { |
7580 if (i < 0 || length_ <= i) return Local<Value>(*Undefined(GetIsolate())); | 7582 if (i < 0 || length_ <= i) return Local<Value>(*Undefined(GetIsolate())); |
7581 return Local<Value>(reinterpret_cast<Value*>(values_ - i)); | 7583 return Local<Value>(reinterpret_cast<Value*>(values_ - i)); |
7582 } | 7584 } |
7583 | 7585 |
7584 | 7586 |
7585 template<typename T> | 7587 template<typename T> |
| 7588 Local<Function> FunctionCallbackInfo<T>::Callee() const { |
| 7589 return Local<Function>(reinterpret_cast<Function*>( |
| 7590 &implicit_args_[kCalleeIndex])); |
| 7591 } |
| 7592 |
| 7593 |
| 7594 template<typename T> |
7586 Local<Object> FunctionCallbackInfo<T>::This() const { | 7595 Local<Object> FunctionCallbackInfo<T>::This() const { |
7587 return Local<Object>(reinterpret_cast<Object*>(values_ + 1)); | 7596 return Local<Object>(reinterpret_cast<Object*>(values_ + 1)); |
7588 } | 7597 } |
7589 | 7598 |
7590 | 7599 |
7591 template<typename T> | 7600 template<typename T> |
7592 Local<Object> FunctionCallbackInfo<T>::Holder() const { | 7601 Local<Object> FunctionCallbackInfo<T>::Holder() const { |
7593 return Local<Object>(reinterpret_cast<Object*>( | 7602 return Local<Object>(reinterpret_cast<Object*>( |
7594 &implicit_args_[kHolderIndex])); | 7603 &implicit_args_[kHolderIndex])); |
7595 } | 7604 } |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8459 */ | 8468 */ |
8460 | 8469 |
8461 | 8470 |
8462 } // namespace v8 | 8471 } // namespace v8 |
8463 | 8472 |
8464 | 8473 |
8465 #undef TYPE_CHECK | 8474 #undef TYPE_CHECK |
8466 | 8475 |
8467 | 8476 |
8468 #endif // V8_H_ | 8477 #endif // V8_H_ |
OLD | NEW |