aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlbinding.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-04-10 12:34:36 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-04-16 10:56:03 +0000
commit497ccdc843975bfe20f5b24e083d17f01012efb9 (patch)
treeceba5b1b4e2716fe3d1ca005ac5d733fd36097c7 /src/qml/qml/qqmlbinding.cpp
parent5870667929ac5f45805b1e1e656fec81b9b22337 (diff)
Speed up binding evaluation
Don't spend any cycles of determining the location of the binding (file, line, column) unless we really need that information. That's the case when the profiler is active or an error happens. Change-Id: Iae97808d500b88fed6a813e8b224aa6ebe04d3b6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlbinding.cpp')
-rw-r--r--src/qml/qml/qqmlbinding.cpp25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index ff794f5f09..0db696394c 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -165,34 +165,13 @@ void QQmlBinding::update(QQmlPropertyPrivate::WriteFlags flags)
if (QQmlData::wasDeleted(object()))
return;
- QString url;
- quint16 lineNumber;
- quint16 columnNumber;
-
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(context()->engine);
QV4::Scope scope(ep->v4engine());
QV4::ScopedFunctionObject f(scope, v4function.value());
Q_ASSERT(f);
- if (f->isBinding()) {
- Q_ASSERT(f->as<QV4::QQmlBindingFunction>());
- QQmlSourceLocation loc = static_cast<QV4::Heap::QQmlBindingFunction *>(f->d())->bindingLocation;
- url = loc.sourceFile;
- lineNumber = loc.line;
- columnNumber = loc.column;
- } else {
- QV4::Function *function = f->asFunctionObject()->function();
- Q_ASSERT(function);
-
- url = function->sourceFile();
- lineNumber = function->compiledFunction->location.line;
- columnNumber = function->compiledFunction->location.column;
- }
-
- int lineNo = qmlSourceCoordinate(lineNumber);
- int columnNo = qmlSourceCoordinate(columnNumber);
if (!updatingFlag()) {
- QQmlBindingProfiler prof(ep->profiler, url, lineNo, columnNo);
+ QQmlBindingProfiler prof(ep->profiler, f);
setUpdatingFlag(true);
QQmlAbstractExpression::DeleteWatcher watcher(this);
@@ -222,7 +201,7 @@ void QQmlBinding::update(QQmlPropertyPrivate::WriteFlags flags)
if (!watcher.wasDeleted()) {
if (needsErrorLocationData)
- delayedError()->setErrorLocation(QUrl(url), lineNumber, columnNumber);
+ delayedError()->setErrorLocation(f->sourceLocation());
if (hasError()) {
if (!delayedError()->addError(ep)) ep->warning(this->error(context()->engine));