From 3dbf4e9a6979802fff55e2f5e6aa54a14280e128 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 15 Jan 2015 21:28:01 +0100 Subject: Cleanups Remove duplicated methods. Remove some mostly unused methods, and simplify some others. Change-Id: I605b249e54417bb32c3dfc8e22f2c8b6b684a1e1 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4scopedvalue_p.h | 44 ++++++------------------------------ 1 file changed, 7 insertions(+), 37 deletions(-) (limited to 'src/qml/jsruntime/qv4scopedvalue_p.h') diff --git a/src/qml/jsruntime/qv4scopedvalue_p.h b/src/qml/jsruntime/qv4scopedvalue_p.h index 81b81f6c5c..6fc04cc289 100644 --- a/src/qml/jsruntime/qv4scopedvalue_p.h +++ b/src/qml/jsruntime/qv4scopedvalue_p.h @@ -169,7 +169,7 @@ struct ScopedValue } ScopedValue &operator=(Managed *m) { - ptr->val = m->asReturnedValue(); + *ptr = *m; return *this; } @@ -194,8 +194,6 @@ struct ScopedValue operator Value *() { return ptr; } operator const Value &() const { return *ptr; } - ReturnedValue asReturnedValue() const { return ptr->val; } - Value *ptr; }; @@ -203,13 +201,11 @@ template struct Scoped { enum _Convert { Convert }; - enum _Cast { Cast }; inline void setPointer(Managed *p) { -#if QT_POINTER_SIZE == 8 ptr->m = p ? p->m : 0; -#else - *ptr = QV4::Value::fromManaged(p); +#if QT_POINTER_SIZE == 4 + ptr->tag = QV4::Value::Managed_Type; #endif } @@ -237,10 +233,7 @@ struct Scoped Scoped(const Scope &scope, Heap::Base *o) { Value v; - v.m = o; -#if QT_POINTER_SIZE == 4 - v.tag = QV4::Value::Managed_Type; -#endif + v = o; ptr = scope.engine->jsStackTop++; setPointer(value_cast(v)); #ifndef QT_NO_DEBUG @@ -290,15 +283,6 @@ struct Scoped ++scope.size; #endif } - template - Scoped(const Scope &scope, X *t, _Cast) - { - ptr = scope.engine->jsStackTop++; - setPointer(managed_cast(t)); -#ifndef QT_NO_DEBUG - ++scope.size; -#endif - } Scoped(const Scope &scope, const ReturnedValue &v) { @@ -319,10 +303,7 @@ struct Scoped Scoped &operator=(Heap::Base *o) { Value v; - v.m = o; -#if QT_POINTER_SIZE == 4 - v.tag = QV4::Value::Managed_Type; -#endif + v = o; setPointer(value_cast(v)); return *this; } @@ -373,18 +354,14 @@ struct Scoped } T *getPointer() { - return static_cast(ptr->managed()); + return ptr->cast(); } typename T::Data **getRef() { return reinterpret_cast(&ptr->m); } ReturnedValue asReturnedValue() const { -#if QT_POINTER_SIZE == 8 - return ptr->val ? ptr->val : Primitive::undefinedValue().asReturnedValue(); -#else - return ptr->val; -#endif + return ptr->m ? ptr->val : Encode::undefined(); } Value *ptr; @@ -444,13 +421,6 @@ inline TypedValue &TypedValue::operator =(const Scoped &v) return *this; } -//template -//inline TypedValue &TypedValue::operator =(const ManagedRef &v) -//{ -// val = v.asReturnedValue(); -// return *this; -//} - template inline TypedValue &TypedValue::operator=(const TypedValue &t) { -- cgit v1.2.3