| 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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 live_in_sets_.AddBlock(NULL, block_count); | 568 live_in_sets_.AddBlock(NULL, block_count); |
| 569 } | 569 } |
| 570 | 570 |
| 571 | 571 |
| 572 BitVector* LAllocator::ComputeLiveOut(HBasicBlock* block) { | 572 BitVector* LAllocator::ComputeLiveOut(HBasicBlock* block) { |
| 573 // Compute live out for the given block, except not including backward | 573 // Compute live out for the given block, except not including backward |
| 574 // successor edges. | 574 // successor edges. |
| 575 BitVector* live_out = new BitVector(next_virtual_register_); | 575 BitVector* live_out = new BitVector(next_virtual_register_); |
| 576 | 576 |
| 577 // Process all successor blocks. | 577 // Process all successor blocks. |
| 578 HBasicBlock* successor = block->end()->FirstSuccessor(); | 578 for (HSuccessorIterator it(block->end()); !it.Done(); it.Advance()) { |
| 579 while (successor != NULL) { | |
| 580 // Add values live on entry to the successor. Note the successor's | 579 // Add values live on entry to the successor. Note the successor's |
| 581 // live_in will not be computed yet for backwards edges. | 580 // live_in will not be computed yet for backwards edges. |
| 581 HBasicBlock* successor = it.Current(); |
| 582 BitVector* live_in = live_in_sets_[successor->block_id()]; | 582 BitVector* live_in = live_in_sets_[successor->block_id()]; |
| 583 if (live_in != NULL) live_out->Union(*live_in); | 583 if (live_in != NULL) live_out->Union(*live_in); |
| 584 | 584 |
| 585 // All phi input operands corresponding to this successor edge are live | 585 // All phi input operands corresponding to this successor edge are live |
| 586 // out from this block. | 586 // out from this block. |
| 587 int index = successor->PredecessorIndexOf(block); | 587 int index = successor->PredecessorIndexOf(block); |
| 588 const ZoneList<HPhi*>* phis = successor->phis(); | 588 const ZoneList<HPhi*>* phis = successor->phis(); |
| 589 for (int i = 0; i < phis->length(); ++i) { | 589 for (int i = 0; i < phis->length(); ++i) { |
| 590 HPhi* phi = phis->at(i); | 590 HPhi* phi = phis->at(i); |
| 591 if (!phi->OperandAt(index)->IsConstant()) { | 591 if (!phi->OperandAt(index)->IsConstant()) { |
| 592 live_out->Add(phi->OperandAt(index)->id()); | 592 live_out->Add(phi->OperandAt(index)->id()); |
| 593 } | 593 } |
| 594 } | 594 } |
| 595 | |
| 596 // Check if we are done with second successor. | |
| 597 if (successor == block->end()->SecondSuccessor()) break; | |
| 598 | |
| 599 successor = block->end()->SecondSuccessor(); | |
| 600 } | 595 } |
| 601 | 596 |
| 602 return live_out; | 597 return live_out; |
| 603 } | 598 } |
| 604 | 599 |
| 605 | 600 |
| 606 void LAllocator::AddInitialIntervals(HBasicBlock* block, | 601 void LAllocator::AddInitialIntervals(HBasicBlock* block, |
| 607 BitVector* live_out) { | 602 BitVector* live_out) { |
| 608 // Add an interval that includes the entire block to the live range for | 603 // Add an interval that includes the entire block to the live range for |
| 609 // each live_out value. | 604 // each live_out value. |
| (...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2124 LiveRange* current = live_ranges()->at(i); | 2119 LiveRange* current = live_ranges()->at(i); |
| 2125 if (current != NULL) current->Verify(); | 2120 if (current != NULL) current->Verify(); |
| 2126 } | 2121 } |
| 2127 } | 2122 } |
| 2128 | 2123 |
| 2129 | 2124 |
| 2130 #endif | 2125 #endif |
| 2131 | 2126 |
| 2132 | 2127 |
| 2133 } } // namespace v8::internal | 2128 } } // namespace v8::internal |
| OLD | NEW |