aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4context.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-08-07 08:37:45 +0200
committerLars Knoll <lars.knoll@qt.io>2017-08-10 08:18:56 +0000
commit30e3664bf3668bda9a211fe7d1404f8f806dbf7b (patch)
treebd119839af7db0f6f9119401d478b37b44051c8b /src/qml/jsruntime/qv4context.cpp
parenteb2c08f57493aa12850e6cddff2cc3527e7cbfd7 (diff)
Avoid creating a CallContext for simple functions
This cuts out quite a bit of overhead when entering and leaving functions. Change-Id: I32670c98a4087ea3b2d45853d9cabff9066399e8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4context.cpp')
-rw-r--r--src/qml/jsruntime/qv4context.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index e18d8bce83..ddb5dc4ea5 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -253,24 +253,24 @@ ReturnedValue QV4::ExecutionContext::simpleCall(ExecutionEngine *engine, CallDat
{
Q_ASSERT(function->canUseSimpleFunction());
- ExecutionContextSaver ctxSaver(engine);
-
- CallContext::Data *ctx = engine->memoryManager->allocSimpleCallContext();
-
- ctx->callData = callData;
- ctx->v4Function = function;
- ctx->outer.set(engine, this->d());
+ Value *jsStackTop = engine->jsStackTop;
+ engine->jsStackTop = reinterpret_cast<QV4::Value *>(callData) + 2 + (int)function->nFormals;
for (int i = callData->argc; i < (int)function->nFormals; ++i)
callData->args[i] = Encode::undefined();
- engine->pushContext(ctx);
- Q_ASSERT(engine->current == ctx);
+ ExecutionContext *old = engine->currentContext;
+ engine->currentContext = this;
+ engine->current = d();
ReturnedValue res = Q_V4_PROFILE(engine, function, 0);
if (function->hasQmlDependencies)
QQmlPropertyCapture::registerQmlDependencies(engine, function->compiledFunction);
- engine->memoryManager->freeSimpleCallContext();
+
+ engine->currentContext = old;
+ engine->current = old->d();
+
+ engine->jsStackTop = jsStackTop;
return res;
}