| v8.h | | v8.h | |
| | | | |
| skipping to change at line 560 | | skipping to change at line 560 | |
| | | | |
| /** | | /** | |
| * "Casts" a plain handle which is known to be a persistent handle | | * "Casts" a plain handle which is known to be a persistent handle | |
| * to a persistent handle. | | * to a persistent handle. | |
| */ | | */ | |
| template <class S> explicit V8_INLINE(Persistent(Handle<S> that)) | | template <class S> explicit V8_INLINE(Persistent(Handle<S> that)) | |
| : Handle<T>(*that) { } | | : Handle<T>(*that) { } | |
| | | | |
| #endif | | #endif | |
| | | | |
|
| | | #ifdef V8_USE_UNSAFE_HANDLES | |
| template <class S> V8_INLINE(static Persistent<T> Cast(Persistent<S> that
)) { | | template <class S> V8_INLINE(static Persistent<T> Cast(Persistent<S> that
)) { | |
| #ifdef V8_ENABLE_CHECKS | | #ifdef V8_ENABLE_CHECKS | |
| // If we're going to perform the type check then we have to check | | // If we're going to perform the type check then we have to check | |
| // that the handle isn't empty before doing the checked cast. | | // that the handle isn't empty before doing the checked cast. | |
| if (that.IsEmpty()) return Persistent<T>(); | | if (that.IsEmpty()) return Persistent<T>(); | |
| #endif | | #endif | |
| return Persistent<T>(T::Cast(*that)); | | return Persistent<T>(T::Cast(*that)); | |
| } | | } | |
| | | | |
| template <class S> V8_INLINE(Persistent<S> As()) { | | template <class S> V8_INLINE(Persistent<S> As()) { | |
| return Persistent<S>::Cast(*this); | | return Persistent<S>::Cast(*this); | |
| } | | } | |
| | | | |
|
| | | #else | |
| | | template <class S> | |
| | | V8_INLINE(static Persistent<T>& Cast(Persistent<S>& that)) { // NOLINT | |
| | | #ifdef V8_ENABLE_CHECKS | |
| | | // If we're going to perform the type check then we have to check | |
| | | // that the handle isn't empty before doing the checked cast. | |
| | | if (!that.IsEmpty()) T::Cast(*that); | |
| | | #endif | |
| | | return reinterpret_cast<Persistent<T>&>(that); | |
| | | } | |
| | | | |
| | | template <class S> V8_INLINE(Persistent<S>& As()) { // NOLINT | |
| | | return Persistent<S>::Cast(*this); | |
| | | } | |
| | | #endif | |
| | | | |
| V8_DEPRECATED(static Persistent<T> New(Handle<T> that)); | | V8_DEPRECATED(static Persistent<T> New(Handle<T> that)); | |
| | | | |
| /** | | /** | |
| * Creates a new persistent handle for an existing local or persistent ha
ndle. | | * Creates a new persistent handle for an existing local or persistent ha
ndle. | |
| */ | | */ | |
| // TODO(dcarney): remove before cutover | | // TODO(dcarney): remove before cutover | |
| V8_INLINE(static Persistent<T> New(Isolate* isolate, Handle<T> that)); | | V8_INLINE(static Persistent<T> New(Isolate* isolate, Handle<T> that)); | |
| #ifndef V8_USE_UNSAFE_HANDLES | | #ifndef V8_USE_UNSAFE_HANDLES | |
| // TODO(dcarney): remove before cutover | | // TODO(dcarney): remove before cutover | |
| V8_INLINE(static Persistent<T> New(Isolate* isolate, Persistent<T> that))
; | | V8_INLINE(static Persistent<T> New(Isolate* isolate, Persistent<T> that))
; | |
| | | | |
| skipping to change at line 2730 | | skipping to change at line 2747 | |
| | | | |
| friend class ObjectTemplate; | | friend class ObjectTemplate; | |
| friend class FunctionTemplate; | | friend class FunctionTemplate; | |
| }; | | }; | |
| | | | |
| template<typename T> | | template<typename T> | |
| class ReturnValue { | | class ReturnValue { | |
| public: | | public: | |
| V8_INLINE(explicit ReturnValue(internal::Object** slot)); | | V8_INLINE(explicit ReturnValue(internal::Object** slot)); | |
| // Handle setters | | // Handle setters | |
|
| V8_INLINE(void Set(const Persistent<T>& handle)); | | template <typename S> V8_INLINE(void Set(const Persistent<S>& handle)); | |
| V8_INLINE(void Set(const Handle<T> handle)); | | template <typename S> V8_INLINE(void Set(const Handle<S> handle)); | |
| // Fast primitive setters | | // Fast primitive setters | |
| V8_INLINE(void Set(bool value)); | | V8_INLINE(void Set(bool value)); | |
| V8_INLINE(void Set(double i)); | | V8_INLINE(void Set(double i)); | |
| V8_INLINE(void Set(int32_t i)); | | V8_INLINE(void Set(int32_t i)); | |
| V8_INLINE(void Set(uint32_t i)); | | V8_INLINE(void Set(uint32_t i)); | |
| // Fast JS primitive setters | | // Fast JS primitive setters | |
| V8_INLINE(void SetNull()); | | V8_INLINE(void SetNull()); | |
| V8_INLINE(void SetUndefined()); | | V8_INLINE(void SetUndefined()); | |
| // Convenience getter for Isolate | | // Convenience getter for Isolate | |
| V8_INLINE(Isolate* GetIsolate()); | | V8_INLINE(Isolate* GetIsolate()); | |
| | | | |
| skipping to change at line 4826 | | skipping to change at line 4843 | |
| | | | |
| /** | | /** | |
| * Stack-allocated class which sets the execution context for all | | * Stack-allocated class which sets the execution context for all | |
| * operations executed within a local scope. | | * operations executed within a local scope. | |
| */ | | */ | |
| class Scope { | | class Scope { | |
| public: | | public: | |
| explicit V8_INLINE(Scope(Handle<Context> context)) : context_(context)
{ | | explicit V8_INLINE(Scope(Handle<Context> context)) : context_(context)
{ | |
| context_->Enter(); | | context_->Enter(); | |
| } | | } | |
|
| | | // TODO(dcarney): deprecate | |
| V8_INLINE(Scope(Isolate* isolate, Persistent<Context>& context)) // NOL
INT | | V8_INLINE(Scope(Isolate* isolate, Persistent<Context>& context)) // NOL
INT | |
| #ifndef V8_USE_UNSAFE_HANDLES | | #ifndef V8_USE_UNSAFE_HANDLES | |
| : context_(Handle<Context>::New(isolate, context)) { | | : context_(Handle<Context>::New(isolate, context)) { | |
| #else | | #else | |
| : context_(Local<Context>::New(isolate, context)) { | | : context_(Local<Context>::New(isolate, context)) { | |
| #endif | | #endif | |
| context_->Enter(); | | context_->Enter(); | |
| } | | } | |
| V8_INLINE(~Scope()) { context_->Exit(); } | | V8_INLINE(~Scope()) { context_->Exit(); } | |
| | | | |
| | | | |
| skipping to change at line 5553 | | skipping to change at line 5571 | |
| if (!I::IsInitialized(isolate)) return 0; | | if (!I::IsInitialized(isolate)) return 0; | |
| internal::Object** obj = reinterpret_cast<internal::Object**>(this->val_)
; | | internal::Object** obj = reinterpret_cast<internal::Object**>(this->val_)
; | |
| uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset; | | uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset; | |
| return *reinterpret_cast<uint16_t*>(addr); | | return *reinterpret_cast<uint16_t*>(addr); | |
| } | | } | |
| | | | |
| template<typename T> | | template<typename T> | |
| ReturnValue<T>::ReturnValue(internal::Object** slot) : value_(slot) {} | | ReturnValue<T>::ReturnValue(internal::Object** slot) : value_(slot) {} | |
| | | | |
| template<typename T> | | template<typename T> | |
|
| void ReturnValue<T>::Set(const Persistent<T>& handle) { | | template<typename S> | |
| | | void ReturnValue<T>::Set(const Persistent<S>& handle) { | |
| | | TYPE_CHECK(T, S); | |
| *value_ = *reinterpret_cast<internal::Object**>(*handle); | | *value_ = *reinterpret_cast<internal::Object**>(*handle); | |
| } | | } | |
| | | | |
| template<typename T> | | template<typename T> | |
|
| void ReturnValue<T>::Set(const Handle<T> handle) { | | template<typename S> | |
| | | void ReturnValue<T>::Set(const Handle<S> handle) { | |
| | | TYPE_CHECK(T, S); | |
| *value_ = *reinterpret_cast<internal::Object**>(*handle); | | *value_ = *reinterpret_cast<internal::Object**>(*handle); | |
| } | | } | |
| | | | |
| template<typename T> | | template<typename T> | |
| void ReturnValue<T>::Set(double i) { | | void ReturnValue<T>::Set(double i) { | |
| Set(Number::New(GetIsolate(), i)); | | Set(Number::New(GetIsolate(), i)); | |
| } | | } | |
| | | | |
| template<typename T> | | template<typename T> | |
| void ReturnValue<T>::Set(int32_t i) { | | void ReturnValue<T>::Set(int32_t i) { | |
| | | | |
End of changes. 6 change blocks. |
| 4 lines changed or deleted | | 26 lines changed or added | |
|