diff options
author | Simon Hausmann <[email protected]> | 2013-10-18 14:02:56 +0200 |
---|---|---|
committer | The Qt Project <[email protected]> | 2013-10-20 21:11:43 +0200 |
commit | 6b2b62e903e1207255b0652b728ecaee6d51aea9 (patch) | |
tree | c832e832680f9d9fe21fc3eda8f7589efd78362a /src/qml/compiler/qqmlcodegenerator.cpp | |
parent | 9fd4591a61df467362fa2f17cc2d506efd6bece3 (diff) |
Cleanup: Avoid unnecessary irModule->functions.indexOf calls
With a growing number of functions per module, these calls become
expensive and are unnecessary. defineFunction in the code generator
can simply return the correct index right away.
Change-Id: I8ab56a3083bf215674a1b46c502b415be694e465
Reviewed-by: Lars Knoll <[email protected]>
Diffstat (limited to 'src/qml/compiler/qqmlcodegenerator.cpp')
-rw-r--r-- | src/qml/compiler/qqmlcodegenerator.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/qml/compiler/qqmlcodegenerator.cpp b/src/qml/compiler/qqmlcodegenerator.cpp index 41aa17fff3..ed5f4c3772 100644 --- a/src/qml/compiler/qqmlcodegenerator.cpp +++ b/src/qml/compiler/qqmlcodegenerator.cpp @@ -1180,7 +1180,7 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QString &fil scan.end(); _env = 0; - _function = defineFunction(QString("context scope"), qmlRoot, 0, 0); + _function = _module->functions.at(defineFunction(QString("context scope"), qmlRoot, 0, 0)); for (int i = 0; i < functions.count(); ++i) { AST::Node *node = functions.at(i); @@ -1212,10 +1212,10 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QString &fil body = body->finish(); } - V4IR::Function *irFunc = defineFunction(name, node, - function ? function->formals : 0, - body); - runtimeFunctionIndices[i] = _module->functions.indexOf(irFunc); // ### + int idx = defineFunction(name, node, + function ? function->formals : 0, + body); + runtimeFunctionIndices[i] = idx; } qDeleteAll(_envMap); |