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:
parent
04fdcad547
commit
4d62ca4300
@ -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),
|
: operand_(operand),
|
||||||
hint_(NULL),
|
hint_(hint),
|
||||||
pos_(pos),
|
pos_(pos),
|
||||||
next_(NULL),
|
next_(NULL),
|
||||||
requires_reg_(false),
|
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* operand,
|
||||||
Zone* zone) {
|
LOperand* hint,
|
||||||
|
Zone* zone) {
|
||||||
LAllocator::TraceAlloc("Add to live range %d use position %d\n",
|
LAllocator::TraceAlloc("Add to live range %d use position %d\n",
|
||||||
id_,
|
id_,
|
||||||
pos.Value());
|
pos.Value());
|
||||||
UsePosition* use_pos = new(zone) UsePosition(pos, operand);
|
UsePosition* use_pos = new(zone) UsePosition(pos, operand, hint);
|
||||||
UsePosition* prev = NULL;
|
UsePosition* prev = NULL;
|
||||||
UsePosition* current = first_pos_;
|
UsePosition* current = first_pos_;
|
||||||
while (current != NULL && current->pos().Value() < pos.Value()) {
|
while (current != NULL && current->pos().Value() < pos.Value()) {
|
||||||
@ -470,8 +473,6 @@ UsePosition* LiveRange::AddUsePosition(LifetimePosition pos,
|
|||||||
use_pos->next_ = prev->next_;
|
use_pos->next_ = prev->next_;
|
||||||
prev->next_ = use_pos;
|
prev->next_ = use_pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
return use_pos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -725,14 +726,14 @@ void LAllocator::Define(LifetimePosition position,
|
|||||||
if (range->IsEmpty() || range->Start().Value() > position.Value()) {
|
if (range->IsEmpty() || range->Start().Value() > position.Value()) {
|
||||||
// Can happen if there is a definition without use.
|
// Can happen if there is a definition without use.
|
||||||
range->AddUseInterval(position, position.NextInstruction(), zone_);
|
range->AddUseInterval(position, position.NextInstruction(), zone_);
|
||||||
range->AddUsePosition(position.NextInstruction(), NULL, zone_);
|
range->AddUsePosition(position.NextInstruction(), NULL, NULL, zone_);
|
||||||
} else {
|
} else {
|
||||||
range->ShortenTo(position);
|
range->ShortenTo(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operand->IsUnallocated()) {
|
if (operand->IsUnallocated()) {
|
||||||
LUnallocated* unalloc_operand = LUnallocated::cast(operand);
|
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 (range == NULL) return;
|
||||||
if (operand->IsUnallocated()) {
|
if (operand->IsUnallocated()) {
|
||||||
LUnallocated* unalloc_operand = LUnallocated::cast(operand);
|
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_);
|
range->AddUseInterval(block_start, position, zone_);
|
||||||
}
|
}
|
||||||
|
@ -244,13 +244,12 @@ class UseInterval: public ZoneObject {
|
|||||||
// Representation of a use position.
|
// Representation of a use position.
|
||||||
class UsePosition: public ZoneObject {
|
class UsePosition: public ZoneObject {
|
||||||
public:
|
public:
|
||||||
UsePosition(LifetimePosition pos, LOperand* operand);
|
UsePosition(LifetimePosition pos, LOperand* operand, LOperand* hint);
|
||||||
|
|
||||||
LOperand* operand() const { return operand_; }
|
LOperand* operand() const { return operand_; }
|
||||||
bool HasOperand() const { return operand_ != NULL; }
|
bool HasOperand() const { return operand_ != NULL; }
|
||||||
|
|
||||||
LOperand* hint() const { return hint_; }
|
LOperand* hint() const { return hint_; }
|
||||||
void set_hint(LOperand* hint) { hint_ = hint; }
|
|
||||||
bool HasHint() const;
|
bool HasHint() const;
|
||||||
bool RequiresRegister() const;
|
bool RequiresRegister() const;
|
||||||
bool RegisterIsBeneficial() const;
|
bool RegisterIsBeneficial() const;
|
||||||
@ -261,9 +260,9 @@ class UsePosition: public ZoneObject {
|
|||||||
private:
|
private:
|
||||||
void set_next(UsePosition* next) { next_ = next; }
|
void set_next(UsePosition* next) { next_ = next; }
|
||||||
|
|
||||||
LOperand* operand_;
|
LOperand* const operand_;
|
||||||
LOperand* hint_;
|
LOperand* const hint_;
|
||||||
LifetimePosition pos_;
|
LifetimePosition const pos_;
|
||||||
UsePosition* next_;
|
UsePosition* next_;
|
||||||
bool requires_reg_;
|
bool requires_reg_;
|
||||||
bool register_beneficial_;
|
bool register_beneficial_;
|
||||||
@ -367,9 +366,10 @@ class LiveRange: public ZoneObject {
|
|||||||
void AddUseInterval(LifetimePosition start,
|
void AddUseInterval(LifetimePosition start,
|
||||||
LifetimePosition end,
|
LifetimePosition end,
|
||||||
Zone* zone);
|
Zone* zone);
|
||||||
UsePosition* AddUsePosition(LifetimePosition pos,
|
void AddUsePosition(LifetimePosition pos,
|
||||||
LOperand* operand,
|
LOperand* operand,
|
||||||
Zone* zone);
|
LOperand* hint,
|
||||||
|
Zone* zone);
|
||||||
|
|
||||||
// Shorten the most recently added interval by setting a new start.
|
// Shorten the most recently added interval by setting a new start.
|
||||||
void ShortenTo(LifetimePosition start);
|
void ShortenTo(LifetimePosition start);
|
||||||
|
Loading…
Reference in New Issue
Block a user