From 963875db263e4d1a04e03c4bb4fc20542bc8c21e Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 25 Feb 2014 16:36:41 +0100 Subject: [new compiler] Compile functions and bindings in appropriate scopes This enables accelerated property access also for this code path. Change-Id: Iafb177b1fe7878e6c54cfb258f2e8d8ea32aa59e Reviewed-by: Lars Knoll --- src/qml/qml/qqmlcompiler.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/qml/qml/qqmlcompiler.cpp') diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp index b26b5530a3..3e2fc91cf5 100644 --- a/src/qml/qml/qqmlcompiler.cpp +++ b/src/qml/qml/qqmlcompiler.cpp @@ -3642,6 +3642,8 @@ bool QQmlCompiler::completeComponentBuild() const QQmlScript::Parser &parser = unit->parser(); QQmlJS::Engine *jsEngine = parser.jsEngine(); QQmlJS::MemoryPool *pool = jsEngine->pool(); + QStringList stringPool; + stringPool.append(QString()); for (JSBindingReference *b = compileState->bindings.first(); b; b = b->nextReference) { @@ -3659,7 +3661,9 @@ bool QQmlCompiler::completeComponentBuild() ComponentCompileState::PerObjectCompileData *cd = &compileState->jsCompileData[b->bindingContext.object]; QtQml::CompiledFunctionOrExpression f; f.node = node; - f.name = binding.property->name().toString().prepend(QStringLiteral("expression for ")); + QString name = binding.property->name().toString().prepend(QStringLiteral("expression for ")); + stringPool.append(name); + f.nameIndex = stringPool.count() - 1; f.disableAcceleratedLookups = binding.disableLookupAcceleration; cd->functionsToCompile.append(f); binding.compiledIndex = cd->functionsToCompile.count() - 1; @@ -3672,7 +3676,7 @@ bool QQmlCompiler::completeComponentBuild() const QString &sourceCode = jsEngine->code(); AST::UiProgram *qmlRoot = parser.qmlRoot(); - JSCodeGen jsCodeGen(unit->finalUrlString(), sourceCode, jsModule.data(), jsEngine, qmlRoot, output->importCache); + JSCodeGen jsCodeGen(unit->finalUrlString(), sourceCode, jsModule.data(), jsEngine, qmlRoot, output->importCache, stringPool); JSCodeGen::ObjectIdMapping idMapping; if (compileState->ids.count() > 0) { -- cgit v1.2.3