diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-06-10 04:16:19 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-06-10 04:16:19 (GMT) |
commit | b14a89473a51bee7cc2f313b88a8bc1e87a454d8 (patch) | |
tree | ed19f68437ab3d63570b7dc374357f898811d72a /src/declarative/qml/qmlcompiler_p.h | |
parent | 1ef0d84c8e5d706e60e487fc801f90bbf5fddaa6 (diff) | |
download | Qt-b14a89473a51bee7cc2f313b88a8bc1e87a454d8.zip Qt-b14a89473a51bee7cc2f313b88a8bc1e87a454d8.tar.gz Qt-b14a89473a51bee7cc2f313b88a8bc1e87a454d8.tar.bz2 |
Improve bindings startup performance
Diffstat (limited to 'src/declarative/qml/qmlcompiler_p.h')
-rw-r--r-- | src/declarative/qml/qmlcompiler_p.h | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h index 6b6e1e2..6b6d8cb 100644 --- a/src/declarative/qml/qmlcompiler_p.h +++ b/src/declarative/qml/qmlcompiler_p.h @@ -125,41 +125,55 @@ public: private: void reset(QmlCompiledComponent *, bool); + struct BindingContext { + BindingContext() + : stack(0), object(0) {} + BindingContext(QmlParser::Object *o) + : stack(0), object(o) {} + BindingContext incr() const { + BindingContext rv(object); + rv.stack = stack + 1; + return rv; + } + int stack; + QmlParser::Object *object; + }; + void compileTree(QmlParser::Object *tree); - bool compileObject(QmlParser::Object *obj, int); - bool compileComponent(QmlParser::Object *obj, int); - bool compileComponentFromRoot(QmlParser::Object *obj, int); - bool compileFetchedObject(QmlParser::Object *obj, int); + bool compileObject(QmlParser::Object *obj, const BindingContext &); + bool compileComponent(QmlParser::Object *obj, const BindingContext &); + bool compileComponentFromRoot(QmlParser::Object *obj, const BindingContext &); + bool compileFetchedObject(QmlParser::Object *obj, const BindingContext &); bool compileSignal(QmlParser::Property *prop, QmlParser::Object *obj); bool testProperty(QmlParser::Property *prop, QmlParser::Object *obj); int signalByName(const QMetaObject *, const QByteArray &name); - bool compileProperty(QmlParser::Property *prop, QmlParser::Object *obj, int); + bool compileProperty(QmlParser::Property *prop, QmlParser::Object *obj, const BindingContext &); bool compileIdProperty(QmlParser::Property *prop, QmlParser::Object *obj); bool compileAttachedProperty(QmlParser::Property *prop, - int ctxt); + const BindingContext &ctxt); bool compileNestedProperty(QmlParser::Property *prop, - int ctxt); + const BindingContext &ctxt); bool compileListProperty(QmlParser::Property *prop, QmlParser::Object *obj, - int ctxt); + const BindingContext &ctxt); bool compilePropertyAssignment(QmlParser::Property *prop, QmlParser::Object *obj, - int ctxt); + const BindingContext &ctxt); bool compilePropertyObjectAssignment(QmlParser::Property *prop, QmlParser::Value *value, - int ctxt); + const BindingContext &ctxt); bool compilePropertyLiteralAssignment(QmlParser::Property *prop, QmlParser::Object *obj, QmlParser::Value *value, - int ctxt); + const BindingContext &ctxt); bool compileStoreInstruction(QmlInstruction &instr, const QMetaProperty &prop, QmlParser::Value *value); bool compileDynamicMeta(QmlParser::Object *obj); bool compileBinding(QmlParser::Value *, QmlParser::Property *prop, - int ctxt); + const BindingContext &ctxt); void finalizeComponent(int patch); struct BindingReference; @@ -169,6 +183,7 @@ private: QString id; QmlParser::Object *object; int instructionIdx; + int idx; }; struct BindingReference { @@ -176,17 +191,18 @@ private: QmlParser::Property *property; QmlParser::Value *value; int instructionIdx; - int bindingContext; + BindingContext bindingContext; }; struct ComponentCompileState { - ComponentCompileState() : parserStatusCount(0), savedObjects(0), pushedProperties(0) {} + ComponentCompileState() : parserStatusCount(0), savedObjects(0), pushedProperties(0), root(0) {} QHash<QString, IdReference> ids; int parserStatusCount; int savedObjects; int pushedProperties; QList<BindingReference> bindings; + QmlParser::Object *root; }; ComponentCompileState compileState; |