diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-10-02 15:14:45 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-03 08:52:11 +0200 |
commit | a0a037c4651902f43c686dd92b64c98800c0a3a7 (patch) | |
tree | 1d8a79cf0d5410997331a846148d3e9abb48ae03 /src/qml/compiler | |
parent | b5198ce221c67c9772b3a205fd3823a9c516a9ec (diff) |
Use a QVector instead of a QList
This makes the code go quite a bit faster (saves ~7-8% of the
total amount of instructions executed when running crypto.js
Change-Id: I6b3bd08eca98b45593262e2fc6e0ce5056257e76
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/compiler')
-rw-r--r-- | src/qml/compiler/qv4isel_moth.cpp | 2 | ||||
-rw-r--r-- | src/qml/compiler/qv4regalloc.cpp | 16 | ||||
-rw-r--r-- | src/qml/compiler/qv4regalloc_p.h | 2 | ||||
-rw-r--r-- | src/qml/compiler/qv4ssa.cpp | 6 | ||||
-rw-r--r-- | src/qml/compiler/qv4ssa_p.h | 9 |
5 files changed, 20 insertions, 15 deletions
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp index 4bea6322e6..7c999edb59 100644 --- a/src/qml/compiler/qv4isel_moth.cpp +++ b/src/qml/compiler/qv4isel_moth.cpp @@ -149,7 +149,7 @@ class QQmlJS::Moth::StackSlotAllocator QHash<V4IR::Temp, V4IR::LifeTimeInterval> _intervals; public: - StackSlotAllocator(const QList<V4IR::LifeTimeInterval> &ranges, int maxTempCount) + StackSlotAllocator(const QVector<V4IR::LifeTimeInterval> &ranges, int maxTempCount) : _activeSlots(maxTempCount) { _intervals.reserve(ranges.size()); diff --git a/src/qml/compiler/qv4regalloc.cpp b/src/qml/compiler/qv4regalloc.cpp index 7fd5864af3..58c84add2e 100644 --- a/src/qml/compiler/qv4regalloc.cpp +++ b/src/qml/compiler/qv4regalloc.cpp @@ -589,7 +589,7 @@ using namespace QT_PREPEND_NAMESPACE(QQmlJS); namespace { class ResolutionPhase: protected StmtVisitor, protected ExprVisitor { - QList<LifeTimeInterval> _intervals; + QVector<LifeTimeInterval> _intervals; Function *_function; RegAllocInfo *_info; const QHash<V4IR::Temp, int> &_assignedSpillSlots; @@ -605,7 +605,7 @@ class ResolutionPhase: protected StmtVisitor, protected ExprVisitor { QHash<BasicBlock *, QList<LifeTimeInterval> > _liveAtEnd; public: - ResolutionPhase(const QList<LifeTimeInterval> &intervals, Function *function, RegAllocInfo *info, + ResolutionPhase(const QVector<LifeTimeInterval> &intervals, Function *function, RegAllocInfo *info, const QHash<V4IR::Temp, int> &assignedSpillSlots, const QVector<int> &intRegs, const QVector<int> &fpRegs) : _intervals(intervals) @@ -709,7 +709,7 @@ private: break; if (i.temp() == *phi->targetTemp) { activate(i); - _intervals.removeAt(it); + _intervals.remove(it); break; } } @@ -1073,10 +1073,10 @@ void RegisterAllocator::linearScan() if (it.end() < position) { if (!it.isFixedInterval()) _handled += it; - _active.removeAt(i); + _active.remove(i); } else if (!it.covers(position)) { _inactive += it; - _active.removeAt(i); + _active.remove(i); } else { ++i; } @@ -1088,11 +1088,11 @@ void RegisterAllocator::linearScan() if (it.end() < position) { if (!it.isFixedInterval()) _handled += it; - _inactive.removeAt(i); + _inactive.remove(i); } else if (it.covers(position)) { if (it.reg() != LifeTimeInterval::Invalid) { _active += it; - _inactive.removeAt(i); + _inactive.remove(i); } else { // although this interval is now active, it has no register allocated (always // spilled), so leave it in inactive. @@ -1380,7 +1380,7 @@ int RegisterAllocator::nextUse(const Temp &t, int startPosition) const return -1; } -static inline void insertSorted(QList<LifeTimeInterval> &intervals, const LifeTimeInterval &newInterval) +static inline void insertSorted(QVector<LifeTimeInterval> &intervals, const LifeTimeInterval &newInterval) { for (int i = 0, ei = intervals.size(); i != ei; ++i) { if (LifeTimeInterval::lessThan(newInterval, intervals.at(i))) { diff --git a/src/qml/compiler/qv4regalloc_p.h b/src/qml/compiler/qv4regalloc_p.h index 40e88c1950..53d09f6252 100644 --- a/src/qml/compiler/qv4regalloc_p.h +++ b/src/qml/compiler/qv4regalloc_p.h @@ -64,7 +64,7 @@ class RegisterAllocator QVector<LifeTimeInterval> _fixedRegisterRanges, _fixedFPRegisterRanges; - QList<LifeTimeInterval> _unhandled, _active, _inactive, _handled; + QVector<LifeTimeInterval> _unhandled, _active, _inactive, _handled; QHash<V4IR::Temp, int> _lastAssignedRegister; QHash<V4IR::Temp, int> _assignedSpillSlots; diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index 04628743c7..6ad9a5731f 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -2630,7 +2630,7 @@ class LifeRanges { QHash<BasicBlock *, LiveRegs> _liveIn; QHash<Temp, LifeTimeInterval> _intervals; - QList<LifeTimeInterval> _sortedRanges; + QVector<LifeTimeInterval> _sortedRanges; public: LifeRanges(Function *function, const QHash<BasicBlock *, BasicBlock *> &startEndLoops) @@ -2659,7 +2659,7 @@ public: std::sort(_sortedRanges.begin(), _sortedRanges.end(), LifeTimeInterval::lessThan); } - QList<LifeTimeInterval> ranges() const { return _sortedRanges; } + QVector<LifeTimeInterval> ranges() const { return _sortedRanges; } void dump() const { @@ -2966,7 +2966,7 @@ void Optimizer::convertOutOfSSA() { } } -QList<LifeTimeInterval> Optimizer::lifeRanges() const +QVector<LifeTimeInterval> Optimizer::lifeRanges() const { Q_ASSERT(isInSSA()); diff --git a/src/qml/compiler/qv4ssa_p.h b/src/qml/compiler/qv4ssa_p.h index 7b4cce89d8..ceaef9f938 100644 --- a/src/qml/compiler/qv4ssa_p.h +++ b/src/qml/compiler/qv4ssa_p.h @@ -63,7 +63,7 @@ public: bool covers(int position) const { return start <= position && position <= end; } }; - typedef QList<Range> Ranges; + typedef QVector<Range> Ranges; private: Temp _temp; @@ -139,7 +139,7 @@ public: QHash<BasicBlock *, BasicBlock *> loopStartEndBlocks() const { return startEndLoops; } - QList<LifeTimeInterval> lifeRanges() const; + QVector<LifeTimeInterval> lifeRanges() const; static void showMeTheCode(Function *function); @@ -184,6 +184,11 @@ private: } // V4IR namespace } // QQmlJS namespace + + +Q_DECLARE_TYPEINFO(QQmlJS::V4IR::LifeTimeInterval, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(QQmlJS::V4IR::LifeTimeInterval::Range, Q_PRIMITIVE_TYPE); + QT_END_NAMESPACE #endif // QV4SSA_P_H |