From 34c85bb56c92316a6ce1c79d25f9653fec14791c Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 24 Oct 2013 14:51:02 +0200 Subject: Initial support for resolving meta-property access for the scope and context objects at QML compile time This avoids having to do a string lookup for ids and in the import cache at run-time, before we can do a string hash lookup in the property cache. Instead we resolve final properties in the context and scope object at compile time and look them up at run-time using their index instead. The dependencies to these properties are also tracked separately and recorded in the compiled data. This is merely the initial patch. There's a lot left to do, such as having specialized getter and setters for specific property types. Setters are missing altogether right now and will fall back to name lookup. Change-Id: If3cb4e7c9454ef4850a615f0935b311c9395b165 Reviewed-by: Lars Knoll --- src/qml/jsruntime/qv4script.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/qml/jsruntime/qv4script.cpp') diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index 6e2c26edaf..f1903cf323 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -207,8 +207,7 @@ void Script::parse() inheritedLocals.append(*i ? (*i)->toQString() : QString()); RuntimeCodegen cg(scope, strictMode); - cg.generateFromProgram(sourceFile, sourceCode, program, &module, - parseAsBinding ? QQmlJS::Codegen::QmlBinding : QQmlJS::Codegen::EvalCode, inheritedLocals); + cg.generateFromProgram(sourceFile, sourceCode, program, &module, QQmlJS::Codegen::EvalCode, inheritedLocals); if (v4->hasException) return; @@ -286,7 +285,7 @@ Function *Script::function() return vmFunction; } -CompiledData::CompilationUnit *Script::precompile(ExecutionEngine *engine, const QUrl &url, const QString &source, bool parseAsBinding, QList *reportedErrors) +CompiledData::CompilationUnit *Script::precompile(ExecutionEngine *engine, const QUrl &url, const QString &source, QList *reportedErrors) { using namespace QQmlJS; using namespace QQmlJS::AST; @@ -330,7 +329,7 @@ CompiledData::CompilationUnit *Script::precompile(ExecutionEngine *engine, const } QQmlJS::Codegen cg(/*strict mode*/false); - cg.generateFromProgram(url.toString(), source, program, &module, parseAsBinding ? QQmlJS::Codegen::QmlBinding : QQmlJS::Codegen::GlobalCode); + cg.generateFromProgram(url.toString(), source, program, &module, QQmlJS::Codegen::EvalCode); errors = cg.errors(); if (!errors.isEmpty()) { if (reportedErrors) -- cgit v1.2.3