aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-01-04 15:58:58 +0100
committerLars Knoll <lars.knoll@qt.io>2017-01-25 08:31:06 +0000
commit3e67a40860e0cda4cf6118c97e47cbe55aa672d6 (patch)
tree6e6cb9bc96b57b39602fde70b874fbb148b2bfd8 /src/qml/jsruntime
parent1df5fb40b5417995f4121c15392f56a7bb19e0c2 (diff)
Inline creation of simple call contexts
And avoid zero initializing stuff that's already 0 Change-Id: If90a808815b2b735bab661d22cbd498acc96b029 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4context.cpp9
-rw-r--r--src/qml/jsruntime/qv4context_p.h10
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp8
3 files changed, 7 insertions, 20 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index 486447f10a..60b90e4bf0 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -97,10 +97,7 @@ Heap::CallContext *ExecutionContext::newCallContext(Function *function, CallData
Heap::CallContext *Heap::CallContext::createSimpleContext(ExecutionEngine *v4)
{
- Heap::CallContext *ctxt = v4->memoryManager->allocSimpleCallContext();
- memset(ctxt, 0, sizeof(Heap::CallContext));
- ctxt->setVtable(QV4::CallContext::staticVTable());
- ctxt->init(v4);
+ Heap::CallContext *ctxt = v4->memoryManager->allocSimpleCallContext(v4);
return ctxt;
}
@@ -339,7 +336,7 @@ void QV4::ExecutionContext::simpleCall(Scope &scope, CallData *callData, Functio
ExecutionContextSaver ctxSaver(scope);
- CallContext::Data *ctx = CallContext::Data::createSimpleContext(scope.engine);
+ CallContext::Data *ctx = scope.engine->memoryManager->allocSimpleCallContext(scope.engine);
ctx->strictMode = function->isStrict();
ctx->callData = callData;
@@ -359,7 +356,7 @@ void QV4::ExecutionContext::simpleCall(Scope &scope, CallData *callData, Functio
if (function->hasQmlDependencies)
QQmlPropertyCapture::registerQmlDependencies(function->compiledFunction, scope);
- ctx->freeSimpleCallContext();
+ scope.engine->memoryManager->freeSimpleCallContext();
}
void ExecutionContext::setProperty(String *name, const Value &value)
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index 996de174b4..bcfee2e1f8 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -109,14 +109,8 @@ struct ExecutionContext : Base {
{
Base::init();
- callData = nullptr;
this->engine = engine;
- outer = nullptr;
- lookups = nullptr;
- constantTable = nullptr;
- compilationUnit = nullptr;
type = t;
- strictMode = false;
lineNumber = -1;
}
@@ -141,10 +135,6 @@ struct CallContext : ExecutionContext {
void init(ExecutionEngine *engine, ContextType t = Type_SimpleCallContext)
{
ExecutionContext::init(engine, t);
- function = 0;
- v4Function = 0;
- locals = 0;
- activation = 0;
}
inline unsigned int formalParameterCount() const;
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 1ac0e28a1b..3bbccdba2f 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -484,14 +484,14 @@ void BuiltinFunction::call(const Managed *that, Scope &scope, CallData *callData
ExecutionContextSaver ctxSaver(scope);
- CallContext::Data *ctx = CallContext::Data::createSimpleContext(v4);
+ CallContext::Data *ctx = v4->memoryManager->allocSimpleCallContext(v4);
ctx->strictMode = f->scope()->strictMode; // ### needed? scope or parent context?
ctx->callData = callData;
v4->pushContext(ctx);
Q_ASSERT(v4->current == ctx);
scope.result = f->d()->code(static_cast<QV4::CallContext *>(v4->currentContext));
- ctx->freeSimpleCallContext();
+ v4->memoryManager->freeSimpleCallContext();
}
void IndexedBuiltinFunction::call(const Managed *that, Scope &scope, CallData *callData)
@@ -506,14 +506,14 @@ void IndexedBuiltinFunction::call(const Managed *that, Scope &scope, CallData *c
ExecutionContextSaver ctxSaver(scope);
- CallContext::Data *ctx = CallContext::Data::createSimpleContext(v4);
+ CallContext::Data *ctx = v4->memoryManager->allocSimpleCallContext(v4);
ctx->strictMode = f->scope()->strictMode; // ### needed? scope or parent context?
ctx->callData = callData;
v4->pushContext(ctx);
Q_ASSERT(v4->current == ctx);
scope.result = f->d()->code(static_cast<QV4::CallContext *>(v4->currentContext), f->d()->index);
- ctx->freeSimpleCallContext();
+ v4->memoryManager->freeSimpleCallContext();
}
DEFINE_OBJECT_VTABLE(IndexedBuiltinFunction);