OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2838 template <typename S> V8_INLINE(void Set(const Persistent<S>& handle)); | 2838 template <typename S> V8_INLINE(void Set(const Persistent<S>& handle)); |
2839 template <typename S> V8_INLINE(void Set(const Handle<S> handle)); | 2839 template <typename S> V8_INLINE(void Set(const Handle<S> handle)); |
2840 // Fast primitive setters | 2840 // Fast primitive setters |
2841 V8_INLINE(void Set(bool value)); | 2841 V8_INLINE(void Set(bool value)); |
2842 V8_INLINE(void Set(double i)); | 2842 V8_INLINE(void Set(double i)); |
2843 V8_INLINE(void Set(int32_t i)); | 2843 V8_INLINE(void Set(int32_t i)); |
2844 V8_INLINE(void Set(uint32_t i)); | 2844 V8_INLINE(void Set(uint32_t i)); |
2845 // Fast JS primitive setters | 2845 // Fast JS primitive setters |
2846 V8_INLINE(void SetNull()); | 2846 V8_INLINE(void SetNull()); |
2847 V8_INLINE(void SetUndefined()); | 2847 V8_INLINE(void SetUndefined()); |
| 2848 V8_INLINE(void SetEmptyString()); |
2848 // Convenience getter for Isolate | 2849 // Convenience getter for Isolate |
2849 V8_INLINE(Isolate* GetIsolate()); | 2850 V8_INLINE(Isolate* GetIsolate()); |
2850 | 2851 |
2851 private: | 2852 private: |
2852 template<class F> friend class ReturnValue; | 2853 template<class F> friend class ReturnValue; |
2853 template<class F> friend class FunctionCallbackInfo; | 2854 template<class F> friend class FunctionCallbackInfo; |
2854 template<class F> friend class PropertyCallbackInfo; | 2855 template<class F> friend class PropertyCallbackInfo; |
2855 V8_INLINE(internal::Object* GetDefaultValue()); | 2856 V8_INLINE(internal::Object* GetDefaultValue()); |
2856 V8_INLINE(explicit ReturnValue(internal::Object** slot)); | 2857 V8_INLINE(explicit ReturnValue(internal::Object** slot)); |
2857 internal::Object** value_; | 2858 internal::Object** value_; |
(...skipping 2865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5723 *value_ = *I::GetRoot(GetIsolate(), I::kNullValueRootIndex); | 5724 *value_ = *I::GetRoot(GetIsolate(), I::kNullValueRootIndex); |
5724 } | 5725 } |
5725 | 5726 |
5726 template<typename T> | 5727 template<typename T> |
5727 void ReturnValue<T>::SetUndefined() { | 5728 void ReturnValue<T>::SetUndefined() { |
5728 typedef internal::Internals I; | 5729 typedef internal::Internals I; |
5729 *value_ = *I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex); | 5730 *value_ = *I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex); |
5730 } | 5731 } |
5731 | 5732 |
5732 template<typename T> | 5733 template<typename T> |
| 5734 void ReturnValue<T>::SetEmptyString() { |
| 5735 typedef internal::Internals I; |
| 5736 *value_ = *I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex); |
| 5737 } |
| 5738 |
| 5739 template<typename T> |
5733 Isolate* ReturnValue<T>::GetIsolate() { | 5740 Isolate* ReturnValue<T>::GetIsolate() { |
5734 // Isolate is always the pointer below the default value on the stack. | 5741 // Isolate is always the pointer below the default value on the stack. |
5735 return *reinterpret_cast<Isolate**>(&value_[-2]); | 5742 return *reinterpret_cast<Isolate**>(&value_[-2]); |
5736 } | 5743 } |
5737 | 5744 |
5738 template<typename T> | 5745 template<typename T> |
5739 internal::Object* ReturnValue<T>::GetDefaultValue() { | 5746 internal::Object* ReturnValue<T>::GetDefaultValue() { |
5740 // Default value is always the pointer below value_ on the stack. | 5747 // Default value is always the pointer below value_ on the stack. |
5741 return value_[-1]; | 5748 return value_[-1]; |
5742 } | 5749 } |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6327 | 6334 |
6328 | 6335 |
6329 } // namespace v8 | 6336 } // namespace v8 |
6330 | 6337 |
6331 | 6338 |
6332 #undef V8EXPORT | 6339 #undef V8EXPORT |
6333 #undef TYPE_CHECK | 6340 #undef TYPE_CHECK |
6334 | 6341 |
6335 | 6342 |
6336 #endif // V8_H_ | 6343 #endif // V8_H_ |
OLD | NEW |