Fix Scoped(Value) assignment/construction on 32-bit
authorSimon Hausmann <simon.hausmann@digia.com>
Thu, 17 Jul 2014 09:03:08 +0000 (11:03 +0200)
committerSimon Hausmann <simon.hausmann@digia.com>
Tue, 22 Jul 2014 11:49:20 +0000 (13:49 +0200)
Make sure to also set the tag value correctly.

Change-Id: I3c6589d25b3a20f255581fb4c9248abfe6af3594
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/jsruntime/qv4objectiterator.cpp
src/qml/jsruntime/qv4scopedvalue_p.h

index 581380a..216700f 100644 (file)
@@ -56,6 +56,10 @@ ObjectIterator::ObjectIterator(Value *scratch1, Value *scratch2, Object *o, uint
 {
     object->o = o;
     current->o = o;
+#if QT_POINTER_SIZE == 4
+    object->tag = QV4::Value::Managed_Type;
+    current->tag = QV4::Value::Managed_Type;
+#endif
 
     if (object->as<ArgumentsObject>()) {
         Scope scope(object->engine());
@@ -73,6 +77,10 @@ ObjectIterator::ObjectIterator(Scope &scope, Object *o, uint flags)
 {
     object->o = o;
     current->o = o;
+#if QT_POINTER_SIZE == 4
+    object->tag = QV4::Value::Managed_Type;
+    current->tag = QV4::Value::Managed_Type;
+#endif
 
     if (object->as<ArgumentsObject>()) {
         Scope scope(object->engine());
index 6045ea5..563d097 100644 (file)
@@ -121,6 +121,9 @@ struct ScopedValue
     {
         ptr = scope.engine->jsStackTop++;
         ptr->m = reinterpret_cast<Managed *>(o);
+#if QT_POINTER_SIZE == 4
+        ptr->tag = QV4::Value::Managed_Type;
+#endif
 #ifndef QT_NO_DEBUG
         ++scope.size;
 #endif
@@ -161,6 +164,9 @@ struct ScopedValue
 
     ScopedValue &operator=(HeapObject *o) {
         ptr->m = reinterpret_cast<Managed *>(o);
+#if QT_POINTER_SIZE == 4
+        ptr->tag = QV4::Value::Managed_Type;
+#endif
         return *this;
     }
 
@@ -233,6 +239,9 @@ struct Scoped
     {
         Value v;
         v.m = reinterpret_cast<Managed *>(o);
+#if QT_POINTER_SIZE == 4
+        v.tag = QV4::Value::Managed_Type;
+#endif
         ptr = scope.engine->jsStackTop++;
         setPointer(value_cast<T>(v));
 #ifndef QT_NO_DEBUG
@@ -307,6 +316,9 @@ struct Scoped
     Scoped<T> &operator=(HeapObject *o) {
         Value v;
         v.m = reinterpret_cast<Managed *>(o);
+#if QT_POINTER_SIZE == 4
+        v.tag = QV4::Value::Managed_Type;
+#endif
         setPointer(value_cast<T>(v));
         return *this;
     }