aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4context.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-08-05 00:15:44 +0200
committerLars Knoll <lars.knoll@qt.io>2017-08-08 18:58:42 +0000
commit99783cd6dec326058b8db345145b1f8f71cfb6f0 (patch)
treec0daf2d2947cbd224a35f227cd41e79f1d0390cf /src/qml/jsruntime/qv4context.cpp
parentf284d73ccece0490b4a227c788b9415a59a38d9c (diff)
Completely avoid intermediate scopes for simple functions
Change-Id: I1fe2ff987e79cf590ad5ad3fc520b17925f8b616 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4context.cpp')
-rw-r--r--src/qml/jsruntime/qv4context.cpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index 4053eb4f09..22278e0405 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -232,47 +232,48 @@ bool ExecutionContext::deleteProperty(String *name)
}
// Do a standard call with this execution context as the outer scope
-ReturnedValue ExecutionContext::call(Scope &scope, CallData *callData, Function *function, const FunctionObject *f)
+ReturnedValue ExecutionContext::call(ExecutionEngine *engine, CallData *callData, Function *function, const FunctionObject *f)
{
- ExecutionContextSaver ctxSaver(scope.engine);
+ Scope scope(engine);
+ ExecutionContextSaver ctxSaver(engine);
Scoped<CallContext> ctx(scope, newCallContext(function, callData));
if (f)
- ctx->d()->function.set(scope.engine, f->d());
- scope.engine->pushContext(ctx);
+ ctx->d()->function.set(engine, f->d());
+ engine->pushContext(ctx);
- ReturnedValue res = Q_V4_PROFILE(scope.engine, function);
+ ReturnedValue res = Q_V4_PROFILE(engine, function);
if (function->hasQmlDependencies)
- QQmlPropertyCapture::registerQmlDependencies(scope.engine, function->compiledFunction);
+ QQmlPropertyCapture::registerQmlDependencies(engine, function->compiledFunction);
return res;
}
// Do a simple, fast call with this execution context as the outer scope
-ReturnedValue QV4::ExecutionContext::simpleCall(Scope &scope, CallData *callData, Function *function)
+ReturnedValue QV4::ExecutionContext::simpleCall(ExecutionEngine *engine, CallData *callData, Function *function)
{
Q_ASSERT(function->canUseSimpleFunction());
- ExecutionContextSaver ctxSaver(scope.engine);
+ ExecutionContextSaver ctxSaver(engine);
- CallContext::Data *ctx = scope.engine->memoryManager->allocSimpleCallContext();
+ CallContext::Data *ctx = engine->memoryManager->allocSimpleCallContext();
ctx->strictMode = function->isStrict();
ctx->callData = callData;
ctx->v4Function = function;
- ctx->outer.set(scope.engine, this->d());
+ ctx->outer.set(engine, this->d());
for (int i = callData->argc; i < (int)function->nFormals; ++i)
callData->args[i] = Encode::undefined();
- scope.engine->pushContext(ctx);
- Q_ASSERT(scope.engine->current == ctx);
+ engine->pushContext(ctx);
+ Q_ASSERT(engine->current == ctx);
- ReturnedValue res = Q_V4_PROFILE(scope.engine, function);
+ ReturnedValue res = Q_V4_PROFILE(engine, function);
if (function->hasQmlDependencies)
- QQmlPropertyCapture::registerQmlDependencies(scope.engine, function->compiledFunction);
- scope.engine->memoryManager->freeSimpleCallContext();
+ QQmlPropertyCapture::registerQmlDependencies(engine, function->compiledFunction);
+ engine->memoryManager->freeSimpleCallContext();
return res;
}