Remove all references to the old v4 code
authorLars Knoll <lars.knoll@digia.com>
Thu, 23 May 2013 13:23:06 +0000 (15:23 +0200)
committerSimon Hausmann <simon.hausmann@digia.com>
Thu, 23 May 2013 13:33:29 +0000 (15:33 +0200)
The old v4 files have already been removed, so cleanup
all the #ifdef'ed code that still references them.

Change-Id: Ifc5c59add5af36a61586a43b13291d7836cccd78
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
src/qml/debugger/qv8debugservice.cpp
src/qml/qml/qqmlabstractbinding.cpp
src/qml/qml/qqmlcompiler.cpp
src/qml/qml/qqmlcompiler_p.h
src/qml/qml/qqmlcontext.cpp
src/qml/qml/qqmlcontext_p.h
src/qml/qml/qqmlinstruction.cpp
src/qml/qml/qqmlinstruction_p.h
src/qml/qml/qqmlnotifier.cpp
src/qml/qml/qqmlvme.cpp

index ad4519b..f0f7f7a 100644 (file)
@@ -189,9 +189,6 @@ void QV8DebugService::init()
 //    ### FIXME: v4
 //    v8::Debug::SetMessageHandler2(DebugMessageHandler);
 //    v8::Debug::SetDebugMessageDispatchHandler(DebugMessageDispatchHandler);
-#ifdef QT_USE_OLD_V4
-    QV4Compiler::enableV4(false);
-#endif
 }
 
 // executed in the gui thread
index bf37fd7..168d519 100644 (file)
@@ -49,18 +49,10 @@ QT_BEGIN_NAMESPACE
 
 extern QQmlAbstractBinding::VTable QQmlBinding_vtable;
 extern QQmlAbstractBinding::VTable QQmlValueTypeProxyBinding_vtable;
-#ifdef QT_USE_OLD_V4
-extern QQmlAbstractBinding::VTable QV4Bindings_Binding_vtable;
-#endif
 extern QQmlAbstractBinding::VTable QV8Bindings_Binding_vtable;
 
 QQmlAbstractBinding::VTable *QQmlAbstractBinding::vTables[] = {
     &QQmlBinding_vtable,
-#ifdef QT_USE_OLD_V4
-    &QV4Bindings_Binding_vtable,
-#else
-    0,
-#endif
     &QV8Bindings_Binding_vtable,
     &QQmlValueTypeProxyBinding_vtable
 };
index 5467bfa..a1da778 100644 (file)
@@ -60,9 +60,6 @@
 #include "qqmlscriptstring.h"
 #include "qqmlglobal_p.h"
 #include "qqmlbinding_p.h"
-#ifdef QT_USE_OLD_V4
-#include <private/qv4compiler_p.h>
-#endif
 
 #include <QDebug>
 #include <QPointF>
@@ -3547,37 +3544,6 @@ void QQmlCompiler::genBindingAssignment(QQmlScript::Value *binding,
         output->addInstruction(store);
     } else
 #endif
-#ifdef QT_USE_OLD_V4
-    if (ref.dataType == BindingReference::V4) {
-        const JSBindingReference &js = static_cast<const JSBindingReference &>(ref);
-
-        Instruction::StoreV4Binding store;
-        store.value = js.compiledIndex;
-        store.fallbackValue = js.sharedIndex;
-        store.context = js.bindingContext.stack;
-        store.owner = js.bindingContext.owner;
-        store.isAlias = prop->isAlias;
-        if (valueTypeProperty) {
-            store.property = ((prop->index << 16) | valueTypeProperty->index);
-            store.propType = valueTypeProperty->type;
-            store.isRoot = (compileState->root == valueTypeProperty->parent);
-        } else {
-            store.property = prop->index;
-            store.propType = 0;
-            store.isRoot = (compileState->root == obj);
-        }
-        store.line = binding->location.start.line;
-        store.column = binding->location.start.column;
-        output->addInstruction(store);
-
-        if (store.fallbackValue > -1) {
-            //also create v8 instruction (needed to properly configure the fallback v8 binding)
-            JSBindingReference &js = static_cast<JSBindingReference &>(*binding->bindingReference);
-            js.dataType = BindingReference::V8;
-            genBindingAssignment(binding, prop, obj, valueTypeProperty);
-        }
-    } else
-#endif
     if (ref.dataType == BindingReference::V8) {
         const JSBindingReference &js = static_cast<const JSBindingReference &>(ref);
 
@@ -3669,45 +3635,12 @@ bool QQmlCompiler::completeComponentBuild()
          aliasObject = compileState->aliasingObjects.next(aliasObject)) 
         COMPILE_CHECK(buildDynamicMetaAliases(aliasObject));
 
