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 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1781 | 1781 |
1782 // TryAllocateFreeReg and AllocateBlockedReg assume this | 1782 // TryAllocateFreeReg and AllocateBlockedReg assume this |
1783 // when allocating local arrays. | 1783 // when allocating local arrays. |
1784 STATIC_ASSERT(DoubleRegister::kMaxNumAllocatableRegisters >= | 1784 STATIC_ASSERT(DoubleRegister::kMaxNumAllocatableRegisters >= |
1785 Register::kMaxNumAllocatableRegisters); | 1785 Register::kMaxNumAllocatableRegisters); |
1786 | 1786 |
1787 | 1787 |
1788 bool LAllocator::TryAllocateFreeReg(LiveRange* current) { | 1788 bool LAllocator::TryAllocateFreeReg(LiveRange* current) { |
1789 LifetimePosition free_until_pos[DoubleRegister::kMaxNumAllocatableRegisters]; | 1789 LifetimePosition free_until_pos[DoubleRegister::kMaxNumAllocatableRegisters]; |
1790 | 1790 |
1791 for (int i = 0; i < DoubleRegister::kMaxNumAllocatableRegisters; i++) { | 1791 for (int i = 0; i < num_registers_; i++) { |
1792 free_until_pos[i] = LifetimePosition::MaxPosition(); | 1792 free_until_pos[i] = LifetimePosition::MaxPosition(); |
1793 } | 1793 } |
1794 | 1794 |
1795 for (int i = 0; i < active_live_ranges_.length(); ++i) { | 1795 for (int i = 0; i < active_live_ranges_.length(); ++i) { |
1796 LiveRange* cur_active = active_live_ranges_.at(i); | 1796 LiveRange* cur_active = active_live_ranges_.at(i); |
1797 free_until_pos[cur_active->assigned_register()] = | 1797 free_until_pos[cur_active->assigned_register()] = |
1798 LifetimePosition::FromInstructionIndex(0); | 1798 LifetimePosition::FromInstructionIndex(0); |
1799 } | 1799 } |
1800 | 1800 |
1801 for (int i = 0; i < inactive_live_ranges_.length(); ++i) { | 1801 for (int i = 0; i < inactive_live_ranges_.length(); ++i) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1873 // There is no use in the current live range that requires a register. | 1873 // There is no use in the current live range that requires a register. |
1874 // We can just spill it. | 1874 // We can just spill it. |
1875 Spill(current); | 1875 Spill(current); |
1876 return; | 1876 return; |
1877 } | 1877 } |
1878 | 1878 |
1879 | 1879 |
1880 LifetimePosition use_pos[DoubleRegister::kMaxNumAllocatableRegisters]; | 1880 LifetimePosition use_pos[DoubleRegister::kMaxNumAllocatableRegisters]; |
1881 LifetimePosition block_pos[DoubleRegister::kMaxNumAllocatableRegisters]; | 1881 LifetimePosition block_pos[DoubleRegister::kMaxNumAllocatableRegisters]; |
1882 | 1882 |
1883 for (int i = 0; i < DoubleRegister::NumAllocatableRegisters(); i++) { | 1883 for (int i = 0; i < num_registers_; i++) { |
1884 use_pos[i] = block_pos[i] = LifetimePosition::MaxPosition(); | 1884 use_pos[i] = block_pos[i] = LifetimePosition::MaxPosition(); |
1885 } | 1885 } |
1886 | 1886 |
1887 for (int i = 0; i < active_live_ranges_.length(); ++i) { | 1887 for (int i = 0; i < active_live_ranges_.length(); ++i) { |
1888 LiveRange* range = active_live_ranges_[i]; | 1888 LiveRange* range = active_live_ranges_[i]; |
1889 int cur_reg = range->assigned_register(); | 1889 int cur_reg = range->assigned_register(); |
1890 if (range->IsFixed() || !range->CanBeSpilled(current->Start())) { | 1890 if (range->IsFixed() || !range->CanBeSpilled(current->Start())) { |
1891 block_pos[cur_reg] = use_pos[cur_reg] = | 1891 block_pos[cur_reg] = use_pos[cur_reg] = |
1892 LifetimePosition::FromInstructionIndex(0); | 1892 LifetimePosition::FromInstructionIndex(0); |
1893 } else { | 1893 } else { |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2167 LiveRange* current = live_ranges()->at(i); | 2167 LiveRange* current = live_ranges()->at(i); |
2168 if (current != NULL) current->Verify(); | 2168 if (current != NULL) current->Verify(); |
2169 } | 2169 } |
2170 } | 2170 } |
2171 | 2171 |
2172 | 2172 |
2173 #endif | 2173 #endif |
2174 | 2174 |
2175 | 2175 |
2176 } } // namespace v8::internal | 2176 } } // namespace v8::internal |
OLD | NEW |