Make UsePosition::hint immutable.

R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/14524008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14489 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mstarzinger@chromium.org 2013-04-30 08:21:52 +00:00
parent 04fdcad547
commit 4d62ca4300
2 changed files with 20 additions and 19 deletions

View File

@ -56,9 +56,11 @@ static inline LifetimePosition Max(LifetimePosition a, LifetimePosition b) {
}
UsePosition::UsePosition(LifetimePosition pos, LOperand* operand)
UsePosition::UsePosition(LifetimePosition pos,
LOperand* operand,
LOperand* hint)
: operand_(operand),
hint_(NULL),
hint_(hint),
pos_(pos),
next_(NULL),
requires_reg_(false),
@ -449,13 +451,14 @@ void LiveRange::AddUseInterval(LifetimePosition start,
}
UsePosition* LiveRange::AddUsePosition(LifetimePosition pos,
void LiveRange::AddUsePosition(LifetimePosition pos,
LOperand* operand,
LOperand* hint,
Zone* zone) {
LAllocator::TraceAlloc("Add to live range %d use position %d\n",
id_,
pos.Value());
UsePosition* use_pos = new(zone) UsePosition(pos, operand);
UsePosition* use_pos = new(zone) UsePosition(pos, operand, hint);
UsePosition* prev = NULL;
UsePosition* current = first_pos_;
while (current != NULL && current->pos().Value() < pos.Value()) {
@ -470,8 +473,6 @@ UsePosition* LiveRange::AddUsePosition(LifetimePosition pos,
use_pos->next_ = prev->next_;
prev->next_ = use_pos;
}
return use_pos;
}
@ -725,14 +726,14 @@ void LAllocator::Define(LifetimePosition position,
if (range->IsEmpty() || range->Start().Value() > position.Value()) {
// Can happen if there is a definition without use.
range->AddUseInterval(position, position.NextInstruction(), zone_);
range->AddUsePosition(position.NextInstruction(), NULL, zone_);
range->AddUsePosition(position.NextInstruction(), NULL, NULL, zone_);
} else {
range->ShortenTo(position);
}
if (operand->IsUnallocated()) {
LUnallocated* unalloc_operand = LUnallocated::cast(operand);
range->AddUsePosition(position, unalloc_operand, zone_)->set_hint(hint);
range->AddUsePosition(position, unalloc_operand, hint, zone_);
}
}
@ -745,7 +746,7 @@ void LAllocator::Use(LifetimePosition block_start,
if (range == NULL) return;
if (operand->IsUnallocated()) {
LUnallocated* unalloc_operand = LUnallocated::cast(operand);
range->AddUsePosition(position, unalloc_operand, zone_)->set_hint(hint);
range->AddUsePosition(position, unalloc_operand, hint, zone_);
}
range->AddUseInterval(block_start, position, zone_);
}

View File

@ -244,13 +244,12 @@ class UseInterval: public ZoneObject {
// Representation of a use position.
class UsePosition: public ZoneObject {
public:
UsePosition(LifetimePosition pos, LOperand* operand);
UsePosition(LifetimePosition pos, LOperand* operand, LOperand* hint);
LOperand* operand() const { return operand_; }
bool HasOperand() const { return operand_ != NULL; }
LOperand* hint() const { return hint_; }
void set_hint(LOperand* hint) { hint_ = hint; }
bool HasHint() const;
bool RequiresRegister() const;
bool RegisterIsBeneficial() const;
@ -261,9 +260,9 @@ class UsePosition: public ZoneObject {
private:
void set_next(UsePosition* next) { next_ = next; }
LOperand* operand_;
LOperand* hint_;
LifetimePosition pos_;
LOperand* const operand_;
LOperand* const hint_;
LifetimePosition const pos_;
UsePosition* next_;
bool requires_reg_;
bool register_beneficial_;
@ -367,8 +366,9 @@ class LiveRange: public ZoneObject {
void AddUseInterval(LifetimePosition start,
LifetimePosition end,
Zone* zone);
UsePosition* AddUsePosition(LifetimePosition pos,
void AddUsePosition(LifetimePosition pos,
LOperand* operand,
LOperand* hint,
Zone* zone);
// Shorten the most recently added interval by setting a new start.