aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2016-12-02 11:00:23 +0100
committerLars Knoll <lars.knoll@qt.io>2016-12-09 14:01:29 +0000
commit8fb453c5e68c32c8a15c766dd0995679e28d88d5 (patch)
treeef1ef910e1ed097b15f2ed49d01e2907c6b0e2f5 /src
parent9de7d0e9f170ed0a4baedaa33b3a68e166901a8a (diff)
Avoid using the FunctionObject in QQmlJavaScriptExpression::evaluate()
Rather directly execute the call on the QV4::Function. Change-Id: I1de52075760be6b3a0358af83270ebd4e1d1e8ae Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/qml/qml/qqmljavascriptexpression.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp
index a694b43447..cb36758f74 100644
--- a/src/qml/qml/qqmljavascriptexpression.cpp
+++ b/src/qml/qml/qqmljavascriptexpression.cpp
@@ -176,13 +176,14 @@ void QQmlJavaScriptExpression::evaluate(QV4::CallData *callData, bool *isUndefin
{
Q_ASSERT(m_context && m_context->engine);
- QV4::Value *f = m_function.valueRef();
- if (!f || f->isUndefined()) {
+ QV4::Function *v4Function = function();
+ if (!v4Function) {
if (isUndefined)
*isUndefined = true;
return;
}
+ QV4::FunctionObject *f = static_cast<QV4::FunctionObject *>(m_function.valueRef());
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(m_context->engine);
// All code that follows must check with watcher before it accesses data members
@@ -208,7 +209,13 @@ void QQmlJavaScriptExpression::evaluate(QV4::CallData *callData, bool *isUndefin
callData->thisObject = value;
}
- f->as<QV4::FunctionObject>()->call(scope, callData);
+ QV4::ScopedContext outer(scope, f->scope());
+ if (v4Function->canUseSimpleFunction()) {
+ outer->simpleCall(scope, callData, v4Function);
+ } else {
+ outer->call(scope, callData, v4Function);
+ }
+
if (scope.hasException()) {
if (watcher.wasDeleted())
scope.engine->catchException(); // ignore exception