Revert "Local initialisation is now done in codegen."
authorSimon Hausmann <simon.hausmann@digia.com>
Sun, 16 Jun 2013 20:42:47 +0000 (22:42 +0200)
committerLars Knoll <lars.knoll@digia.com>
Mon, 17 Jun 2013 06:01:11 +0000 (08:01 +0200)
This reverts commit 2bd6e240a3c2b3dc7a2c81c639d4f30e4dfd685f.

This doesn't work properly as the code generator will not keep those
initializations at the beginning of the function, resulting in
uninitialized values in ctx->locals[], which gives valgrind warnings
when they're marked.

Change-Id: I81501e0ea80e7f76b7d9112fea261e406084b69b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/qml/v4/qv4codegen.cpp
src/qml/qml/v4/qv4context.cpp

index 310272c..ccd1ef1 100644 (file)
@@ -1844,7 +1844,6 @@ V4IR::Function *Codegen::defineFunction(const QString &name, AST::Node *ast,
             function->LOCAL(local);
             unsigned t = entryBlock->newTemp();
             (*it).index = t;
-            entryBlock->MOVE(entryBlock->TEMP(t), entryBlock->CONST(V4IR::UndefinedType, 0));
         }
     } else {
         if (!_env->isStrict) {
index eddf72e..ad8e071 100644 (file)
@@ -178,6 +178,8 @@ void CallContext::initCallContext(ExecutionEngine *engine, FunctionObject *funct
     uint argc = argumentCount;
 
     locals = (Value *)(this + 1);
+    if (function->varCount)
+        std::fill(locals, locals + function->varCount, Value::undefinedValue());
 
     if (needsOwnArguments()) {
         Value *args = arguments;