diff options
author | Simon Hausmann <[email protected]> | 2013-11-02 22:46:25 +0100 |
---|---|---|
committer | The Qt Project <[email protected]> | 2013-11-25 22:04:42 +0100 |
commit | 43f1cc98bf1899ae29e3fb0b3bf5054d5a23d4b2 (patch) | |
tree | 1d0912be4c0daf35e4255259f51e4a3c11b9f004 /src/qml/compiler/qv4ssa.cpp | |
parent | a41764cafbc85c271edde8d09eae46798ccdcb8d (diff) |
Initial support for accelerated property access to QML singletons and enums
With this patch we determine the meta-object of singletons, propagate it into
the IR and load them separately using a dedicated run-time function. In
addition enums in singletons and QML types are resolved at compile time.
Change-Id: I01ce1288391b476d1c9af669cb2987a44c885703
Reviewed-by: Lars Knoll <[email protected]>
Diffstat (limited to 'src/qml/compiler/qv4ssa.cpp')
-rw-r--r-- | src/qml/compiler/qv4ssa.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index 1f6ace359c..f9acf99a65 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -1189,6 +1189,8 @@ protected: virtual void visitName(Name *e) { + if (e->freeOfSideEffects) + return; // TODO: maybe we can distinguish between built-ins of which we know that they do not have // a side-effect. if (e->builtin == Name::builtin_invalid || (e->id && *e->id != QStringLiteral("this"))) @@ -2512,6 +2514,17 @@ void optimizeSSA(Function *function, DefUsesCalculator &defUses) } continue; } + if (Member *potentialEnumMember = m->source->asMember()) { + if (potentialEnumMember->memberIsEnum) { + Const *c = function->New<Const>(); + c->init(SInt32Type, potentialEnumMember->enumValue); + W += replaceUses(targetTemp, c); + defUses.removeDef(*targetTemp); + *ref[s] = 0; + defUses.removeUse(s, *potentialEnumMember->base->asTemp()); + continue; + } + } // copy propagation: if (Temp *sourceTemp = unescapableTemp(m->source, variablesCanEscape)) { |