diff options
| author | Christian Kandeler <christian.kandeler@digia.com> | 2013-04-12 09:43:06 +0200 |
|---|---|---|
| committer | Christian Kandeler <christian.kandeler@digia.com> | 2013-04-12 15:10:46 +0200 |
| commit | 6c64c84c7fd22f82d4ed423d57889a65e72097b8 (patch) | |
| tree | ddd050777c8053546e7a73087991c118dacd1ca6 /src/lib/buildgraph/rulesapplicator.cpp | |
| parent | 88fdf28c0d499f6dea6193072e796c313e61c2b3 (diff) | |
| download | qbs-6c64c84c7fd22f82d4ed423d57889a65e72097b8.tar.gz | |
Help compiler with branch prediction.
Mark error checks in potentially performance-sensitive
contexts with Q_UNLIKELY. Actual benefits unknown,
but it cannot hurt.
Change-Id: If3d2375965e6342b5d7a0b46ad2c8a41fd3567d0
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/lib/buildgraph/rulesapplicator.cpp')
| -rw-r--r-- | src/lib/buildgraph/rulesapplicator.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/buildgraph/rulesapplicator.cpp b/src/lib/buildgraph/rulesapplicator.cpp index 16e9a8d5a..a9781d10e 100644 --- a/src/lib/buildgraph/rulesapplicator.cpp +++ b/src/lib/buildgraph/rulesapplicator.cpp @@ -171,7 +171,7 @@ void RulesApplicator::doApply(const ArtifactList &inputArtifacts) for (int i=0; i < ra->bindings.count(); ++i) { const RuleArtifact::Binding &binding = ra->bindings.at(i); scriptValue = engine()->evaluate(binding.code); - if (scriptValue.isError()) { + if (Q_UNLIKELY(scriptValue.isError())) { QString msg = QLatin1String("evaluating rule binding '%1': %2"); throw Error(msg.arg(binding.name.join(QLatin1String(".")), scriptValue.toString()), binding.location); } @@ -184,7 +184,7 @@ void RulesApplicator::doApply(const ArtifactList &inputArtifacts) m_transformer->setupOutputs(engine(), scope()); m_transformer->createCommands(m_rule->script, evalContext()); - if (m_transformer->commands.isEmpty()) + if (Q_UNLIKELY(m_transformer->commands.isEmpty())) throw Error(QString("There's a rule without commands: %1.").arg(m_rule->toString()), m_rule->script->location); } @@ -220,7 +220,7 @@ Artifact *RulesApplicator::createOutputArtifact(const RuleArtifactConstPtr &rule const ArtifactList &inputArtifacts) { QScriptValue scriptValue = engine()->evaluate(ruleArtifact->fileName); - if (scriptValue.isError() || engine()->hasUncaughtException()) + if (Q_UNLIKELY(scriptValue.isError() || engine()->hasUncaughtException())) throw Error("Error in Rule.Artifact fileName: " + scriptValue.toString()); QString outputPath = scriptValue.toString(); outputPath.replace("..", "dotdot"); // don't let the output artifact "escape" its build dir @@ -238,7 +238,7 @@ Artifact *RulesApplicator::createOutputArtifact(const RuleArtifactConstPtr &rule m_transformer = outputArtifact->transformer; m_transformer->inputs.unite(inputArtifacts); - if (m_transformer->inputs.count() > 1 && !m_rule->multiplex) { + if (Q_UNLIKELY(m_transformer->inputs.count() > 1 && !m_rule->multiplex)) { QString th = "[" + outputArtifact->fileTags.toStringList().join(", ") + "]"; QString e = Tr::tr("Conflicting rules for producing %1 %2 \n").arg(outputArtifact->filePath(), th); th = "[" + m_rule->inputs.toStringList().join(", ") |
