| 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 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1668 connected_set->Add(i); | 1668 connected_set->Add(i); |
| 1669 connected_phis.Add(connected_set); | 1669 connected_phis.Add(connected_set); |
| 1670 } | 1670 } |
| 1671 | 1671 |
| 1672 // (2) Do a fixed point iteration to find the set of connected phis. A | 1672 // (2) Do a fixed point iteration to find the set of connected phis. A |
| 1673 // phi is connected to another phi if its value is used either directly or | 1673 // phi is connected to another phi if its value is used either directly or |
| 1674 // indirectly through a transitive closure of the def-use relation. | 1674 // indirectly through a transitive closure of the def-use relation. |
| 1675 bool change = true; | 1675 bool change = true; |
| 1676 while (change) { | 1676 while (change) { |
| 1677 change = false; | 1677 change = false; |
| 1678 for (int i = 0; i < phi_count; ++i) { | 1678 // We normally have far more "forward edges" than "backward edges", |
| 1679 // so we terminate faster when we walk backwards. |
| 1680 for (int i = phi_count - 1; i >= 0; --i) { |
| 1679 HPhi* phi = phi_list->at(i); | 1681 HPhi* phi = phi_list->at(i); |
| 1680 for (HUseIterator it(phi->uses()); !it.Done(); it.Advance()) { | 1682 for (HUseIterator it(phi->uses()); !it.Done(); it.Advance()) { |
| 1681 HValue* use = it.value(); | 1683 HValue* use = it.value(); |
| 1682 if (use->IsPhi()) { | 1684 if (use->IsPhi()) { |
| 1683 int id = HPhi::cast(use)->phi_id(); | 1685 int id = HPhi::cast(use)->phi_id(); |
| 1684 if (connected_phis[i]->UnionIsChanged(*connected_phis[id])) | 1686 if (connected_phis[i]->UnionIsChanged(*connected_phis[id])) |
| 1685 change = true; | 1687 change = true; |
| 1686 } | 1688 } |
| 1687 } | 1689 } |
| 1688 } | 1690 } |
| (...skipping 5127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6816 } | 6818 } |
| 6817 } | 6819 } |
| 6818 | 6820 |
| 6819 #ifdef DEBUG | 6821 #ifdef DEBUG |
| 6820 if (graph_ != NULL) graph_->Verify(); | 6822 if (graph_ != NULL) graph_->Verify(); |
| 6821 if (allocator_ != NULL) allocator_->Verify(); | 6823 if (allocator_ != NULL) allocator_->Verify(); |
| 6822 #endif | 6824 #endif |
| 6823 } | 6825 } |
| 6824 | 6826 |
| 6825 } } // namespace v8::internal | 6827 } } // namespace v8::internal |
| OLD | NEW |