OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 return false; | 124 return false; |
125 } | 125 } |
126 | 126 |
127 | 127 |
128 #endif | 128 #endif |
129 | 129 |
130 | 130 |
131 LiveRange::LiveRange(int id, Zone* zone) | 131 LiveRange::LiveRange(int id, Zone* zone) |
132 : id_(id), | 132 : id_(id), |
133 spilled_(false), | 133 spilled_(false), |
134 is_double_(false), | 134 kind_(UNALLOCATED_REGISTERS), |
135 assigned_register_(kInvalidAssignment), | 135 assigned_register_(kInvalidAssignment), |
136 last_interval_(NULL), | 136 last_interval_(NULL), |
137 first_interval_(NULL), | 137 first_interval_(NULL), |
138 first_pos_(NULL), | 138 first_pos_(NULL), |
139 parent_(NULL), | 139 parent_(NULL), |
140 next_(NULL), | 140 next_(NULL), |
141 current_interval_(NULL), | 141 current_interval_(NULL), |
142 last_processed_use_(NULL), | 142 last_processed_use_(NULL), |
143 current_hint_operand_(NULL), | 143 current_hint_operand_(NULL), |
144 spill_operand_(new(zone) LOperand()), | 144 spill_operand_(new(zone) LOperand()), |
145 spill_start_index_(kMaxInt) { } | 145 spill_start_index_(kMaxInt) { } |
146 | 146 |
147 | 147 |
148 void LiveRange::set_assigned_register(int reg, | 148 void LiveRange::set_assigned_register(int reg, Zone* zone) { |
149 RegisterKind register_kind, | |
150 Zone* zone) { | |
151 ASSERT(!HasRegisterAssigned() && !IsSpilled()); | 149 ASSERT(!HasRegisterAssigned() && !IsSpilled()); |
152 assigned_register_ = reg; | 150 assigned_register_ = reg; |
153 is_double_ = (register_kind == DOUBLE_REGISTERS); | |
154 ConvertOperands(zone); | 151 ConvertOperands(zone); |
155 } | 152 } |
156 | 153 |
157 | 154 |
158 void LiveRange::MakeSpilled(Zone* zone) { | 155 void LiveRange::MakeSpilled(Zone* zone) { |
159 ASSERT(!IsSpilled()); | 156 ASSERT(!IsSpilled()); |
160 ASSERT(TopLevel()->HasAllocatedSpillOperand()); | 157 ASSERT(TopLevel()->HasAllocatedSpillOperand()); |
161 spilled_ = true; | 158 spilled_ = true; |
162 assigned_register_ = kInvalidAssignment; | 159 assigned_register_ = kInvalidAssignment; |
163 ConvertOperands(zone); | 160 ConvertOperands(zone); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 if (use_pos == NULL) return true; | 224 if (use_pos == NULL) return true; |
228 return | 225 return |
229 use_pos->pos().Value() > pos.NextInstruction().InstructionEnd().Value(); | 226 use_pos->pos().Value() > pos.NextInstruction().InstructionEnd().Value(); |
230 } | 227 } |
231 | 228 |
232 | 229 |
233 LOperand* LiveRange::CreateAssignedOperand(Zone* zone) { | 230 LOperand* LiveRange::CreateAssignedOperand(Zone* zone) { |
234 LOperand* op = NULL; | 231 LOperand* op = NULL; |
235 if (HasRegisterAssigned()) { | 232 if (HasRegisterAssigned()) { |
236 ASSERT(!IsSpilled()); | 233 ASSERT(!IsSpilled()); |
237 if (IsDouble()) { | 234 switch (Kind()) { |
238 op = LDoubleRegister::Create(assigned_register(), zone); | 235 case GENERAL_REGISTERS: |
239 } else { | 236 op = LRegister::Create(assigned_register(), zone); |
240 op = LRegister::Create(assigned_register(), zone); | 237 break; |
| 238 case DOUBLE_REGISTERS: |
| 239 op = LDoubleRegister::Create(assigned_register(), zone); |
| 240 break; |
| 241 default: |
| 242 UNREACHABLE(); |
241 } | 243 } |
242 } else if (IsSpilled()) { | 244 } else if (IsSpilled()) { |
243 ASSERT(!HasRegisterAssigned()); | 245 ASSERT(!HasRegisterAssigned()); |
244 op = TopLevel()->GetSpillOperand(); | 246 op = TopLevel()->GetSpillOperand(); |
245 ASSERT(!op->IsUnallocated()); | 247 ASSERT(!op->IsUnallocated()); |
246 } else { | 248 } else { |
247 LUnallocated* unalloc = new(zone) LUnallocated(LUnallocated::NONE); | 249 LUnallocated* unalloc = new(zone) LUnallocated(LUnallocated::NONE); |
248 unalloc->set_virtual_register(id_); | 250 unalloc->set_virtual_register(id_); |
249 op = unalloc; | 251 op = unalloc; |
250 } | 252 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 result->first_pos_ = use_after; | 347 result->first_pos_ = use_after; |
346 | 348 |
347 // Discard cached iteration state. It might be pointing | 349 // Discard cached iteration state. It might be pointing |
348 // to the use that no longer belongs to this live range. | 350 // to the use that no longer belongs to this live range. |
349 last_processed_use_ = NULL; | 351 last_processed_use_ = NULL; |
350 current_interval_ = NULL; | 352 current_interval_ = NULL; |
351 | 353 |
352 // Link the new live range in the chain before any of the other | 354 // Link the new live range in the chain before any of the other |
353 // ranges linked from the range before the split. | 355 // ranges linked from the range before the split. |
354 result->parent_ = (parent_ == NULL) ? this : parent_; | 356 result->parent_ = (parent_ == NULL) ? this : parent_; |
| 357 result->kind_ = result->parent_->kind_; |
355 result->next_ = next_; | 358 result->next_ = next_; |
356 next_ = result; | 359 next_ = result; |
357 | 360 |
358 #ifdef DEBUG | 361 #ifdef DEBUG |
359 Verify(); | 362 Verify(); |
360 result->Verify(); | 363 result->Verify(); |
361 #endif | 364 #endif |
362 } | 365 } |
363 | 366 |
364 | 367 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 live_in_sets_(graph->blocks()->length(), zone()), | 549 live_in_sets_(graph->blocks()->length(), zone()), |
547 live_ranges_(num_values * 2, zone()), | 550 live_ranges_(num_values * 2, zone()), |
548 fixed_live_ranges_(NULL), | 551 fixed_live_ranges_(NULL), |
549 fixed_double_live_ranges_(NULL), | 552 fixed_double_live_ranges_(NULL), |
550 unhandled_live_ranges_(num_values * 2, zone()), | 553 unhandled_live_ranges_(num_values * 2, zone()), |
551 active_live_ranges_(8, zone()), | 554 active_live_ranges_(8, zone()), |
552 inactive_live_ranges_(8, zone()), | 555 inactive_live_ranges_(8, zone()), |
553 reusable_slots_(8, zone()), | 556 reusable_slots_(8, zone()), |
554 next_virtual_register_(num_values), | 557 next_virtual_register_(num_values), |
555 first_artificial_register_(num_values), | 558 first_artificial_register_(num_values), |
556 mode_(GENERAL_REGISTERS), | 559 mode_(UNALLOCATED_REGISTERS), |
557 num_registers_(-1), | 560 num_registers_(-1), |
558 graph_(graph), | 561 graph_(graph), |
559 has_osr_entry_(false), | 562 has_osr_entry_(false), |
560 allocation_ok_(true) { } | 563 allocation_ok_(true) { } |
561 | 564 |
562 | 565 |
563 void LAllocator::InitializeLivenessAnalysis() { | 566 void LAllocator::InitializeLivenessAnalysis() { |
564 // Initialize the live_in sets for each block to NULL. | 567 // Initialize the live_in sets for each block to NULL. |
565 int block_count = graph_->blocks()->length(); | 568 int block_count = graph_->blocks()->length(); |
566 live_in_sets_.Initialize(block_count, zone()); | 569 live_in_sets_.Initialize(block_count, zone()); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 return operand; | 649 return operand; |
647 } | 650 } |
648 | 651 |
649 | 652 |
650 LiveRange* LAllocator::FixedLiveRangeFor(int index) { | 653 LiveRange* LAllocator::FixedLiveRangeFor(int index) { |
651 ASSERT(index < Register::kMaxNumAllocatableRegisters); | 654 ASSERT(index < Register::kMaxNumAllocatableRegisters); |
652 LiveRange* result = fixed_live_ranges_[index]; | 655 LiveRange* result = fixed_live_ranges_[index]; |
653 if (result == NULL) { | 656 if (result == NULL) { |
654 result = new(zone()) LiveRange(FixedLiveRangeID(index), chunk()->zone()); | 657 result = new(zone()) LiveRange(FixedLiveRangeID(index), chunk()->zone()); |
655 ASSERT(result->IsFixed()); | 658 ASSERT(result->IsFixed()); |
656 SetLiveRangeAssignedRegister(result, index, GENERAL_REGISTERS); | 659 result->kind_ = GENERAL_REGISTERS; |
| 660 SetLiveRangeAssignedRegister(result, index); |
657 fixed_live_ranges_[index] = result; | 661 fixed_live_ranges_[index] = result; |
658 } | 662 } |
659 return result; | 663 return result; |
660 } | 664 } |
661 | 665 |
662 | 666 |
663 LiveRange* LAllocator::FixedDoubleLiveRangeFor(int index) { | 667 LiveRange* LAllocator::FixedDoubleLiveRangeFor(int index) { |
664 ASSERT(index < DoubleRegister::NumAllocatableRegisters()); | 668 ASSERT(index < DoubleRegister::NumAllocatableRegisters()); |
665 LiveRange* result = fixed_double_live_ranges_[index]; | 669 LiveRange* result = fixed_double_live_ranges_[index]; |
666 if (result == NULL) { | 670 if (result == NULL) { |
667 result = new(zone()) LiveRange(FixedDoubleLiveRangeID(index), | 671 result = new(zone()) LiveRange(FixedDoubleLiveRangeID(index), |
668 chunk()->zone()); | 672 chunk()->zone()); |
669 ASSERT(result->IsFixed()); | 673 ASSERT(result->IsFixed()); |
670 SetLiveRangeAssignedRegister(result, index, DOUBLE_REGISTERS); | 674 result->kind_ = DOUBLE_REGISTERS; |
| 675 SetLiveRangeAssignedRegister(result, index); |
671 fixed_double_live_ranges_[index] = result; | 676 fixed_double_live_ranges_[index] = result; |
672 } | 677 } |
673 return result; | 678 return result; |
674 } | 679 } |
675 | 680 |
676 | 681 |
677 LiveRange* LAllocator::LiveRangeFor(int index) { | 682 LiveRange* LAllocator::LiveRangeFor(int index) { |
678 if (index >= live_ranges_.length()) { | 683 if (index >= live_ranges_.length()) { |
679 live_ranges_.AddBlock(NULL, index - live_ranges_.length() + 1, zone()); | 684 live_ranges_.AddBlock(NULL, index - live_ranges_.length() + 1, zone()); |
680 } | 685 } |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 } | 1373 } |
1369 PrintF("Value %d used before first definition!\n", operand_index); | 1374 PrintF("Value %d used before first definition!\n", operand_index); |
1370 LiveRange* range = LiveRangeFor(operand_index); | 1375 LiveRange* range = LiveRangeFor(operand_index); |
1371 PrintF("First use is at %d\n", range->first_pos()->pos().Value()); | 1376 PrintF("First use is at %d\n", range->first_pos()->pos().Value()); |
1372 iterator.Advance(); | 1377 iterator.Advance(); |
1373 } | 1378 } |
1374 ASSERT(!found); | 1379 ASSERT(!found); |
1375 } | 1380 } |
1376 #endif | 1381 #endif |
1377 } | 1382 } |
| 1383 |
| 1384 for (int i = 0; i < live_ranges_.length(); ++i) { |
| 1385 if (live_ranges_[i] != NULL) { |
| 1386 live_ranges_[i]->kind_ = RequiredRegisterKind(live_ranges_[i]->id()); |
| 1387 } |
| 1388 } |
1378 } | 1389 } |
1379 | 1390 |
1380 | 1391 |
1381 bool LAllocator::SafePointsAreInOrder() const { | 1392 bool LAllocator::SafePointsAreInOrder() const { |
1382 const ZoneList<LPointerMap*>* pointer_maps = chunk_->pointer_maps(); | 1393 const ZoneList<LPointerMap*>* pointer_maps = chunk_->pointer_maps(); |
1383 int safe_point = 0; | 1394 int safe_point = 0; |
1384 for (int i = 0; i < pointer_maps->length(); ++i) { | 1395 for (int i = 0; i < pointer_maps->length(); ++i) { |
1385 LPointerMap* map = pointer_maps->at(i); | 1396 LPointerMap* map = pointer_maps->at(i); |
1386 if (safe_point > map->lithium_position()) return false; | 1397 if (safe_point > map->lithium_position()) return false; |
1387 safe_point = map->lithium_position(); | 1398 safe_point = map->lithium_position(); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1474 map->RecordPointer(operand, chunk()->zone()); | 1485 map->RecordPointer(operand, chunk()->zone()); |
1475 } | 1486 } |
1476 } | 1487 } |
1477 } | 1488 } |
1478 } | 1489 } |
1479 | 1490 |
1480 | 1491 |
1481 void LAllocator::AllocateGeneralRegisters() { | 1492 void LAllocator::AllocateGeneralRegisters() { |
1482 LAllocatorPhase phase("L_Allocate general registers", this); | 1493 LAllocatorPhase phase("L_Allocate general registers", this); |
1483 num_registers_ = Register::NumAllocatableRegisters(); | 1494 num_registers_ = Register::NumAllocatableRegisters(); |
| 1495 mode_ = GENERAL_REGISTERS; |
1484 AllocateRegisters(); | 1496 AllocateRegisters(); |
1485 } | 1497 } |
1486 | 1498 |
1487 | 1499 |
1488 void LAllocator::AllocateDoubleRegisters() { | 1500 void LAllocator::AllocateDoubleRegisters() { |
1489 LAllocatorPhase phase("L_Allocate double registers", this); | 1501 LAllocatorPhase phase("L_Allocate double registers", this); |
1490 num_registers_ = DoubleRegister::NumAllocatableRegisters(); | 1502 num_registers_ = DoubleRegister::NumAllocatableRegisters(); |
1491 mode_ = DOUBLE_REGISTERS; | 1503 mode_ = DOUBLE_REGISTERS; |
1492 AllocateRegisters(); | 1504 AllocateRegisters(); |
1493 } | 1505 } |
1494 | 1506 |
1495 | 1507 |
1496 void LAllocator::AllocateRegisters() { | 1508 void LAllocator::AllocateRegisters() { |
1497 ASSERT(unhandled_live_ranges_.is_empty()); | 1509 ASSERT(unhandled_live_ranges_.is_empty()); |
1498 | 1510 |
1499 for (int i = 0; i < live_ranges_.length(); ++i) { | 1511 for (int i = 0; i < live_ranges_.length(); ++i) { |
1500 if (live_ranges_[i] != NULL) { | 1512 if (live_ranges_[i] != NULL) { |
1501 if (RequiredRegisterKind(live_ranges_[i]->id()) == mode_) { | 1513 if (live_ranges_[i]->Kind() == mode_) { |
1502 AddToUnhandledUnsorted(live_ranges_[i]); | 1514 AddToUnhandledUnsorted(live_ranges_[i]); |
1503 } | 1515 } |
1504 } | 1516 } |
1505 } | 1517 } |
1506 SortUnhandled(); | 1518 SortUnhandled(); |
1507 ASSERT(UnhandledIsSorted()); | 1519 ASSERT(UnhandledIsSorted()); |
1508 | 1520 |
1509 ASSERT(reusable_slots_.is_empty()); | 1521 ASSERT(reusable_slots_.is_empty()); |
1510 ASSERT(active_live_ranges_.is_empty()); | 1522 ASSERT(active_live_ranges_.is_empty()); |
1511 ASSERT(inactive_live_ranges_.is_empty()); | 1523 ASSERT(inactive_live_ranges_.is_empty()); |
1512 | 1524 |
1513 if (mode_ == DOUBLE_REGISTERS) { | 1525 if (mode_ == DOUBLE_REGISTERS) { |
1514 for (int i = 0; i < DoubleRegister::NumAllocatableRegisters(); ++i) { | 1526 for (int i = 0; i < DoubleRegister::NumAllocatableRegisters(); ++i) { |
1515 LiveRange* current = fixed_double_live_ranges_.at(i); | 1527 LiveRange* current = fixed_double_live_ranges_.at(i); |
1516 if (current != NULL) { | 1528 if (current != NULL) { |
1517 AddToInactive(current); | 1529 AddToInactive(current); |
1518 } | 1530 } |
1519 } | 1531 } |
1520 } else { | 1532 } else { |
| 1533 ASSERT(mode_ == GENERAL_REGISTERS); |
1521 for (int i = 0; i < fixed_live_ranges_.length(); ++i) { | 1534 for (int i = 0; i < fixed_live_ranges_.length(); ++i) { |
1522 LiveRange* current = fixed_live_ranges_.at(i); | 1535 LiveRange* current = fixed_live_ranges_.at(i); |
1523 if (current != NULL) { | 1536 if (current != NULL) { |
1524 AddToInactive(current); | 1537 AddToInactive(current); |
1525 } | 1538 } |
1526 } | 1539 } |
1527 } | 1540 } |
1528 | 1541 |
1529 while (!unhandled_live_ranges_.is_empty()) { | 1542 while (!unhandled_live_ranges_.is_empty()) { |
1530 ASSERT(UnhandledIsSorted()); | 1543 ASSERT(UnhandledIsSorted()); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1805 RegisterName(register_index), | 1818 RegisterName(register_index), |
1806 free_until_pos[register_index].Value(), | 1819 free_until_pos[register_index].Value(), |
1807 current->id(), | 1820 current->id(), |
1808 current->End().Value()); | 1821 current->End().Value()); |
1809 | 1822 |
1810 // The desired register is free until the end of the current live range. | 1823 // The desired register is free until the end of the current live range. |
1811 if (free_until_pos[register_index].Value() >= current->End().Value()) { | 1824 if (free_until_pos[register_index].Value() >= current->End().Value()) { |
1812 TraceAlloc("Assigning preferred reg %s to live range %d\n", | 1825 TraceAlloc("Assigning preferred reg %s to live range %d\n", |
1813 RegisterName(register_index), | 1826 RegisterName(register_index), |
1814 current->id()); | 1827 current->id()); |
1815 SetLiveRangeAssignedRegister(current, register_index, mode_); | 1828 SetLiveRangeAssignedRegister(current, register_index); |
1816 return true; | 1829 return true; |
1817 } | 1830 } |
1818 } | 1831 } |
1819 | 1832 |
1820 // Find the register which stays free for the longest time. | 1833 // Find the register which stays free for the longest time. |
1821 int reg = 0; | 1834 int reg = 0; |
1822 for (int i = 1; i < RegisterCount(); ++i) { | 1835 for (int i = 1; i < RegisterCount(); ++i) { |
1823 if (free_until_pos[i].Value() > free_until_pos[reg].Value()) { | 1836 if (free_until_pos[i].Value() > free_until_pos[reg].Value()) { |
1824 reg = i; | 1837 reg = i; |
1825 } | 1838 } |
(...skipping 14 matching lines...) Expand all Loading... |
1840 AddToUnhandledSorted(tail); | 1853 AddToUnhandledSorted(tail); |
1841 } | 1854 } |
1842 | 1855 |
1843 | 1856 |
1844 // Register reg is available at the range start and is free until | 1857 // Register reg is available at the range start and is free until |
1845 // the range end. | 1858 // the range end. |
1846 ASSERT(pos.Value() >= current->End().Value()); | 1859 ASSERT(pos.Value() >= current->End().Value()); |
1847 TraceAlloc("Assigning free reg %s to live range %d\n", | 1860 TraceAlloc("Assigning free reg %s to live range %d\n", |
1848 RegisterName(reg), | 1861 RegisterName(reg), |
1849 current->id()); | 1862 current->id()); |
1850 SetLiveRangeAssignedRegister(current, reg, mode_); | 1863 SetLiveRangeAssignedRegister(current, reg); |
1851 | 1864 |
1852 return true; | 1865 return true; |
1853 } | 1866 } |
1854 | 1867 |
1855 | 1868 |
1856 void LAllocator::AllocateBlockedReg(LiveRange* current) { | 1869 void LAllocator::AllocateBlockedReg(LiveRange* current) { |
1857 UsePosition* register_use = current->NextRegisterPosition(current->Start()); | 1870 UsePosition* register_use = current->NextRegisterPosition(current->Start()); |
1858 if (register_use == NULL) { | 1871 if (register_use == NULL) { |
1859 // There is no use in the current live range that requires a register. | 1872 // There is no use in the current live range that requires a register. |
1860 // We can just spill it. | 1873 // We can just spill it. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1925 block_pos[reg].InstructionStart()); | 1938 block_pos[reg].InstructionStart()); |
1926 if (!AllocationOk()) return; | 1939 if (!AllocationOk()) return; |
1927 AddToUnhandledSorted(tail); | 1940 AddToUnhandledSorted(tail); |
1928 } | 1941 } |
1929 | 1942 |
1930 // Register reg is not blocked for the whole range. | 1943 // Register reg is not blocked for the whole range. |
1931 ASSERT(block_pos[reg].Value() >= current->End().Value()); | 1944 ASSERT(block_pos[reg].Value() >= current->End().Value()); |
1932 TraceAlloc("Assigning blocked reg %s to live range %d\n", | 1945 TraceAlloc("Assigning blocked reg %s to live range %d\n", |
1933 RegisterName(reg), | 1946 RegisterName(reg), |
1934 current->id()); | 1947 current->id()); |
1935 SetLiveRangeAssignedRegister(current, reg, mode_); | 1948 SetLiveRangeAssignedRegister(current, reg); |
1936 | 1949 |
1937 // This register was not free. Thus we need to find and spill | 1950 // This register was not free. Thus we need to find and spill |
1938 // parts of active and inactive live regions that use the same register | 1951 // parts of active and inactive live regions that use the same register |
1939 // at the same lifetime positions as current. | 1952 // at the same lifetime positions as current. |
1940 SplitAndSpillIntersecting(current); | 1953 SplitAndSpillIntersecting(current); |
1941 } | 1954 } |
1942 | 1955 |
1943 | 1956 |
1944 LifetimePosition LAllocator::FindOptimalSpillingPos(LiveRange* range, | 1957 LifetimePosition LAllocator::FindOptimalSpillingPos(LiveRange* range, |
1945 LifetimePosition pos) { | 1958 LifetimePosition pos) { |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2142 } | 2155 } |
2143 | 2156 |
2144 | 2157 |
2145 void LAllocator::Spill(LiveRange* range) { | 2158 void LAllocator::Spill(LiveRange* range) { |
2146 ASSERT(!range->IsSpilled()); | 2159 ASSERT(!range->IsSpilled()); |
2147 TraceAlloc("Spilling live range %d\n", range->id()); | 2160 TraceAlloc("Spilling live range %d\n", range->id()); |
2148 LiveRange* first = range->TopLevel(); | 2161 LiveRange* first = range->TopLevel(); |
2149 | 2162 |
2150 if (!first->HasAllocatedSpillOperand()) { | 2163 if (!first->HasAllocatedSpillOperand()) { |
2151 LOperand* op = TryReuseSpillSlot(range); | 2164 LOperand* op = TryReuseSpillSlot(range); |
2152 if (op == NULL) op = chunk_->GetNextSpillSlot(mode_ == DOUBLE_REGISTERS); | 2165 if (op == NULL) op = chunk_->GetNextSpillSlot(range->Kind()); |
2153 first->SetSpillOperand(op); | 2166 first->SetSpillOperand(op); |
2154 } | 2167 } |
2155 range->MakeSpilled(chunk()->zone()); | 2168 range->MakeSpilled(chunk()->zone()); |
2156 } | 2169 } |
2157 | 2170 |
2158 | 2171 |
2159 int LAllocator::RegisterCount() const { | 2172 int LAllocator::RegisterCount() const { |
2160 return num_registers_; | 2173 return num_registers_; |
2161 } | 2174 } |
2162 | 2175 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2197 isolate()->GetHTracer()->TraceLiveRanges(name(), allocator_); | 2210 isolate()->GetHTracer()->TraceLiveRanges(name(), allocator_); |
2198 } | 2211 } |
2199 | 2212 |
2200 #ifdef DEBUG | 2213 #ifdef DEBUG |
2201 if (allocator_ != NULL) allocator_->Verify(); | 2214 if (allocator_ != NULL) allocator_->Verify(); |
2202 #endif | 2215 #endif |
2203 } | 2216 } |
2204 | 2217 |
2205 | 2218 |
2206 } } // namespace v8::internal | 2219 } } // namespace v8::internal |
OLD | NEW |