Bug 1027897 - IonMonkey: Eliminate a few explicit CodePosition::pos() calls. r=bhackett

This commit is contained in:
Dan Gohman 2014-06-23 13:42:06 -07:00
parent c062b4dca6
commit 778e457ed9
3 changed files with 11 additions and 6 deletions

View File

@ -276,7 +276,7 @@ BacktrackingAllocator::tryGroupReusedRegister(uint32_t def, uint32_t use)
const LiveInterval::Range *range = interval->getRange(i);
JS_ASSERT(range->from <= inputOf(reg.ins()));
CodePosition to = (range->to <= outputOf(reg.ins())) ? range->to : outputOf(reg.ins());
CodePosition to = Min(range->to, outputOf(reg.ins()));
if (!preInterval->addRange(range->from, to))
return false;
}
@ -1358,7 +1358,7 @@ BacktrackingAllocator::computePriority(const LiveInterval *interval)
for (size_t i = 0; i < interval->numRanges(); i++) {
const LiveInterval::Range *range = interval->getRange(i);
lifetimeTotal += range->to.pos() - range->from.pos();
lifetimeTotal += range->to - range->from;
}
return lifetimeTotal;
@ -1625,7 +1625,7 @@ BacktrackingAllocator::splitAtAllRegisterUses(LiveInterval *interval)
if (spillIntervalIsNew) {
for (size_t i = 0; i < interval->numRanges(); i++) {
const LiveInterval::Range *range = interval->getRange(i);
CodePosition from = range->from < spillStart ? spillStart : range->from;
CodePosition from = Max(range->from, spillStart);
if (!spillInterval->addRange(from, range->to))
return false;
}
@ -1718,7 +1718,7 @@ BacktrackingAllocator::splitAt(LiveInterval *interval,
for (size_t i = 0; i < interval->numRanges(); i++) {
const LiveInterval::Range *range = interval->getRange(i);
CodePosition from = range->from < spillStart ? spillStart : range->from;
CodePosition from = Max(range->from, spillStart);
if (!spillInterval->addRange(from, range->to))
return false;
}

View File

@ -151,9 +151,9 @@ class BacktrackingAllocator
static int compare(const AllocatedRange &v0, const AllocatedRange &v1) {
// LiveInterval::Range includes 'from' but excludes 'to'.
if (v0.range->to.pos() <= v1.range->from.pos())
if (v0.range->to <= v1.range->from)
return -1;
if (v0.range->from.pos() >= v1.range->to.pos())
if (v0.range->from >= v1.range->to)
return 1;
return 0;
}

View File

@ -202,6 +202,11 @@ class CodePosition
return bits_ >= other.bits_;
}
uint32_t operator -(CodePosition other) const {
JS_ASSERT(bits_ >= other.bits_);
return bits_ - other.bits_;
}
CodePosition previous() const {
JS_ASSERT(*this != MIN);
return CodePosition(bits_ - 1);