_sortedRanges.append(range);
}
std::sort(_sortedRanges.begin(), _sortedRanges.end(), LifeTimeInterval::lessThan);
+ _intervals.clear();
}
QVector<LifeTimeInterval> ranges() const { return _sortedRanges; }
// search where to split the interval
for (int i = 0, ei = _ranges.size(); i < ei; ++i) {
- if (_ranges[i].start <= atPosition) {
- if (_ranges[i].end >= atPosition) {
+ if (_ranges.at(i).start <= atPosition) {
+ if (_ranges.at(i).end >= atPosition) {
// split happens in the middle of a range. Keep this range in both the old and the
// new interval, and correct the end/start later
_ranges.resize(i + 1);
, _reg(Invalid)
, _isFixedInterval(0)
, _isSplitFromInterval(0)
- {}
+ { _ranges.reserve(2); }
bool isValid() const { return _end != Invalid; }
void setFrom(Stmt *from);
void addRange(int from, int to);
- Ranges ranges() const { return _ranges; }
+ const Ranges &ranges() const { return _ranges; }
void reserveRanges(int capacity) { _ranges.reserve(capacity); }
int start() const { return _ranges.first().start; }
qSwap(_removableJumps, removableJumps);
}
-void *InstructionSelection::addConstantTable(QVector<Primitive> *values)
+const void *InstructionSelection::addConstantTable(QVector<Primitive> *values)
{
compilationUnit->constantValues.append(*values);
values->clear();
QVector<QV4::Primitive> &finalValues = compilationUnit->constantValues.last();
finalValues.squeeze();
- return finalValues.data();
+ return finalValues.constData();
}
QV4::CompiledData::CompilationUnit *InstructionSelection::backendCompileStep()
void Assembler::ConstantTable::finalize(JSC::LinkBuffer &linkBuffer, InstructionSelection *isel)
{
- void *tablePtr = isel->addConstantTable(&_values);
+ const void *tablePtr = isel->addConstantTable(&_values);
foreach (DataLabelPtr label, _toPatch)
- linkBuffer.patch(label, tablePtr);
+ linkBuffer.patch(label, const_cast<void *>(tablePtr));
}
bool InstructionSelection::visitCJumpDouble(IR::AluOp op, IR::Expr *left, IR::Expr *right,
virtual void run(int functionIndex);
- void *addConstantTable(QVector<QV4::Primitive> *values);
+ const void *addConstantTable(QVector<QV4::Primitive> *values);
protected:
virtual QV4::CompiledData::CompilationUnit *backendCompileStep();