aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-04-19 22:45:05 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-04-20 09:15:30 +0200
commitb9b6755ff8d89a24ea142c482494fa9f78c8229e (patch)
tree34c4f1fa85488933d5bcc476f92ff082178629bd
parent8109d47545a488ead9fac525968c360abb1fd23e (diff)
Disable the old v4 engine by default
Left the code in there, as a reference for how we might want to build up binding evaluation in the new v4. Change-Id: I5c81ea986d642b524fb02087d819b39c4e3fb257 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r--src/qml/debugger/qv8debugservice.cpp2
-rw-r--r--src/qml/qml/qml.pri5
-rw-r--r--src/qml/qml/qqmlabstractbinding.cpp6
-rw-r--r--src/qml/qml/qqmlcompiler.cpp17
-rw-r--r--src/qml/qml/qqmlcontext.cpp16
-rw-r--r--src/qml/qml/qqmlcontext_p.h4
-rw-r--r--src/qml/qml/qqmlinstruction.cpp2
-rw-r--r--src/qml/qml/qqmlinstruction_p.h8
-rw-r--r--src/qml/qml/qqmlnotifier.cpp8
-rw-r--r--src/qml/qml/qqmlvme.cpp10
10 files changed, 68 insertions, 10 deletions
diff --git a/src/qml/debugger/qv8debugservice.cpp b/src/qml/debugger/qv8debugservice.cpp
index d9d4323d00..babc6ce118 100644
--- a/src/qml/debugger/qv8debugservice.cpp
+++ b/src/qml/debugger/qv8debugservice.cpp
@@ -191,7 +191,9 @@ 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
diff --git a/src/qml/qml/qml.pri b/src/qml/qml/qml.pri
index d0026d409b..304e08de92 100644
--- a/src/qml/qml/qml.pri
+++ b/src/qml/qml/qml.pri
@@ -130,6 +130,9 @@ HEADERS += \
include(parser/parser.pri)
include(rewriter/rewriter.pri)
include(ftw/ftw.pri)
-include(v4/v4.pri)
+use_old_v4 {
+ include(v4/v4.pri)
+ DEFINES += QT_USE_OLD_V4
+}
include(v8/v8.pri)
include(v4vm/v4vm.pri)
diff --git a/src/qml/qml/qqmlabstractbinding.cpp b/src/qml/qml/qqmlabstractbinding.cpp
index 695dbfbf87..bf37fd7bc3 100644
--- a/src/qml/qml/qqmlabstractbinding.cpp
+++ b/src/qml/qml/qqmlabstractbinding.cpp
@@ -49,12 +49,18 @@ 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
};
diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp
index 6951c8c387..5467bfac19 100644
--- a/src/qml/qml/qqmlcompiler.cpp
+++ b/src/qml/qml/qqmlcompiler.cpp
@@ -60,7 +60,9 @@
#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>
@@ -3545,6 +3547,7 @@ 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);
@@ -3573,7 +3576,9 @@ void QQmlCompiler::genBindingAssignment(QQmlScript::Value *binding,
js.dataType = BindingReference::V8;
genBindingAssignment(binding, prop, obj, valueTypeProperty);
}
- } else if (ref.dataType == BindingReference::V8) {
+ } else
+#endif
+ if (ref.dataType == BindingReference::V8) {
const JSBindingReference &js = static_cast<const JSBindingReference &>(ref);
Instruction::StoreV8Binding store;
@@ -3664,12 +3669,14 @@ 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;
@@ -3678,6 +3685,7 @@ bool QQmlCompiler::completeComponentBuild()
JSBindingReference &binding = *b;
// First try v4
+#ifdef QT_USE_OLD_V4
expr.context = binding.bindingContext.object;
expr.property = binding.property;
expr.expression = binding.expression;
@@ -3696,6 +3704,9 @@ bool QQmlCompiler::completeComponentBuild()
// 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();
@@ -3764,8 +3775,10 @@ bool QQmlCompiler::completeComponentBuild()
compileState->v8BindingProgramLine = startLineNumber;
}
- if (bindingCompiler.isValid())
+#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);
diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp
index e0a16d1f44..b865ff055b 100644
--- a/src/qml/qml/qqmlcontext.cpp
+++ b/src/qml/qml/qqmlcontext.cpp
@@ -48,7 +48,9 @@
#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>
@@ -518,7 +520,11 @@ QQmlContextData::QQmlContextData()
publicContext(0), activeVMEData(0),
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), v4bindings(0), v8bindings(0)
+ componentAttached(0),
+#ifdef QT_USE_OLD_V4
+ v4bindings(0),
+#endif
+ v8bindings(0)
{
}
@@ -528,7 +534,11 @@ QQmlContextData::QQmlContextData(QQmlContext *ctxt)
publicContext(ctxt), activeVMEData(0),
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), v4bindings(0), v8bindings(0)
+ componentAttached(0),
+#ifdef QT_USE_OLD_V4
+ v4bindings(0),
+#endif
+ v8bindings(0)
{
}
@@ -636,8 +646,10 @@ void QQmlContextData::destroy()
if (imports)
imports->release();
+#ifdef QT_USE_OLD_V4
if (v4bindings)
v4bindings->release();
+#endif
if (v8bindings)
v8bindings->release();
diff --git a/src/qml/qml/qqmlcontext_p.h b/src/qml/qml/qqmlcontext_p.h
index b19c64fe1c..10105bd7d6 100644
--- a/src/qml/qml/qqmlcontext_p.h
+++ b/src/qml/qml/qqmlcontext_p.h
@@ -82,7 +82,9 @@ class QQmlEngine;
class QQmlExpression;
class QQmlExpressionPrivate;
class QQmlAbstractExpression;
+#ifdef QT_USE_OLD_V4
class QV4Bindings;
+#endif
class QQmlContextData;
class QQmlContextPrivate : public QObjectPrivate
@@ -212,7 +214,9 @@ public:
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.
diff --git a/src/qml/qml/qqmlinstruction.cpp b/src/qml/qml/qqmlinstruction.cpp
index c2eba72a4e..998726ec16 100644
--- a/src/qml/qml/qqmlinstruction.cpp
+++ b/src/qml/qml/qqmlinstruction.cpp
@@ -227,9 +227,11 @@ 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;
diff --git a/src/qml/qml/qqmlinstruction_p.h b/src/qml/qml/qqmlinstruction_p.h
index 328b246b4f..a13d56466d 100644
--- a/src/qml/qml/qqmlinstruction_p.h
+++ b/src/qml/qml/qqmlinstruction_p.h
@@ -58,6 +58,12 @@
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) \
@@ -119,7 +125,7 @@ QT_BEGIN_NAMESPACE
F(InitV8Bindings, initV8Bindings) \
F(StoreBinding, assignBinding) \
F(StoreV8Binding, assignBinding) \
- F(StoreV4Binding, assignV4Binding) \
+ FV4(StoreV4Binding, assignV4Binding) \
F(StoreValueSource, assignValueSource) \
F(StoreValueInterceptor, assignValueInterceptor) \
F(StoreObjectQList, common) \
diff --git a/src/qml/qml/qqmlnotifier.cpp b/src/qml/qml/qqmlnotifier.cpp
index 3253a5f0e8..7e9b6b4052 100644
--- a/src/qml/qml/qqmlnotifier.cpp
+++ b/src/qml/qml/qqmlnotifier.cpp
@@ -51,14 +51,18 @@ 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,
- QV4BindingsSubscription_callback
+ QQmlVMEMetaObjectEndpoint_callback
+#ifdef QT_USE_OLD_V4
+ , QV4BindingsSubscription_callback
+#endif
};
void QQmlNotifier::emitNotify(QQmlNotifierEndpoint *endpoint, void **a)
diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp
index 8198eeca66..91c2226248 100644
--- a/src/qml/qml/qqmlvme.cpp
+++ b/src/qml/qml/qqmlvme.cpp
@@ -57,7 +57,9 @@
#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>
@@ -446,10 +448,12 @@ 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;
@@ -841,10 +845,11 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
}
QML_END_INSTR(StoreBinding)
+#ifdef QT_USE_OLD_V4
QML_BEGIN_INSTR(StoreV4Binding)
- QObject *target =
+ QObject *target =
objects.at(objects.count() - 1 - instr.owner);
- QObject *scope =
+ QObject *scope =
objects.at(objects.count() - 1 - instr.context);
int propertyIdx = (instr.property & 0x0000FFFF);
@@ -879,6 +884,7 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
}
}
QML_END_INSTR(StoreV4Binding)
+#endif
QML_BEGIN_INSTR(StoreV8Binding)
QObject *target =