aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4jsir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/compiler/qv4jsir.cpp')
-rw-r--r--src/qml/compiler/qv4jsir.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4jsir.cpp b/src/qml/compiler/qv4jsir.cpp
index 9a1a8bab42..aa3769be46 100644
--- a/src/qml/compiler/qv4jsir.cpp
+++ b/src/qml/compiler/qv4jsir.cpp
@@ -749,6 +749,11 @@ void BasicBlock::setStatements(const QVector<Stmt *> &newStatements)
{
Q_ASSERT(!isRemoved());
Q_ASSERT(newStatements.size() >= _statements.size());
+ // FIXME: this gets quite inefficient for large basic-blocks, so this function/case should be re-worked.
+ foreach (Stmt *s, _statements) {
+ if (!newStatements.contains(s))
+ s->destroyData();
+ }
_statements = newStatements;
}
@@ -788,18 +793,21 @@ void BasicBlock::insertStatementBeforeTerminator(Stmt *stmt)
void BasicBlock::replaceStatement(int index, Stmt *newStmt)
{
Q_ASSERT(!isRemoved());
+ _statements[index]->destroyData();
_statements[index] = newStmt;
}
void BasicBlock::removeStatement(Stmt *stmt)
{
Q_ASSERT(!isRemoved());
+ stmt->destroyData();
_statements.remove(_statements.indexOf(stmt));
}
void BasicBlock::removeStatement(int idx)
{
Q_ASSERT(!isRemoved());
+ _statements[idx]->destroyData();
_statements.remove(idx);
}