From b393c405b7568e80628bc99501a9c53bbd0e678d Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 13 Jun 2014 14:30:03 +0200 Subject: Change the object allocation scheme Instead of allocating the data directly, centralize the object and its ::Data allocation in one place in the memory manager. This is in preparation for additional pointer indirection later. Change-Id: I7880e1e7354b3258b6a8965be378cd09c9467d25 Reviewed-by: Lars Knoll --- src/qml/jsruntime/qv4script.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/qml/jsruntime/qv4script.cpp') diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index cdc8622b26..638cf3c126 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -141,7 +141,7 @@ Returned *QmlBindingWrapper::createQmlCallableForFunction(QQmlCo ExecutionEngine *engine = QQmlEnginePrivate::getV4Engine(qmlContext->engine); QV4::Scope valueScope(engine); QV4::ScopedObject qmlScopeObject(valueScope, QV4::QmlContextWrapper::qmlScope(engine->v8Engine, qmlContext, scopeObject)); - QV4::Scoped wrapper(valueScope, new (engine) QV4::QmlBindingWrapper::Data(engine->rootContext, qmlScopeObject)); + QV4::Scoped wrapper(valueScope, engine->memoryManager->alloc(engine->rootContext, qmlScopeObject)); if (!signalParameters.isEmpty()) { if (error) @@ -150,7 +150,7 @@ Returned *QmlBindingWrapper::createQmlCallableForFunction(QQmlCo QV4::ScopedString s(valueScope); int index = 0; foreach (const QByteArray ¶m, signalParameters) { - QV4::ScopedFunctionObject g(valueScope, new (engine) QV4::IndexedBuiltinFunction::Data(wrapper->context(), index++, signalParameterGetter)); + QV4::ScopedFunctionObject g(valueScope, engine->memoryManager->alloc(wrapper->context(), index++, signalParameterGetter)); p->setGetter(g); p->setSetter(0); s = engine->newString(QString::fromUtf8(param)); @@ -206,7 +206,7 @@ Script::Script(ExecutionEngine *v4, Object *qml, CompiledData::CompilationUnit * vmFunction = compilationUnit->linkToEngine(v4); Q_ASSERT(vmFunction); Scope valueScope(v4); - ScopedObject holder(valueScope, new (v4) CompilationUnitHolder::Data(v4, compilationUnit)); + ScopedObject holder(valueScope, v4->memoryManager->alloc(v4, compilationUnit)); compilationUnitHolder = holder.asReturnedValue(); } else vmFunction = 0; @@ -278,7 +278,7 @@ void Script::parse() isel->setUseFastLookups(false); QV4::CompiledData::CompilationUnit *compilationUnit = isel->compile(); vmFunction = compilationUnit->linkToEngine(v4); - ScopedObject holder(valueScope, new (v4) CompilationUnitHolder::Data(v4, compilationUnit)); + ScopedObject holder(valueScope, v4->memoryManager->alloc(v4, compilationUnit)); compilationUnitHolder = holder.asReturnedValue(); } @@ -332,7 +332,7 @@ ReturnedValue Script::run() return vmFunction->code(scope, vmFunction->codeData); } else { ScopedObject qmlObj(valueScope, qml.value()); - ScopedFunctionObject f(valueScope, new (engine) QmlBindingWrapper::Data(scope, vmFunction, qmlObj)); + ScopedFunctionObject f(valueScope, engine->memoryManager->alloc(scope, vmFunction, qmlObj)); ScopedCallData callData(valueScope, 0); callData->thisObject = Primitive::undefinedValue(); return f->call(callData); @@ -408,7 +408,7 @@ ReturnedValue Script::qmlBinding() ExecutionEngine *v4 = scope->d()->engine; Scope valueScope(v4); ScopedObject qmlObj(valueScope, qml.value()); - ScopedObject v(valueScope, new (v4) QmlBindingWrapper::Data(scope, vmFunction, qmlObj)); + ScopedObject v(valueScope, v4->memoryManager->alloc(scope, vmFunction, qmlObj)); return v.asReturnedValue(); } -- cgit v1.2.3