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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 if (!that.IsEmpty()) T::Cast(*that); | 690 if (!that.IsEmpty()) T::Cast(*that); |
691 #endif | 691 #endif |
692 return reinterpret_cast<Persistent<T>&>(that); | 692 return reinterpret_cast<Persistent<T>&>(that); |
693 } | 693 } |
694 | 694 |
695 // TODO(dcarney): this is pretty useless, fix or remove | 695 // TODO(dcarney): this is pretty useless, fix or remove |
696 template <class S> V8_INLINE Persistent<S>& As() { // NOLINT | 696 template <class S> V8_INLINE Persistent<S>& As() { // NOLINT |
697 return Persistent<S>::Cast(*this); | 697 return Persistent<S>::Cast(*this); |
698 } | 698 } |
699 | 699 |
700 // This will be removed. | |
701 V8_INLINE T* ClearAndLeak(); | |
702 | |
703 private: | 700 private: |
704 friend class Isolate; | 701 friend class Isolate; |
705 friend class Utils; | 702 friend class Utils; |
706 template<class F> friend class Handle; | 703 template<class F> friend class Handle; |
707 template<class F> friend class Local; | 704 template<class F> friend class Local; |
708 template<class F1, class F2> friend class Persistent; | 705 template<class F1, class F2> friend class Persistent; |
709 template<class F> friend class ReturnValue; | 706 template<class F> friend class ReturnValue; |
710 | 707 |
711 template <class S> V8_INLINE Persistent(S* that) : PersistentBase<T>(that) { } | 708 template <class S> V8_INLINE Persistent(S* that) : PersistentBase<T>(that) { } |
712 V8_INLINE T* operator*() const { return this->val_; } | 709 V8_INLINE T* operator*() const { return this->val_; } |
(...skipping 5506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6219 template <class T> | 6216 template <class T> |
6220 void PersistentBase<T>::MarkPartiallyDependent() { | 6217 void PersistentBase<T>::MarkPartiallyDependent() { |
6221 typedef internal::Internals I; | 6218 typedef internal::Internals I; |
6222 if (this->IsEmpty()) return; | 6219 if (this->IsEmpty()) return; |
6223 I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_), | 6220 I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_), |
6224 true, | 6221 true, |
6225 I::kNodeIsPartiallyDependentShift); | 6222 I::kNodeIsPartiallyDependentShift); |
6226 } | 6223 } |
6227 | 6224 |
6228 | 6225 |
6229 template <class T, class M> | |
6230 T* Persistent<T, M>::ClearAndLeak() { | |
6231 T* old; | |
6232 old = this->val_; | |
6233 this->val_ = NULL; | |
6234 return old; | |
6235 } | |
6236 | |
6237 | |
6238 template <class T> | 6226 template <class T> |
6239 void PersistentBase<T>::SetWrapperClassId(uint16_t class_id) { | 6227 void PersistentBase<T>::SetWrapperClassId(uint16_t class_id) { |
6240 typedef internal::Internals I; | 6228 typedef internal::Internals I; |
6241 if (this->IsEmpty()) return; | 6229 if (this->IsEmpty()) return; |
6242 internal::Object** obj = reinterpret_cast<internal::Object**>(this->val_); | 6230 internal::Object** obj = reinterpret_cast<internal::Object**>(this->val_); |
6243 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset; | 6231 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset; |
6244 *reinterpret_cast<uint16_t*>(addr) = class_id; | 6232 *reinterpret_cast<uint16_t*>(addr) = class_id; |
6245 } | 6233 } |
6246 | 6234 |
6247 | 6235 |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7042 */ | 7030 */ |
7043 | 7031 |
7044 | 7032 |
7045 } // namespace v8 | 7033 } // namespace v8 |
7046 | 7034 |
7047 | 7035 |
7048 #undef TYPE_CHECK | 7036 #undef TYPE_CHECK |
7049 | 7037 |
7050 | 7038 |
7051 #endif // V8_H_ | 7039 #endif // V8_H_ |
OLD | NEW |