diff options
author | Erik Verbruggen <erik.verbruggen@me.com> | 2013-08-23 12:18:41 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-26 10:12:46 +0200 |
commit | 45bceeb4de951968446ad423e2076b3ef10b613e (patch) | |
tree | 2888e65eb09a8c40f61f228fcaca5fd83885a2be /src/qml/compiler/qv4isel_moth.cpp | |
parent | 1708b36910984b116b12432e7d27f8fbb25fadfa (diff) |
Interpreter fixes.
- Support constants in phi-nodes
- Fix possible null-pointer dereference.
Change-Id: I7cb773f1b4469d1cda648317670d9993d5b35ca3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4isel_moth.cpp')
-rw-r--r-- | src/qml/compiler/qv4isel_moth.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp index 807f35ad7d..affe8514b9 100644 --- a/src/qml/compiler/qv4isel_moth.cpp +++ b/src/qml/compiler/qv4isel_moth.cpp @@ -252,21 +252,26 @@ void InstructionSelection::run(V4IR::Function *function) _addrs.insert(_block, _codeNext - _codeStart); foreach (V4IR::Stmt *s, _block->statements) { + _currentStatement = s; + if (s->location.isValid()) lineNumberMappings << _codeNext - _codeStart << s->location.startLine; if (opt.isInSSA() && s->asTerminator()) { foreach (const V4IR::Optimizer::SSADeconstructionMove &move, opt.ssaDeconstructionMoves(_block)) { - Q_ASSERT(move.source->asTemp()); // FIXME: support Const exprs in Phi nodes. - if (move.needsConversion()) - convertType(move.source->asTemp(), move.target); - else - copyValue(move.source->asTemp(), move.target); + if (V4IR::Const *c = move.source->asConst()) { + loadConst(c, move.target); + } else { + Q_ASSERT(move.source->asTemp()); + if (move.needsConversion()) + convertType(move.source->asTemp(), move.target); + else + copyValue(move.source->asTemp(), move.target); + } } } - _currentStatement = s; s->accept(this); } } @@ -340,7 +345,10 @@ void InstructionSelection::convertType(V4IR::Temp *source, V4IR::Temp *target) _stackSlotAllocator->addHint(*source, *target); // FIXME: do something more useful with this info - copyValue(source, target); + if (target->type & V4IR::NumberType) + unop(V4IR::OpUPlus, source, target); + else + copyValue(source, target); } void InstructionSelection::constructActivationProperty(V4IR::Name *func, |