[turbofan] commit allocated registers early

R=bmeurer@chromium.org
BUG=441107
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#25772}
This commit is contained in:
dcarney 2014-12-11 04:13:08 -08:00 committed by Commit bot
parent 2f7a5af0e3
commit 8897ab8930
2 changed files with 7 additions and 3 deletions

View File

@ -135,9 +135,11 @@ LiveRange::LiveRange(int id, Zone* zone)
spills_at_definition_(nullptr) {} spills_at_definition_(nullptr) {}
void LiveRange::set_assigned_register(int reg) { void LiveRange::set_assigned_register(int reg, Zone* zone) {
DCHECK(!HasRegisterAssigned() && !IsSpilled()); DCHECK(!HasRegisterAssigned() && !IsSpilled());
assigned_register_ = reg; assigned_register_ = reg;
// TODO(dcarney): stop aliasing hint operands.
ConvertUsesToOperand(CreateAssignedOperand(zone));
} }
@ -941,6 +943,8 @@ void RegisterAllocator::ReuseSpillSlots() {
void RegisterAllocator::CommitAssignment() { void RegisterAllocator::CommitAssignment() {
for (auto range : live_ranges()) { for (auto range : live_ranges()) {
if (range == nullptr || range->IsEmpty()) continue; if (range == nullptr || range->IsEmpty()) continue;
// Register assignments were committed in set_assigned_register.
if (range->HasRegisterAssigned()) continue;
auto assigned = range->CreateAssignedOperand(code_zone()); auto assigned = range->CreateAssignedOperand(code_zone());
range->ConvertUsesToOperand(assigned); range->ConvertUsesToOperand(assigned);
if (range->IsSpilled()) { if (range->IsSpilled()) {
@ -2547,7 +2551,7 @@ void RegisterAllocator::SetLiveRangeAssignedRegister(LiveRange* range,
DCHECK(range->Kind() == GENERAL_REGISTERS); DCHECK(range->Kind() == GENERAL_REGISTERS);
assigned_registers_->Add(reg); assigned_registers_->Add(reg);
} }
range->set_assigned_register(reg); range->set_assigned_register(reg, code_zone());
} }
} // namespace compiler } // namespace compiler

View File

@ -196,7 +196,7 @@ class LiveRange FINAL : public ZoneObject {
InstructionOperand* CreateAssignedOperand(Zone* zone) const; InstructionOperand* CreateAssignedOperand(Zone* zone) const;
int assigned_register() const { return assigned_register_; } int assigned_register() const { return assigned_register_; }
int spill_start_index() const { return spill_start_index_; } int spill_start_index() const { return spill_start_index_; }
void set_assigned_register(int reg); void set_assigned_register(int reg, Zone* zone);
void MakeSpilled(); void MakeSpilled();
bool is_phi() const { return is_phi_; } bool is_phi() const { return is_phi_; }
void set_is_phi(bool is_phi) { is_phi_ = is_phi; } void set_is_phi(bool is_phi) { is_phi_ = is_phi; }