From fb059f697a128f87ceecf5ddff1dd735ae78db20 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 24 Aug 2015 09:36:19 +0200 Subject: Reduce usage of context->parent Change-Id: I31bb8019783311a7e6065e2aac7fec67c1120ebf Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4context.cpp | 44 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src/qml/jsruntime/qv4context.cpp') diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp index b1aaf06e80..57c791e6a8 100644 --- a/src/qml/jsruntime/qv4context.cpp +++ b/src/qml/jsruntime/qv4context.cpp @@ -85,12 +85,12 @@ Heap::CallContext *ExecutionContext::newCallContext(const FunctionObject *functi Heap::WithContext *ExecutionContext::newWithContext(Object *with) { - return d()->engine->memoryManager->alloc(d()->engine, with); + return d()->engine->memoryManager->alloc(d(), with); } Heap::CatchContext *ExecutionContext::newCatchContext(String *exceptionVarName, const Value &exceptionValue) { - return d()->engine->memoryManager->alloc(d()->engine, exceptionVarName, exceptionValue); + return d()->engine->memoryManager->alloc(d(), exceptionVarName, exceptionValue); } Heap::QmlContext *ExecutionContext::newQmlContext(QmlContextWrapper *qml) @@ -150,38 +150,38 @@ Heap::GlobalContext::GlobalContext(ExecutionEngine *eng) global = eng->globalObject->d(); } -Heap::WithContext::WithContext(ExecutionEngine *engine, QV4::Object *with) - : Heap::ExecutionContext(engine, Heap::ExecutionContext::Type_WithContext) +Heap::WithContext::WithContext(ExecutionContext *outerContext, QV4::Object *with) + : Heap::ExecutionContext(outerContext->engine, Heap::ExecutionContext::Type_WithContext) { - callData = parent->callData; - outer = parent; - lookups = parent->lookups; - compilationUnit = parent->compilationUnit; + outer = outerContext; + callData = outer->callData; + lookups = outer->lookups; + compilationUnit = outer->compilationUnit; withObject = with ? with->d() : 0; } -Heap::CatchContext::CatchContext(ExecutionEngine *engine, QV4::String *exceptionVarName, const Value &exceptionValue) - : Heap::ExecutionContext(engine, Heap::ExecutionContext::Type_CatchContext) +Heap::CatchContext::CatchContext(ExecutionContext *outerContext, QV4::String *exceptionVarName, const Value &exceptionValue) + : Heap::ExecutionContext(outerContext->engine, Heap::ExecutionContext::Type_CatchContext) { - strictMode = parent->strictMode; - callData = parent->callData; - outer = parent; - lookups = parent->lookups; - compilationUnit = parent->compilationUnit; + outer = outerContext; + strictMode = outer->strictMode; + callData = outer->callData; + lookups = outer->lookups; + compilationUnit = outer->compilationUnit; this->exceptionVarName = exceptionVarName->d(); this->exceptionValue = exceptionValue; } -Heap::QmlContext::QmlContext(QV4::ExecutionContext *outer, QV4::QmlContextWrapper *qml) - : Heap::ExecutionContext(outer->engine(), Heap::ExecutionContext::Type_QmlContext) +Heap::QmlContext::QmlContext(QV4::ExecutionContext *outerContext, QV4::QmlContextWrapper *qml) + : Heap::ExecutionContext(outerContext->engine(), Heap::ExecutionContext::Type_QmlContext) { + outer = outerContext->d(); strictMode = false; - callData = parent->callData; - this->outer = outer->d(); - lookups = parent->lookups; - compilationUnit = parent->compilationUnit; + callData = outer->callData; + lookups = outer->lookups; + compilationUnit = outer->compilationUnit; this->qml = qml->d(); } @@ -546,7 +546,7 @@ Heap::FunctionObject *ExecutionContext::getFunctionObject() const { Scope scope(d()->engine); ScopedContext it(scope, this->d()); - for (; it; it = it->d()->parent) { + for (; it; it = it->d()->outer) { if (const CallContext *callCtx = it->asCallContext()) return callCtx->d()->function; else if (it->asCatchContext() || it->asWithContext()) -- cgit v1.2.3