aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qqmlcodegenerator.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <[email protected]>2013-10-29 11:59:54 +0100
committerThe Qt Project <[email protected]>2013-10-31 21:49:21 +0100
commitbbc36ebbc38de276b85947b65d89897bf430add5 (patch)
tree31c4a4754210fe3e97391c9dffdc31e105885390 /src/qml/compiler/qqmlcodegenerator.cpp
parent7d850df7e68e0eab0f07d5f7a03050175080fb81 (diff)
Speed up lookups of imported scripts
The QQmlContextData stores the JS objects of imported scripts in a QList<PersistentValue>. Instead of indexing into that list, this patch changes ctxt->importedScripts to be a JavaScript array, that in the IR we can index via subscript. Change-Id: Ie2c35fb5294a20a0b7084bb51d19671a27195fec Reviewed-by: Lars Knoll <[email protected]>
Diffstat (limited to 'src/qml/compiler/qqmlcodegenerator.cpp')
-rw-r--r--src/qml/compiler/qqmlcodegenerator.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/qml/compiler/qqmlcodegenerator.cpp b/src/qml/compiler/qqmlcodegenerator.cpp
index 40e64205ae..51a4961050 100644
--- a/src/qml/compiler/qqmlcodegenerator.cpp
+++ b/src/qml/compiler/qqmlcodegenerator.cpp
@@ -47,6 +47,10 @@
#include <private/qqmlcompiler_p.h>
#include <QCoreApplication>
+#ifdef CONST
+#undef CONST
+#endif
+
QT_USE_NAMESPACE
using namespace QtQml;
@@ -1372,8 +1376,7 @@ V4IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int col
QQmlTypeNameCache::Result r = imports->query(name);
if (r.isValid()) {
if (r.scriptIndex != -1) {
- result = _block->QML_CONTEXT_MEMBER(_block->NAME(V4IR::Name::builtin_qml_imported_scripts_scope, line, col),
- _function->newString(name), r.scriptIndex);
+ result = subscript(_block->NAME(V4IR::Name::builtin_qml_imported_scripts_object, line, col), _block->CONST(V4IR::NumberType, r.scriptIndex));
} else {
return 0; // TODO: We can't do fast lookup for these yet.
}