aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4isel_moth.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2014-05-13 16:32:35 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-06-06 14:50:52 +0200
commit4a127e3b2e98c1d690d9baf346e4d3ee8aa4edf1 (patch)
treec1abde3de9c028a05af7ffd6ff8abb92588b5b61 /src/qml/compiler/qv4isel_moth.cpp
parentf99ddc62ea468bff2700860e30d29be91d74473e (diff)
V4 IR: Store positions for life-time intervals outside the statement.
The statement ids are now stable, so the life-time interval calculation can re-use information calculated by the optimizer. This re-use will be done in a separate patch. It also allows for changes to the numbering in a non-intrusive way. This will also come in a later patch. Change-Id: Ie3a2e1d9e3537cc8070ff3e3007f3a5e8ca0579a 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.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index b1debbda3d..18877565da 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -174,6 +174,11 @@ class AllocateStackSlots: protected ConvertTemps
QBitArray _slotIsInUse;
IR::Function *_function;
+ int position(IR::Stmt *s) const
+ {
+ return _intervals->positionForStatement(s);
+ }
+
public:
AllocateStackSlots(const IR::LifeTimeIntervals::Ptr &intervals)
: _intervals(intervals)
@@ -217,7 +222,7 @@ protected:
virtual void process(IR::Stmt *s)
{
- Q_ASSERT(s->id() > 0);
+ Q_ASSERT(position(s) > 0);
// qDebug("L%d statement %d:", _currentBasicBlock->index, s->id);
@@ -227,7 +232,7 @@ protected:
// purge ranges no longer alive:
for (int i = 0; i < _live.size(); ) {
const IR::LifeTimeInterval *lti = _live.at(i);
- if (lti->end() < s->id()) {
+ if (lti->end() < position(s)) {
// qDebug() << "\t - moving temp" << lti->temp().index << "to handled, freeing slot" << _stackSlotForTemp[lti->temp().index];
_live.remove(i);
Q_ASSERT(_slotIsInUse[_stackSlotForTemp[lti->temp().index]]);
@@ -241,7 +246,7 @@ protected:
// active new ranges:
while (!_unhandled.isEmpty()) {
IR::LifeTimeInterval *lti = _unhandled.last();
- if (lti->start() > s->id())
+ if (lti->start() > position(s))
break; // we're done
Q_ASSERT(!_stackSlotForTemp.contains(lti->temp().index));
_stackSlotForTemp[lti->temp().index] = allocateFreeSlot();