-#ifdef QT_USE_OLD_V4
-    QV4Compiler::Expression expr(unit->imports());
-    expr.component = compileState->root;
-    expr.ids = &compileState->ids;
-    expr.importCache = output->importCache;
-
-    QV4Compiler bindingCompiler;
-#endif
-
     QList<JSBindingReference*> sharedBindings;
 
     for (JSBindingReference *b = compileState->bindings.first(); b; b = b->nextReference) {
 
         JSBindingReference &binding = *b;
 
-        // First try v4
-#ifdef QT_USE_OLD_V4
-        expr.context = binding.bindingContext.object;
-        expr.property = binding.property;
-        expr.expression = binding.expression;
-
-        bool needsFallback = false;
-        int index = bindingCompiler.compile(expr, enginePrivate, &needsFallback);
-        if (index != -1) {
-            binding.dataType = BindingReference::V4;
-            binding.compiledIndex = index;
-            binding.sharedIndex = -1;
-            if (componentStats)
-                componentStats->componentStat.optimizedBindings.append(b->value->location);
-
-            if (!needsFallback)
-                continue;
-
-            // Drop through. We need to create a V8 binding in case the V4 binding is invalidated
-        }
-#else
-        bool needsFallback = false;
-#endif
-
         // Pre-rewrite the expression
         QString expression = binding.expression.asScript();
 
@@ -3721,15 +3654,12 @@ bool QQmlCompiler::completeComponentBuild()
         if (isSharable && binding.property->type != qMetaTypeId<QQmlBinding*>()) {
             sharedBindings.append(b);
 
-            if (!needsFallback) {
-                binding.dataType = BindingReference::V8;
-                binding.compiledIndex = -1;
+            binding.dataType = BindingReference::V8;
+            binding.compiledIndex = -1;
 
-                if (componentStats)
-                    componentStats->componentStat.sharedBindings.append(b->value->location);
-            }
+            if (componentStats)
+                componentStats->componentStat.sharedBindings.append(b->value->location);
         } else {
-            Q_ASSERT(!needsFallback);
             binding.dataType = BindingReference::QtScript;
 
             if (componentStats)
@@ -3775,10 +3705,6 @@ bool QQmlCompiler::completeComponentBuild()
         compileState->v8BindingProgramLine = startLineNumber;
     }
 
-#ifdef QT_USE_OLD_V4
-    if (bindingCompiler.isValid())
-        compileState->compiledBindingData = bindingCompiler.program();
-#endif
 
     // Check pop()'s matched push()'s
     Q_ASSERT(compileState->objectDepth.depth() == 0);
index 01d4035..b25850a 100644 (file)
@@ -187,7 +187,7 @@ namespace QQmlCompilerTypes {
 
     struct BindingReference
     {
-        enum DataType { QtScript, V4, V8,
+        enum DataType { QtScript, V8,
                         Tr, TrId };
         DataType dataType;
     };
index 9b196a6..3899f45 100644 (file)
@@ -48,9 +48,6 @@
 #include "qqmlengine_p.h"
 #include "qqmlengine.h"
 #include "qqmlinfo.h"
-#ifdef QT_USE_OLD_V4
-#include <private/qv4bindings_p.h>
-#endif
 #include <private/qv8bindings_p.h>
 
 #include <qjsengine.h>
@@ -521,9 +518,6 @@ QQmlContextData::QQmlContextData()
   propertyNames(0), contextObject(0), imports(0), childContexts(0), nextChild(0), prevChild(0),
   expressions(0), contextObjects(0), contextGuards(0), idValues(0), idValueCount(0), linkedContext(0),
   componentAttached(0),
-#ifdef QT_USE_OLD_V4
-  v4bindings(0),
-#endif
   v8bindings(0)
 {
 }
@@ -535,9 +529,6 @@ QQmlContextData::QQmlContextData(QQmlContext *ctxt)
   propertyNames(0), contextObject(0), imports(0), childContexts(0), nextChild(0), prevChild(0),
   expressions(0), contextObjects(0), contextGuards(0), idValues(0), idValueCount(0), linkedContext(0),
   componentAttached(0),
-#ifdef QT_USE_OLD_V4
-  v4bindings(0),
-#endif
   v8bindings(0)
 {
 }
@@ -646,11 +637,6 @@ void QQmlContextData::destroy()
     if (imports)
         imports->release();
 
-#ifdef QT_USE_OLD_V4
-    if (v4bindings)
-        v4bindings->release();
-#endif
-
     if (v8bindings)
         v8bindings->release();
 
index ef91c57..88e67f1 100644 (file)
@@ -82,9 +82,6 @@ class QQmlEngine;
 class QQmlExpression;
 class QQmlExpressionPrivate;
 class QQmlAbstractExpression;
-#ifdef QT_USE_OLD_V4
-class QV4Bindings;
-#endif
 class QQmlContextData;
 
 class QQmlContextPrivate : public QObjectPrivate
@@ -213,10 +210,6 @@ public:
     // context
     QQmlComponentAttached *componentAttached;
 
-    // Optimized binding objects.  Needed for deferred properties.
-#ifdef QT_USE_OLD_V4
-    QV4Bindings *v4bindings;
-#endif
     QV8Bindings *v8bindings;
 
     // Return the outermost id for obj, if any.
index 998726e..8c321c8 100644 (file)
@@ -227,11 +227,6 @@ void QQmlCompiledData::dump(QQmlInstruction *instr, int idx)
     case QQmlInstruction::StoreBinding:
         qWarning().nospace() << idx << "\t\t" << "STORE_BINDING\t" << instr->assignBinding.property.coreIndex << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
         break;
-#ifdef QT_USE_OLD_V4
-    case QQmlInstruction::StoreV4Binding:
-        qWarning().nospace() << idx << "\t\t" << "STORE_COMPILED_BINDING\t" << instr->assignV4Binding.property << "\t" << instr->assignV4Binding.value << "\t" << instr->assignV4Binding.context;
-        break;
-#endif
     case QQmlInstruction::StoreV8Binding:
         qWarning().nospace() << idx << "\t\t" << "STORE_V8_BINDING\t" << instr->assignBinding.property.coreIndex << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
         break;
index a13d564..9380ee3 100644 (file)
 
 QT_BEGIN_NAMESPACE
 
-#ifdef QT_USE_OLD_V4
-#define FV4(x, y) F(x,y)
-#else
-#define FV4(x, y)
-#endif
-
 #define FOR_EACH_QML_INSTR(F) \
     F(Init, init) \
     F(DeferInit, deferInit) \
@@ -125,7 +119,6 @@ QT_BEGIN_NAMESPACE
     F(InitV8Bindings, initV8Bindings) \
     F(StoreBinding, assignBinding) \
     F(StoreV8Binding, assignBinding) \
-    FV4(StoreV4Binding, assignV4Binding) \
     F(StoreValueSource, assignValueSource) \
     F(StoreValueInterceptor, assignValueInterceptor) \
     F(StoreObjectQList, common) \
index 7e9b6b4..da016c9 100644 (file)
@@ -51,18 +51,12 @@ typedef void (*Callback)(QQmlNotifierEndpoint *, void **);
 void QQmlBoundSignal_callback(QQmlNotifierEndpoint *, void **);
 void QQmlJavaScriptExpressionGuard_callback(QQmlNotifierEndpoint *, void **);
 void QQmlVMEMetaObjectEndpoint_callback(QQmlNotifierEndpoint *, void **);
-#ifdef QT_USE_OLD_V4
-void QV4BindingsSubscription_callback(QQmlNotifierEndpoint *, void **);
-#endif
 
 static Callback QQmlNotifier_callbacks[] = {
     0,
     QQmlBoundSignal_callback,
     QQmlJavaScriptExpressionGuard_callback,
     QQmlVMEMetaObjectEndpoint_callback
-#ifdef QT_USE_OLD_V4
-    , QV4BindingsSubscription_callback
-#endif
 };
 
 void QQmlNotifier::emitNotify(QQmlNotifierEndpoint *endpoint, void **a)
index f322096..0c89e0a 100644 (file)
@@ -57,9 +57,6 @@
 #include "qqmlcomponent_p.h"
 #include "qqmlvmemetaobject_p.h"
 #include "qqmlcontext_p.h"
-#ifdef QT_USE_OLD_V4
-#include <private/qv4bindings_p.h>
-#endif
 #include <private/qv8bindings_p.h>
 #include "qqmlglobal_p.h"
 #include <private/qfinitestack_p.h>
@@ -444,12 +441,6 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
             CTXT->setParent(parentCtxt);
             if (instr.contextCache != -1) 
                 CTXT->setIdPropertyData(COMP->contextCaches.at(instr.contextCache));
-#ifdef QT_USE_OLD_V4
-            if (instr.compiledBinding != -1) {
-                const char *v4data = DATAS.at(instr.compiledBinding).constData();
-                CTXT->v4bindings = new QV4Bindings(v4data, CTXT);
-            }
-#endif
             if (states.count() == 1) {
                 rootContext = CTXT;
                 rootContext->activeVMEData = data;
@@ -839,47 +830,6 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
             }
         QML_END_INSTR(StoreBinding)
 
-#ifdef QT_USE_OLD_V4
-        QML_BEGIN_INSTR(StoreV4Binding)
-            QObject *target =
-                objects.at(objects.count() - 1 - instr.owner);
-            QObject *scope =
-                objects.at(objects.count() - 1 - instr.context);
-
-            int propertyIdx = (instr.property & 0x0000FFFF);
-
-            if (instr.isRoot && BINDINGSKIPLIST.testBit(propertyIdx))
-                QML_NEXT_INSTR(StoreV4Binding);
-
-            QQmlAbstractBinding *binding = CTXT->v4bindings->configBinding(target, scope, &instr);
-            bindValues.push(binding);
-            binding->m_mePtr = &bindValues.top();
-
-            if (instr.isAlias) {
-                QQmlAbstractBinding *old =
-                    QQmlPropertyPrivate::setBindingNoEnable(target,
-                                                            propertyIdx,
-                                                            instr.propType ? (instr.property >> 16) : -1,
-                                                            binding);
-                if (old) { old->destroy(); }
-            } else {
-                Q_ASSERT(binding->propertyIndex() == instr.property);
-                Q_ASSERT(binding->object() == target);
-
-                CLEAN_PROPERTY(target, instr.property);
-
-                binding->addToObject();
-
-                if (instr.propType == 0) {
-                    // All non-valuetype V4 bindings are safe bindings
-                    QQmlData *data = QQmlData::get(target);
-                    Q_ASSERT(data);
-                    data->setPendingBindingBit(target, propertyIdx);
-                }
-            }
-        QML_END_INSTR(StoreV4Binding)
-#endif
-
         QML_BEGIN_INSTR(StoreV8Binding)
             QObject *target = 
                 objects.at(objects.count() - 1 - instr.owner);