Cleanup: Get rid of String and Object pointers in Value
authorSimon Hausmann <simon.hausmann@digia.com>
Wed, 23 Jul 2014 10:37:17 +0000 (12:37 +0200)
committerSimon Hausmann <simon.hausmann@digia.com>
Tue, 4 Nov 2014 05:03:28 +0000 (06:03 +0100)
Change-Id: I4f007d0437c9a5cc79fe35d960d40557366d46fe
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/jsruntime/qv4objectiterator.cpp
src/qml/jsruntime/qv4runtime.cpp
src/qml/jsruntime/qv4value_p.h

index f903847..f9ccb8f 100644 (file)
@@ -68,15 +68,15 @@ ObjectIterator::ObjectIterator(Value *scratch1, Value *scratch2, uint flags)
     , memberIndex(0)
     , flags(flags)
 {
-    object->o = (Object*)0;
-    current->o = (Object*)0;
+    object->m = (Object*)0;
+    current->m = (Object*)0;
     // Caller needs to call init!
 }
 
 void ObjectIterator::init(Object *o)
 {
-    object->o = o;
-    current->o = o;
+    object->m = o;
+    current->m = o;
 
 #if QT_POINTER_SIZE == 4
     object->tag = QV4::Value::Managed_Type;
@@ -126,9 +126,9 @@ void ObjectIterator::next(String *&name, uint *index, Property *pd, PropertyAttr
         }
 
         if (flags & WithProtoChain)
-            current->o = current->objectValue()->prototype();
+            current->m = current->objectValue()->prototype();
         else
-            current->o = (Object *)0;
+            current->m = (Object *)0;
 
         arrayIndex = 0;
         memberIndex = 0;
index f72f25b..cb7e219 100644 (file)
@@ -881,7 +881,9 @@ ReturnedValue Runtime::callActivationProperty(ExecutionContext *context, String
     Scope scope(context);
 
     ScopedObject base(scope);
-    ScopedValue func(scope, context->getPropertyAndBase(name, base.ptr->o));
+    Object *baseObj = base.ptr->objectValue();
+    ScopedValue func(scope, context->getPropertyAndBase(name, baseObj));
+    base.ptr->m = baseObj;
     if (scope.engine->hasException)
         return Encode::undefined();
 
index 59a4543..f215162 100644 (file)
@@ -87,8 +87,6 @@ struct Q_QML_PRIVATE_EXPORT Value
         quint64 val;
 #if QT_POINTER_SIZE == 8
         Managed *m;
-        Object *o;
-        String *s;
 #else
         double dbl;
 #endif
@@ -101,8 +99,6 @@ struct Q_QML_PRIVATE_EXPORT Value
                 int int_32;
 #if QT_POINTER_SIZE == 4
                 Managed *m;
-                Object *o;
-                String *s;
 #endif
             };
 #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
@@ -270,10 +266,10 @@ struct Q_QML_PRIVATE_EXPORT Value
     }
 
     String *stringValue() const {
-        return s;
+        return reinterpret_cast<String*>(m);
     }
     Object *objectValue() const {
-        return o;
+        return reinterpret_cast<Object*>(m);
     }
     Managed *managed() const {
         return m;
@@ -283,7 +279,7 @@ struct Q_QML_PRIVATE_EXPORT Value
         return val;
     }
 
-    static inline Value fromManaged(Managed *o);
+    static inline Value fromManaged(Managed *m);
 
     int toUInt16() const;
     inline int toInt32() const;