diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-04-10 12:34:36 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-04-16 10:56:03 +0000 |
commit | 497ccdc843975bfe20f5b24e083d17f01012efb9 (patch) | |
tree | ceba5b1b4e2716fe3d1ca005ac5d733fd36097c7 /src/qml/jsruntime/qv4functionobject.cpp | |
parent | 5870667929ac5f45805b1e1e656fec81b9b22337 (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/jsruntime/qv4functionobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 5be638e909..f7433e6365 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -210,6 +210,18 @@ bool FunctionObject::isBoundFunction() const return d()->vtable == BoundFunction::staticVTable(); } +QQmlSourceLocation FunctionObject::sourceLocation() const +{ + if (isBinding()) { + Q_ASSERT(as<const QV4::QQmlBindingFunction>()); + return static_cast<QV4::Heap::QQmlBindingFunction *>(d())->bindingLocation; + } + QV4::Function *function = d()->function; + Q_ASSERT(function); + + return QQmlSourceLocation(function->sourceFile(), function->compiledFunction->location.line, function->compiledFunction->location.column); +} + DEFINE_OBJECT_VTABLE(FunctionCtor); Heap::FunctionCtor::FunctionCtor(QV4::ExecutionContext *scope) |