diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2014-11-07 05:24:24 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-11-11 05:31:27 +0100 |
commit | e552ca0602186826b9dbf2435dd95303cf1bf39b (patch) | |
tree | 17925de60d6e934d2a1a4fc586caa09f3eeae366 /src/qml/jsruntime/qv4context.cpp | |
parent | a4b8bea95f95d4258dc04e7924eab4a11e072acb (diff) |
Use Heap object for CallData::function member
Change-Id: I5cae1b16c68751da9481a1cdae2601efa2a500a2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4context.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4context.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp index 145e99e3a3..84a3ae20cf 100644 --- a/src/qml/jsruntime/qv4context.cpp +++ b/src/qml/jsruntime/qv4context.cpp @@ -55,7 +55,7 @@ Returned<CallContext> *ExecutionContext::newCallContext(FunctionObject *function Heap::CallContext *c = reinterpret_cast<Heap::CallContext *>(d()->engine->memoryManager->allocManaged(requiredMemoryForExecutionContect(function, callData->argc))); new (c) Heap::CallContext(d()->engine, Heap::ExecutionContext::Type_CallContext); - c->function = function; + c->function = function->d(); c->realArgumentCount = callData->argc; c->strictMode = function->strictMode(); @@ -161,7 +161,7 @@ Heap::CatchContext::CatchContext(ExecutionEngine *engine, QV4::String *exception Heap::CallContext::CallContext(ExecutionEngine *engine, QV4::Object *qml, QV4::FunctionObject *function) : Heap::ExecutionContext(engine, Heap::ExecutionContext::Type_QmlContext) { - this->function = function; + this->function = function->d(); callData = reinterpret_cast<CallData *>(this + 1); callData->tag = QV4::Value::_Integer_Type; callData->argc = 0; @@ -184,7 +184,7 @@ Heap::CallContext::CallContext(ExecutionEngine *engine, QV4::Object *qml, QV4::F String * const *CallContext::formals() const { - return (d()->function && d()->function->function()) ? d()->function->function()->internalClass->nameMap.constData() : 0; + return (d()->function && d()->function->function) ? d()->function->function->internalClass->nameMap.constData() : 0; } unsigned int CallContext::formalCount() const @@ -194,7 +194,7 @@ unsigned int CallContext::formalCount() const String * const *CallContext::variables() const { - return (d()->function && d()->function->function()) ? d()->function->function()->internalClass->nameMap.constData() + d()->function->function()->compiledFunction->nFormals : 0; + return (d()->function && d()->function->function) ? d()->function->function->internalClass->nameMap.constData() + d()->function->formalParameterCount() : 0; } unsigned int CallContext::variableCount() const @@ -220,7 +220,7 @@ bool ExecutionContext::deleteProperty(String *name) return false; } else if (ctx->d()->type >= Heap::ExecutionContext::Type_CallContext) { CallContext *c = static_cast<CallContext *>(ctx); - FunctionObject *f = c->d()->function; + ScopedFunctionObject f(scope, c->d()->function); if (f->needsActivation() || hasWith) { uint index = f->function()->internalClass->find(name); if (index < UINT_MAX) @@ -244,7 +244,7 @@ bool ExecutionContext::deleteProperty(String *name) bool CallContext::needsOwnArguments() const { - return d()->function->needsActivation() || d()->callData->argc < static_cast<int>(d()->function->formalParameterCount()); + return d()->function->needsActivation || d()->callData->argc < static_cast<int>(d()->function->formalParameterCount()); } void ExecutionContext::markObjects(Heap::Base *m, ExecutionEngine *engine) @@ -296,8 +296,8 @@ void ExecutionContext::setProperty(String *name, const ValueRef value) ScopedObject activation(scope, (Object *)0); if (ctx->d()->type >= Heap::ExecutionContext::Type_CallContext) { CallContext *c = static_cast<CallContext *>(ctx); - if (c->d()->function->function()) { - uint index = c->d()->function->function()->internalClass->find(name); + if (c->d()->function->function) { + uint index = c->d()->function->function->internalClass->find(name); if (index < UINT_MAX) { if (index < c->d()->function->formalParameterCount()) { c->d()->callData->args[c->d()->function->formalParameterCount() - index - 1] = *value; @@ -434,13 +434,13 @@ ReturnedValue ExecutionContext::getPropertyAndBase(String *name, Object *&base) else if (ctx->d()->type >= Heap::ExecutionContext::Type_CallContext) { QV4::CallContext *c = static_cast<CallContext *>(ctx); - FunctionObject *f = c->d()->function; + ScopedFunctionObject f(scope, c->d()->function); if (f->function() && (f->needsActivation() || hasWith || hasCatchScope)) { uint index = f->function()->internalClass->find(name); if (index < UINT_MAX) { - if (index < c->d()->function->formalParameterCount()) - return c->d()->callData->args[c->d()->function->formalParameterCount() - index - 1].asReturnedValue(); - return c->d()->locals[index - c->d()->function->formalParameterCount()].asReturnedValue(); + if (index < f->formalParameterCount()) + return c->d()->callData->args[f->formalParameterCount() - index - 1].asReturnedValue(); + return c->d()->locals[index - f->formalParameterCount()].asReturnedValue(); } } ScopedObject activation(scope, c->d()->activation); |