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