| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 void LAllocator::AllocateDoubleRegisters() { | 1435 void LAllocator::AllocateDoubleRegisters() { |
| 1436 HPhase phase("Allocate double registers", this); | 1436 HPhase phase("Allocate double registers", this); |
| 1437 num_registers_ = DoubleRegister::kNumAllocatableRegisters; | 1437 num_registers_ = DoubleRegister::kNumAllocatableRegisters; |
| 1438 mode_ = DOUBLE_REGISTERS; | 1438 mode_ = DOUBLE_REGISTERS; |
| 1439 AllocateRegisters(); | 1439 AllocateRegisters(); |
| 1440 } | 1440 } |
| 1441 | 1441 |
| 1442 | 1442 |
| 1443 void LAllocator::AllocateRegisters() { | 1443 void LAllocator::AllocateRegisters() { |
| 1444 ASSERT(mode_ != NONE); | 1444 ASSERT(mode_ != NONE); |
| 1445 reusable_slots_.Clear(); | 1445 ASSERT(unhandled_live_ranges_.is_empty()); |
| 1446 | 1446 |
| 1447 for (int i = 0; i < live_ranges_.length(); ++i) { | 1447 for (int i = 0; i < live_ranges_.length(); ++i) { |
| 1448 if (live_ranges_[i] != NULL) { | 1448 if (live_ranges_[i] != NULL) { |
| 1449 if (RequiredRegisterKind(live_ranges_[i]->id()) == mode_) { | 1449 if (RequiredRegisterKind(live_ranges_[i]->id()) == mode_) { |
| 1450 AddToUnhandledUnsorted(live_ranges_[i]); | 1450 AddToUnhandledUnsorted(live_ranges_[i]); |
| 1451 } | 1451 } |
| 1452 } | 1452 } |
| 1453 } | 1453 } |
| 1454 SortUnhandled(); | 1454 SortUnhandled(); |
| 1455 ASSERT(UnhandledIsSorted()); | 1455 ASSERT(UnhandledIsSorted()); |
| 1456 | 1456 |
| 1457 ASSERT(reusable_slots_.is_empty()); |
| 1457 ASSERT(active_live_ranges_.is_empty()); | 1458 ASSERT(active_live_ranges_.is_empty()); |
| 1458 ASSERT(inactive_live_ranges_.is_empty()); | 1459 ASSERT(inactive_live_ranges_.is_empty()); |
| 1459 | 1460 |
| 1460 if (mode_ == DOUBLE_REGISTERS) { | 1461 if (mode_ == DOUBLE_REGISTERS) { |
| 1461 for (int i = 0; i < fixed_double_live_ranges_.length(); ++i) { | 1462 for (int i = 0; i < fixed_double_live_ranges_.length(); ++i) { |
| 1462 LiveRange* current = fixed_double_live_ranges_.at(i); | 1463 LiveRange* current = fixed_double_live_ranges_.at(i); |
| 1463 if (current != NULL) { | 1464 if (current != NULL) { |
| 1464 AddToInactive(current); | 1465 AddToInactive(current); |
| 1465 } | 1466 } |
| 1466 } | 1467 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1531 bool result = TryAllocateFreeReg(current); | 1532 bool result = TryAllocateFreeReg(current); |
| 1532 if (!result) { | 1533 if (!result) { |
| 1533 AllocateBlockedReg(current); | 1534 AllocateBlockedReg(current); |
| 1534 } | 1535 } |
| 1535 | 1536 |
| 1536 if (current->HasRegisterAssigned()) { | 1537 if (current->HasRegisterAssigned()) { |
| 1537 AddToActive(current); | 1538 AddToActive(current); |
| 1538 } | 1539 } |
| 1539 } | 1540 } |
| 1540 | 1541 |
| 1541 active_live_ranges_.Clear(); | 1542 reusable_slots_.Rewind(0); |
| 1542 inactive_live_ranges_.Clear(); | 1543 active_live_ranges_.Rewind(0); |
| 1544 inactive_live_ranges_.Rewind(0); |
| 1543 } | 1545 } |
| 1544 | 1546 |
| 1545 | 1547 |
| 1546 const char* LAllocator::RegisterName(int allocation_index) { | 1548 const char* LAllocator::RegisterName(int allocation_index) { |
| 1547 ASSERT(mode_ != NONE); | 1549 ASSERT(mode_ != NONE); |
| 1548 if (mode_ == GENERAL_REGISTERS) { | 1550 if (mode_ == GENERAL_REGISTERS) { |
| 1549 return Register::AllocationIndexToString(allocation_index); | 1551 return Register::AllocationIndexToString(allocation_index); |
| 1550 } else { | 1552 } else { |
| 1551 return DoubleRegister::AllocationIndexToString(allocation_index); | 1553 return DoubleRegister::AllocationIndexToString(allocation_index); |
| 1552 } | 1554 } |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2081 LiveRange* current = live_ranges()->at(i); | 2083 LiveRange* current = live_ranges()->at(i); |
| 2082 if (current != NULL) current->Verify(); | 2084 if (current != NULL) current->Verify(); |
| 2083 } | 2085 } |
| 2084 } | 2086 } |
| 2085 | 2087 |
| 2086 | 2088 |
| 2087 #endif | 2089 #endif |
| 2088 | 2090 |
| 2089 | 2091 |
| 2090 } } // namespace v8::internal | 2092 } } // namespace v8::internal |
| OLD | NEW |