| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/flow_graph_allocator.h" | 9 #include "vm/flow_graph_allocator.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 for (intptr_t i = 0; i < var_count; i++) { | 860 for (intptr_t i = 0; i < var_count; i++) { |
| 861 phis_->Add(NULL); | 861 phis_->Add(NULL); |
| 862 } | 862 } |
| 863 } | 863 } |
| 864 ASSERT((*phis_)[var_index] == NULL); | 864 ASSERT((*phis_)[var_index] == NULL); |
| 865 (*phis_)[var_index] = new PhiInstr(this, PredecessorCount()); | 865 (*phis_)[var_index] = new PhiInstr(this, PredecessorCount()); |
| 866 phi_count_++; | 866 phi_count_++; |
| 867 } | 867 } |
| 868 | 868 |
| 869 | 869 |
| 870 void JoinEntryInstr::InsertPhi(PhiInstr* phi) { |
| 871 // Lazily initialize the array of phis. |
| 872 if (phis_ == NULL) { |
| 873 phis_ = new ZoneGrowableArray<PhiInstr*>(1); |
| 874 } |
| 875 phis_->Add(phi); |
| 876 phi_count_++; |
| 877 } |
| 878 |
| 879 |
| 870 void JoinEntryInstr::RemoveDeadPhis() { | 880 void JoinEntryInstr::RemoveDeadPhis() { |
| 871 if (phis_ == NULL) return; | 881 if (phis_ == NULL) return; |
| 872 | 882 |
| 873 for (intptr_t i = 0; i < phis_->length(); i++) { | 883 for (intptr_t i = 0; i < phis_->length(); i++) { |
| 874 PhiInstr* phi = (*phis_)[i]; | 884 PhiInstr* phi = (*phis_)[i]; |
| 875 if ((phi != NULL) && !phi->is_alive()) { | 885 if ((phi != NULL) && !phi->is_alive()) { |
| 876 (*phis_)[i] = NULL; | 886 (*phis_)[i] = NULL; |
| 877 phi_count_--; | 887 phi_count_--; |
| 878 } | 888 } |
| 879 } | 889 } |
| (...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2753 default: | 2763 default: |
| 2754 UNREACHABLE(); | 2764 UNREACHABLE(); |
| 2755 return -1; | 2765 return -1; |
| 2756 } | 2766 } |
| 2757 } | 2767 } |
| 2758 | 2768 |
| 2759 | 2769 |
| 2760 #undef __ | 2770 #undef __ |
| 2761 | 2771 |
| 2762 } // namespace dart | 2772 } // namespace dart |
| OLD | NEW |