From 497ccdc843975bfe20f5b24e083d17f01012efb9 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 10 Apr 2015 12:34:36 +0200 Subject: 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 --- src/qml/qml/qqmlbinding.cpp | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) (limited to 'src/qml/qml/qqmlbinding.cpp') 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()); - QQmlSourceLocation loc = static_cast(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)); -- cgit v1.2.3