| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 spilled_(false), | 154 spilled_(false), |
| 155 is_double_(false), | 155 is_double_(false), |
| 156 assigned_register_(kInvalidAssignment), | 156 assigned_register_(kInvalidAssignment), |
| 157 last_interval_(NULL), | 157 last_interval_(NULL), |
| 158 first_interval_(NULL), | 158 first_interval_(NULL), |
| 159 first_pos_(NULL), | 159 first_pos_(NULL), |
| 160 parent_(NULL), | 160 parent_(NULL), |
| 161 next_(NULL), | 161 next_(NULL), |
| 162 current_interval_(NULL), | 162 current_interval_(NULL), |
| 163 last_processed_use_(NULL), | 163 last_processed_use_(NULL), |
| 164 spill_start_index_(kMaxInt) { | 164 spill_operand_(new LOperand()), |
| 165 spill_operand_ = new LUnallocated(LUnallocated::IGNORE); | 165 spill_start_index_(kMaxInt) { } |
| 166 } | |
| 167 | 166 |
| 168 | 167 |
| 169 void LiveRange::set_assigned_register(int reg, RegisterKind register_kind) { | 168 void LiveRange::set_assigned_register(int reg, RegisterKind register_kind) { |
| 170 ASSERT(!HasRegisterAssigned() && !IsSpilled()); | 169 ASSERT(!HasRegisterAssigned() && !IsSpilled()); |
| 171 assigned_register_ = reg; | 170 assigned_register_ = reg; |
| 172 is_double_ = (register_kind == DOUBLE_REGISTERS); | 171 is_double_ = (register_kind == DOUBLE_REGISTERS); |
| 173 ConvertOperands(); | 172 ConvertOperands(); |
| 174 } | 173 } |
| 175 | 174 |
| 176 | 175 |
| 177 void LiveRange::MakeSpilled() { | 176 void LiveRange::MakeSpilled() { |
| 178 ASSERT(!IsSpilled()); | 177 ASSERT(!IsSpilled()); |
| 179 ASSERT(TopLevel()->HasAllocatedSpillOperand()); | 178 ASSERT(TopLevel()->HasAllocatedSpillOperand()); |
| 180 spilled_ = true; | 179 spilled_ = true; |
| 181 assigned_register_ = kInvalidAssignment; | 180 assigned_register_ = kInvalidAssignment; |
| 182 ConvertOperands(); | 181 ConvertOperands(); |
| 183 } | 182 } |
| 184 | 183 |
| 185 | 184 |
| 186 bool LiveRange::HasAllocatedSpillOperand() const { | 185 bool LiveRange::HasAllocatedSpillOperand() const { |
| 187 return spill_operand_ != NULL && !spill_operand_->IsUnallocated(); | 186 ASSERT(spill_operand_ != NULL); |
| 187 return !spill_operand_->IsIgnored(); |
| 188 } | 188 } |
| 189 | 189 |
| 190 | 190 |
| 191 void LiveRange::SetSpillOperand(LOperand* operand) { | 191 void LiveRange::SetSpillOperand(LOperand* operand) { |
| 192 ASSERT(!operand->IsUnallocated()); | 192 ASSERT(!operand->IsUnallocated()); |
| 193 ASSERT(spill_operand_ != NULL); | 193 ASSERT(spill_operand_ != NULL); |
| 194 ASSERT(spill_operand_->IsUnallocated()); | 194 ASSERT(spill_operand_->IsIgnored()); |
| 195 spill_operand_->ConvertTo(operand->kind(), operand->index()); | 195 spill_operand_->ConvertTo(operand->kind(), operand->index()); |
| 196 } | 196 } |
| 197 | 197 |
| 198 | 198 |
| 199 UsePosition* LiveRange::NextUsePosition(LifetimePosition start) { | 199 UsePosition* LiveRange::NextUsePosition(LifetimePosition start) { |
| 200 UsePosition* use_pos = last_processed_use_; | 200 UsePosition* use_pos = last_processed_use_; |
| 201 if (use_pos == NULL) use_pos = first_pos(); | 201 if (use_pos == NULL) use_pos = first_pos(); |
| 202 while (use_pos != NULL && use_pos->pos().Value() < start.Value()) { | 202 while (use_pos != NULL && use_pos->pos().Value() < start.Value()) { |
| 203 use_pos = use_pos->next(); | 203 use_pos = use_pos->next(); |
| 204 } | 204 } |
| (...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1636 } | 1636 } |
| 1637 } | 1637 } |
| 1638 | 1638 |
| 1639 | 1639 |
| 1640 void LAllocator::RecordUse(HValue* value, LUnallocated* operand) { | 1640 void LAllocator::RecordUse(HValue* value, LUnallocated* operand) { |
| 1641 operand->set_virtual_register(value->id()); | 1641 operand->set_virtual_register(value->id()); |
| 1642 } | 1642 } |
| 1643 | 1643 |
| 1644 | 1644 |
| 1645 int LAllocator::max_initial_value_ids() { | 1645 int LAllocator::max_initial_value_ids() { |
| 1646 return LUnallocated::kMaxVirtualRegisters / 32; | 1646 return LUnallocated::kMaxVirtualRegisters / 16; |
| 1647 } | 1647 } |
| 1648 | 1648 |
| 1649 | 1649 |
| 1650 void LAllocator::AddToActive(LiveRange* range) { | 1650 void LAllocator::AddToActive(LiveRange* range) { |
| 1651 TraceAlloc("Add live range %d to active\n", range->id()); | 1651 TraceAlloc("Add live range %d to active\n", range->id()); |
| 1652 active_live_ranges_.Add(range); | 1652 active_live_ranges_.Add(range); |
| 1653 } | 1653 } |
| 1654 | 1654 |
| 1655 | 1655 |
| 1656 void LAllocator::AddToInactive(LiveRange* range) { | 1656 void LAllocator::AddToInactive(LiveRange* range) { |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2122 LiveRange* current = live_ranges()->at(i); | 2122 LiveRange* current = live_ranges()->at(i); |
| 2123 if (current != NULL) current->Verify(); | 2123 if (current != NULL) current->Verify(); |
| 2124 } | 2124 } |
| 2125 } | 2125 } |
| 2126 | 2126 |
| 2127 | 2127 |
| 2128 #endif | 2128 #endif |
| 2129 | 2129 |
| 2130 | 2130 |
| 2131 } } // namespace v8::internal | 2131 } } // namespace v8::internal |
| OLD | NEW |