// ### FIXME: v4
// v8::Debug::SetMessageHandler2(DebugMessageHandler);
// v8::Debug::SetDebugMessageDispatchHandler(DebugMessageDispatchHandler);
+#ifdef QT_USE_OLD_V4
QV4Compiler::enableV4(false);
+#endif
}
// executed in the gui thread
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)
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
};
#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>
output->addInstruction(store);
} else
#endif
+#ifdef QT_USE_OLD_V4
if (ref.dataType == BindingReference::V4) {
const JSBindingReference &js = static_cast<const JSBindingReference &>(ref);
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;
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;
JSBindingReference &binding = *b;
// First try v4
+#ifdef QT_USE_OLD_V4
expr.context = binding.bindingContext.object;
expr.property = binding.property;
expr.expression = binding.expression;
// 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();
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);
#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>
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)
{
}
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)
{
}
if (imports)
imports->release();
+#ifdef QT_USE_OLD_V4
if (v4bindings)
v4bindings->release();
+#endif
if (v8bindings)
v8bindings->release();
class QQmlExpression;
class QQmlExpressionPrivate;
class QQmlAbstractExpression;
+#ifdef QT_USE_OLD_V4
class QV4Bindings;
+#endif
class QQmlContextData;
class QQmlContextPrivate : public QObjectPrivate
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.
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;
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) \
F(InitV8Bindings, initV8Bindings) \
F(StoreBinding, assignBinding) \
F(StoreV8Binding, assignBinding) \
- F(StoreV4Binding, assignV4Binding) \
+ FV4(StoreV4Binding, assignV4Binding) \
F(StoreValueSource, assignValueSource) \
F(StoreValueInterceptor, assignValueInterceptor) \
F(StoreObjectQList, common) \
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)
#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>
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;
}
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);
}
}
QML_END_INSTR(StoreV4Binding)
+#endif
QML_BEGIN_INSTR(StoreV8Binding)
QObject *target =