From a3688bf41fd42befe7ab83a633dbbd71eda56cd9 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 27 Feb 2014 15:59:39 -0600 Subject: Improve memory usage in QML/V4 engine. * Don't create prototype Object for bindings and signal handlers. It is inaccessible and not required. This saves one Object-sized allocation per binding. * Shrink the size of QQmlContextWrapper by removing the v8 member variable. * Shrink the size of QObjectWrapper by moving the destroy identifier to the engine. Change-Id: I76e84e4c0581e97a19d2e959f814ac84d9c431fa Task-number: QTBUG-37134 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4functionobject.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/qml/jsruntime/qv4functionobject.cpp') diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 07ec94a58d..66e956e43c 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -183,14 +183,14 @@ void FunctionObject::markObjects(Managed *that, ExecutionEngine *e) Object::markObjects(that, e); } -FunctionObject *FunctionObject::creatScriptFunction(ExecutionContext *scope, Function *function) +FunctionObject *FunctionObject::creatScriptFunction(ExecutionContext *scope, Function *function, bool createProto) { if (function->needsActivation() || function->compiledFunction->flags & CompiledData::Function::HasCatchOrWith || function->compiledFunction->nFormals > QV4::Global::ReservedArgumentCount || function->isNamedExpression()) return new (scope->engine->memoryManager) ScriptFunction(scope, function); - return new (scope->engine->memoryManager) SimpleScriptFunction(scope, function); + return new (scope->engine->memoryManager) SimpleScriptFunction(scope, function, createProto); } ReturnedValue FunctionObject::protoProperty() @@ -482,8 +482,8 @@ ReturnedValue ScriptFunction::call(Managed *that, CallData *callData) DEFINE_OBJECT_VTABLE(SimpleScriptFunction); -SimpleScriptFunction::SimpleScriptFunction(ExecutionContext *scope, Function *function) - : FunctionObject(scope, function->name, true) +SimpleScriptFunction::SimpleScriptFunction(ExecutionContext *scope, Function *function, bool createProto) + : FunctionObject(scope, function->name, createProto) { setVTable(staticVTable()); -- cgit v1.2.3