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 2440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2451 V8_INLINE void Set(double i); | 2451 V8_INLINE void Set(double i); |
2452 V8_INLINE void Set(int32_t i); | 2452 V8_INLINE void Set(int32_t i); |
2453 V8_INLINE void Set(uint32_t i); | 2453 V8_INLINE void Set(uint32_t i); |
2454 // Fast JS primitive setters | 2454 // Fast JS primitive setters |
2455 V8_INLINE void SetNull(); | 2455 V8_INLINE void SetNull(); |
2456 V8_INLINE void SetUndefined(); | 2456 V8_INLINE void SetUndefined(); |
2457 V8_INLINE void SetEmptyString(); | 2457 V8_INLINE void SetEmptyString(); |
2458 // Convenience getter for Isolate | 2458 // Convenience getter for Isolate |
2459 V8_INLINE Isolate* GetIsolate(); | 2459 V8_INLINE Isolate* GetIsolate(); |
2460 | 2460 |
2461 // Pointer setter: Uncompilable to prevent inadvertent misuse. | |
2462 void Set(void* whatever); | |
2463 | |
2464 private: | 2461 private: |
2465 template<class F> friend class ReturnValue; | 2462 template<class F> friend class ReturnValue; |
2466 template<class F> friend class FunctionCallbackInfo; | 2463 template<class F> friend class FunctionCallbackInfo; |
2467 template<class F> friend class PropertyCallbackInfo; | 2464 template<class F> friend class PropertyCallbackInfo; |
2468 template<class F, class G, class H> friend class PersistentValueMap; | 2465 template<class F, class G, class H> friend class PersistentValueMap; |
2469 V8_INLINE void SetInternal(internal::Object* value) { *value_ = value; } | 2466 V8_INLINE void SetInternal(internal::Object* value) { *value_ = value; } |
2470 V8_INLINE internal::Object* GetDefaultValue(); | 2467 V8_INLINE internal::Object* GetDefaultValue(); |
2471 V8_INLINE explicit ReturnValue(internal::Object** slot); | 2468 V8_INLINE explicit ReturnValue(internal::Object** slot); |
2472 internal::Object** value_; | 2469 internal::Object** value_; |
2473 }; | 2470 }; |
(...skipping 3503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5977 *value_ = *I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex); | 5974 *value_ = *I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex); |
5978 } | 5975 } |
5979 | 5976 |
5980 template<typename T> | 5977 template<typename T> |
5981 Isolate* ReturnValue<T>::GetIsolate() { | 5978 Isolate* ReturnValue<T>::GetIsolate() { |
5982 // Isolate is always the pointer below the default value on the stack. | 5979 // Isolate is always the pointer below the default value on the stack. |
5983 return *reinterpret_cast<Isolate**>(&value_[-2]); | 5980 return *reinterpret_cast<Isolate**>(&value_[-2]); |
5984 } | 5981 } |
5985 | 5982 |
5986 template<typename T> | 5983 template<typename T> |
5987 void ReturnValue<T>::Set(void* whatever) { | |
5988 // Uncompilable to prevent inadvertent misuse. | |
5989 TYPE_CHECK(void*, Primitive); | |
5990 } | |
5991 | |
5992 template<typename T> | |
5993 internal::Object* ReturnValue<T>::GetDefaultValue() { | 5984 internal::Object* ReturnValue<T>::GetDefaultValue() { |
5994 // Default value is always the pointer below value_ on the stack. | 5985 // Default value is always the pointer below value_ on the stack. |
5995 return value_[-1]; | 5986 return value_[-1]; |
5996 } | 5987 } |
5997 | 5988 |
5998 | 5989 |
5999 template<typename T> | 5990 template<typename T> |
6000 FunctionCallbackInfo<T>::FunctionCallbackInfo(internal::Object** implicit_args, | 5991 FunctionCallbackInfo<T>::FunctionCallbackInfo(internal::Object** implicit_args, |
6001 internal::Object** values, | 5992 internal::Object** values, |
6002 int length, | 5993 int length, |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6639 */ | 6630 */ |
6640 | 6631 |
6641 | 6632 |
6642 } // namespace v8 | 6633 } // namespace v8 |
6643 | 6634 |
6644 | 6635 |
6645 #undef TYPE_CHECK | 6636 #undef TYPE_CHECK |
6646 | 6637 |
6647 | 6638 |
6648 #endif // V8_H_ | 6639 #endif // V8_H_ |
OLD | NEW |