From bbc36ebbc38de276b85947b65d89897bf430add5 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 29 Oct 2013 11:59:54 +0100 Subject: Speed up lookups of imported scripts The QQmlContextData stores the JS objects of imported scripts in a QList. 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 --- src/qml/qml/qqmlvme.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/qml/qml/qqmlvme.cpp') diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp index c1c05fac11..b425b84a53 100644 --- a/src/qml/qml/qqmlvme.cpp +++ b/src/qml/qml/qqmlvme.cpp @@ -791,7 +791,13 @@ QObject *QQmlVME::run(QList *errors, QML_END_INSTR(StoreSignal) QML_BEGIN_INSTR(StoreImportedScript) - CTXT->importedScripts << SCRIPTS.at(instr.value)->scriptValueForContext(CTXT); + QV4::Scope scope(v4); + QV4::ScopedObject scripts(scope, CTXT->importedScripts.value()); + if (!scripts) { + scripts = v4->newArrayObject(); + CTXT->importedScripts = scripts; + } + scripts->putIndexed(instr.value, SCRIPTS.at(instr.value)->scriptValueForContext(CTXT)); QML_END_INSTR(StoreImportedScript) QML_BEGIN_INSTR(StoreScriptString) -- cgit v1.2.3