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 3173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3184 * of the property access. | 3184 * of the property access. |
3185 */ | 3185 */ |
3186 template<typename T> | 3186 template<typename T> |
3187 class PropertyCallbackInfo { | 3187 class PropertyCallbackInfo { |
3188 public: | 3188 public: |
3189 V8_INLINE Isolate* GetIsolate() const; | 3189 V8_INLINE Isolate* GetIsolate() const; |
3190 V8_INLINE Local<Value> Data() const; | 3190 V8_INLINE Local<Value> Data() const; |
3191 V8_INLINE Local<Object> This() const; | 3191 V8_INLINE Local<Object> This() const; |
3192 V8_INLINE Local<Object> Holder() const; | 3192 V8_INLINE Local<Object> Holder() const; |
3193 V8_INLINE ReturnValue<T> GetReturnValue() const; | 3193 V8_INLINE ReturnValue<T> GetReturnValue() const; |
3194 V8_INLINE bool ShouldThrowOnError() const; | |
3195 // This shouldn't be public, but the arm compiler needs it. | 3194 // This shouldn't be public, but the arm compiler needs it. |
3196 static const int kArgsLength = 7; | 3195 static const int kArgsLength = 6; |
3197 | 3196 |
3198 protected: | 3197 protected: |
3199 friend class MacroAssembler; | 3198 friend class MacroAssembler; |
3200 friend class internal::PropertyCallbackArguments; | 3199 friend class internal::PropertyCallbackArguments; |
3201 friend class internal::CustomArguments<PropertyCallbackInfo>; | 3200 friend class internal::CustomArguments<PropertyCallbackInfo>; |
3202 static const int kShouldThrowOnErrorIndex = 0; | 3201 static const int kHolderIndex = 0; |
3203 static const int kHolderIndex = 1; | 3202 static const int kIsolateIndex = 1; |
3204 static const int kIsolateIndex = 2; | 3203 static const int kReturnValueDefaultValueIndex = 2; |
3205 static const int kReturnValueDefaultValueIndex = 3; | 3204 static const int kReturnValueIndex = 3; |
3206 static const int kReturnValueIndex = 4; | 3205 static const int kDataIndex = 4; |
3207 static const int kDataIndex = 5; | 3206 static const int kThisIndex = 5; |
3208 static const int kThisIndex = 6; | |
3209 | 3207 |
3210 V8_INLINE PropertyCallbackInfo(internal::Object** args) : args_(args) {} | 3208 V8_INLINE PropertyCallbackInfo(internal::Object** args) : args_(args) {} |
3211 internal::Object** args_; | 3209 internal::Object** args_; |
3212 }; | 3210 }; |
3213 | 3211 |
3214 | 3212 |
3215 typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info); | 3213 typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info); |
3216 | 3214 |
3217 | 3215 |
3218 /** | 3216 /** |
(...skipping 5038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8257 Local<Object> PropertyCallbackInfo<T>::Holder() const { | 8255 Local<Object> PropertyCallbackInfo<T>::Holder() const { |
8258 return Local<Object>(reinterpret_cast<Object*>(&args_[kHolderIndex])); | 8256 return Local<Object>(reinterpret_cast<Object*>(&args_[kHolderIndex])); |
8259 } | 8257 } |
8260 | 8258 |
8261 | 8259 |
8262 template<typename T> | 8260 template<typename T> |
8263 ReturnValue<T> PropertyCallbackInfo<T>::GetReturnValue() const { | 8261 ReturnValue<T> PropertyCallbackInfo<T>::GetReturnValue() const { |
8264 return ReturnValue<T>(&args_[kReturnValueIndex]); | 8262 return ReturnValue<T>(&args_[kReturnValueIndex]); |
8265 } | 8263 } |
8266 | 8264 |
8267 template <typename T> | |
8268 bool PropertyCallbackInfo<T>::ShouldThrowOnError() const { | |
8269 typedef internal::Internals I; | |
8270 return args_[kShouldThrowOnErrorIndex] != I::IntToSmi(0); | |
8271 } | |
8272 | |
8273 | 8265 |
8274 Local<Primitive> Undefined(Isolate* isolate) { | 8266 Local<Primitive> Undefined(Isolate* isolate) { |
8275 typedef internal::Object* S; | 8267 typedef internal::Object* S; |
8276 typedef internal::Internals I; | 8268 typedef internal::Internals I; |
8277 I::CheckInitialized(isolate); | 8269 I::CheckInitialized(isolate); |
8278 S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex); | 8270 S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex); |
8279 return Local<Primitive>(reinterpret_cast<Primitive*>(slot)); | 8271 return Local<Primitive>(reinterpret_cast<Primitive*>(slot)); |
8280 } | 8272 } |
8281 | 8273 |
8282 | 8274 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8523 */ | 8515 */ |
8524 | 8516 |
8525 | 8517 |
8526 } // namespace v8 | 8518 } // namespace v8 |
8527 | 8519 |
8528 | 8520 |
8529 #undef TYPE_CHECK | 8521 #undef TYPE_CHECK |
8530 | 8522 |
8531 | 8523 |
8532 #endif // INCLUDE_V8_H_ | 8524 #endif // INCLUDE_V8_H_ |
OLD | NEW |