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 2411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2422 V8_INLINE void Set(double i); | 2422 V8_INLINE void Set(double i); |
2423 V8_INLINE void Set(int32_t i); | 2423 V8_INLINE void Set(int32_t i); |
2424 V8_INLINE void Set(uint32_t i); | 2424 V8_INLINE void Set(uint32_t i); |
2425 // Fast JS primitive setters | 2425 // Fast JS primitive setters |
2426 V8_INLINE void SetNull(); | 2426 V8_INLINE void SetNull(); |
2427 V8_INLINE void SetUndefined(); | 2427 V8_INLINE void SetUndefined(); |
2428 V8_INLINE void SetEmptyString(); | 2428 V8_INLINE void SetEmptyString(); |
2429 // Convenience getter for Isolate | 2429 // Convenience getter for Isolate |
2430 V8_INLINE Isolate* GetIsolate(); | 2430 V8_INLINE Isolate* GetIsolate(); |
2431 | 2431 |
| 2432 // Pointer setter: Uncompilable to prevent inadvertent misuse. |
| 2433 template <typename S> |
| 2434 V8_INLINE void Set(S* whatever); |
| 2435 |
2432 private: | 2436 private: |
2433 template<class F> friend class ReturnValue; | 2437 template<class F> friend class ReturnValue; |
2434 template<class F> friend class FunctionCallbackInfo; | 2438 template<class F> friend class FunctionCallbackInfo; |
2435 template<class F> friend class PropertyCallbackInfo; | 2439 template<class F> friend class PropertyCallbackInfo; |
2436 template<class F, class G, class H> friend class PersistentValueMap; | 2440 template<class F, class G, class H> friend class PersistentValueMap; |
2437 V8_INLINE void SetInternal(internal::Object* value) { *value_ = value; } | 2441 V8_INLINE void SetInternal(internal::Object* value) { *value_ = value; } |
2438 V8_INLINE internal::Object* GetDefaultValue(); | 2442 V8_INLINE internal::Object* GetDefaultValue(); |
2439 V8_INLINE explicit ReturnValue(internal::Object** slot); | 2443 V8_INLINE explicit ReturnValue(internal::Object** slot); |
2440 internal::Object** value_; | 2444 internal::Object** value_; |
2441 }; | 2445 }; |
(...skipping 3525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5967 *value_ = *I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex); | 5971 *value_ = *I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex); |
5968 } | 5972 } |
5969 | 5973 |
5970 template<typename T> | 5974 template<typename T> |
5971 Isolate* ReturnValue<T>::GetIsolate() { | 5975 Isolate* ReturnValue<T>::GetIsolate() { |
5972 // Isolate is always the pointer below the default value on the stack. | 5976 // Isolate is always the pointer below the default value on the stack. |
5973 return *reinterpret_cast<Isolate**>(&value_[-2]); | 5977 return *reinterpret_cast<Isolate**>(&value_[-2]); |
5974 } | 5978 } |
5975 | 5979 |
5976 template<typename T> | 5980 template<typename T> |
| 5981 template<typename S> |
| 5982 void ReturnValue<T>::Set(S* whatever) { |
| 5983 // Uncompilable to prevent inadvertent misuse. |
| 5984 TYPE_CHECK(S*, Primitive); |
| 5985 } |
| 5986 |
| 5987 template<typename T> |
5977 internal::Object* ReturnValue<T>::GetDefaultValue() { | 5988 internal::Object* ReturnValue<T>::GetDefaultValue() { |
5978 // Default value is always the pointer below value_ on the stack. | 5989 // Default value is always the pointer below value_ on the stack. |
5979 return value_[-1]; | 5990 return value_[-1]; |
5980 } | 5991 } |
5981 | 5992 |
5982 | 5993 |
5983 template<typename T> | 5994 template<typename T> |
5984 FunctionCallbackInfo<T>::FunctionCallbackInfo(internal::Object** implicit_args, | 5995 FunctionCallbackInfo<T>::FunctionCallbackInfo(internal::Object** implicit_args, |
5985 internal::Object** values, | 5996 internal::Object** values, |
5986 int length, | 5997 int length, |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6623 */ | 6634 */ |
6624 | 6635 |
6625 | 6636 |
6626 } // namespace v8 | 6637 } // namespace v8 |
6627 | 6638 |
6628 | 6639 |
6629 #undef TYPE_CHECK | 6640 #undef TYPE_CHECK |
6630 | 6641 |
6631 | 6642 |
6632 #endif // V8_H_ | 6643 #endif // V8_H_ |
OLD | NEW |