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; | |
3142 V8_INLINE Local<Object> This() const; | 3141 V8_INLINE Local<Object> This() const; |
3143 V8_INLINE Local<Object> Holder() const; | 3142 V8_INLINE Local<Object> Holder() const; |
3144 V8_INLINE bool IsConstructCall() const; | 3143 V8_INLINE bool IsConstructCall() const; |
3145 V8_INLINE Local<Value> Data() const; | 3144 V8_INLINE Local<Value> Data() const; |
3146 V8_INLINE Isolate* GetIsolate() const; | 3145 V8_INLINE Isolate* GetIsolate() const; |
3147 V8_INLINE ReturnValue<T> GetReturnValue() const; | 3146 V8_INLINE ReturnValue<T> GetReturnValue() const; |
3148 // This shouldn't be public, but the arm compiler needs it. | 3147 // This shouldn't be public, but the arm compiler needs it. |
3149 static const int kArgsLength = 7; | 3148 static const int kArgsLength = 6; |
3150 | 3149 |
3151 protected: | 3150 protected: |
3152 friend class internal::FunctionCallbackArguments; | 3151 friend class internal::FunctionCallbackArguments; |
3153 friend class internal::CustomArguments<FunctionCallbackInfo>; | 3152 friend class internal::CustomArguments<FunctionCallbackInfo>; |
3154 static const int kHolderIndex = 0; | 3153 static const int kHolderIndex = 0; |
3155 static const int kIsolateIndex = 1; | 3154 static const int kIsolateIndex = 1; |
3156 static const int kReturnValueDefaultValueIndex = 2; | 3155 static const int kReturnValueDefaultValueIndex = 2; |
3157 static const int kReturnValueIndex = 3; | 3156 static const int kReturnValueIndex = 3; |
3158 static const int kDataIndex = 4; | 3157 static const int kDataIndex = 4; |
3159 static const int kCalleeIndex = 5; | 3158 static const int kContextSaveIndex = 5; |
3160 static const int kContextSaveIndex = 6; | |
3161 | 3159 |
3162 V8_INLINE FunctionCallbackInfo(internal::Object** implicit_args, | 3160 V8_INLINE FunctionCallbackInfo(internal::Object** implicit_args, |
3163 internal::Object** values, | 3161 internal::Object** values, |
3164 int length, | 3162 int length, |
3165 bool is_construct_call); | 3163 bool is_construct_call); |
3166 internal::Object** implicit_args_; | 3164 internal::Object** implicit_args_; |
3167 internal::Object** values_; | 3165 internal::Object** values_; |
3168 int length_; | 3166 int length_; |
3169 int is_construct_call_; | 3167 int is_construct_call_; |
3170 }; | 3168 }; |
(...skipping 4407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7578 | 7576 |
7579 | 7577 |
7580 template<typename T> | 7578 template<typename T> |
7581 Local<Value> FunctionCallbackInfo<T>::operator[](int i) const { | 7579 Local<Value> FunctionCallbackInfo<T>::operator[](int i) const { |
7582 if (i < 0 || length_ <= i) return Local<Value>(*Undefined(GetIsolate())); | 7580 if (i < 0 || length_ <= i) return Local<Value>(*Undefined(GetIsolate())); |
7583 return Local<Value>(reinterpret_cast<Value*>(values_ - i)); | 7581 return Local<Value>(reinterpret_cast<Value*>(values_ - i)); |
7584 } | 7582 } |
7585 | 7583 |
7586 | 7584 |
7587 template<typename T> | 7585 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> | |
7595 Local<Object> FunctionCallbackInfo<T>::This() const { | 7586 Local<Object> FunctionCallbackInfo<T>::This() const { |
7596 return Local<Object>(reinterpret_cast<Object*>(values_ + 1)); | 7587 return Local<Object>(reinterpret_cast<Object*>(values_ + 1)); |
7597 } | 7588 } |
7598 | 7589 |
7599 | 7590 |
7600 template<typename T> | 7591 template<typename T> |
7601 Local<Object> FunctionCallbackInfo<T>::Holder() const { | 7592 Local<Object> FunctionCallbackInfo<T>::Holder() const { |
7602 return Local<Object>(reinterpret_cast<Object*>( | 7593 return Local<Object>(reinterpret_cast<Object*>( |
7603 &implicit_args_[kHolderIndex])); | 7594 &implicit_args_[kHolderIndex])); |
7604 } | 7595 } |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8468 */ | 8459 */ |
8469 | 8460 |
8470 | 8461 |
8471 } // namespace v8 | 8462 } // namespace v8 |
8472 | 8463 |
8473 | 8464 |
8474 #undef TYPE_CHECK | 8465 #undef TYPE_CHECK |
8475 | 8466 |
8476 | 8467 |
8477 #endif // V8_H_ | 8468 #endif // V8_H_ |
OLD | NEW |