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/qqmlcontextwrapper.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/qml/qml/qqmlcontextwrapper.cpp') diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp index 832d9421c2..406826a6f6 100644 --- a/src/qml/qml/qqmlcontextwrapper.cpp +++ b/src/qml/qml/qqmlcontextwrapper.cpp @@ -192,11 +192,8 @@ ReturnedValue QmlContextWrapper::get(Managed *m, const StringRef name, bool *has if (hasProperty) *hasProperty = true; if (r.scriptIndex != -1) { - int index = r.scriptIndex; - if (index < context->importedScripts.count()) - return context->importedScripts.at(index).value(); - else - return QV4::Primitive::undefinedValue().asReturnedValue(); + QV4::ScopedObject scripts(scope, context->importedScripts); + return scripts->getIndexed(r.scriptIndex); } else if (r.type) { return QmlTypeWrapper::create(engine, scopeObject, r.type); } else if (r.importNamespace) { -- cgit v1.2.3