OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 // Set truncation flags for groups of connected phis. This is a conservative | 76 // Set truncation flags for groups of connected phis. This is a conservative |
77 // approximation; the flag will be properly re-computed after representations | 77 // approximation; the flag will be properly re-computed after representations |
78 // have been determined. | 78 // have been determined. |
79 if (phi_count > 0) { | 79 if (phi_count > 0) { |
80 BitVector done(phi_count, zone()); | 80 BitVector done(phi_count, zone()); |
81 for (int i = 0; i < phi_count; ++i) { | 81 for (int i = 0; i < phi_count; ++i) { |
82 if (done.Contains(i)) continue; | 82 if (done.Contains(i)) continue; |
83 | 83 |
84 // Check if all uses of all connected phis in this group are truncating. | 84 // Check if all uses of all connected phis in this group are truncating. |
85 bool all_uses_everywhere_truncating = true; | 85 bool all_uses_everywhere_truncating_int32 = true; |
| 86 bool all_uses_everywhere_truncating_smi = true; |
86 for (BitVector::Iterator it(connected_phis[i]); | 87 for (BitVector::Iterator it(connected_phis[i]); |
87 !it.Done(); | 88 !it.Done(); |
88 it.Advance()) { | 89 it.Advance()) { |
89 int index = it.Current(); | 90 int index = it.Current(); |
90 all_uses_everywhere_truncating &= | 91 all_uses_everywhere_truncating_int32 &= |
91 phi_list->at(index)->CheckFlag(HInstruction::kTruncatingToInt32); | 92 phi_list->at(index)->CheckFlag(HInstruction::kTruncatingToInt32); |
| 93 all_uses_everywhere_truncating_smi &= |
| 94 phi_list->at(index)->CheckFlag(HInstruction::kTruncatingToSmi); |
92 done.Add(index); | 95 done.Add(index); |
93 } | 96 } |
94 if (all_uses_everywhere_truncating) { | 97 |
95 continue; // Great, nothing to do. | 98 if (!all_uses_everywhere_truncating_int32) { |
| 99 // Clear truncation flag of this group of connected phis. |
| 100 for (BitVector::Iterator it(connected_phis[i]); |
| 101 !it.Done(); |
| 102 it.Advance()) { |
| 103 int index = it.Current(); |
| 104 phi_list->at(index)->ClearFlag(HInstruction::kTruncatingToInt32); |
| 105 } |
96 } | 106 } |
97 // Clear truncation flag of this group of connected phis. | 107 if (!all_uses_everywhere_truncating_smi) { |
98 for (BitVector::Iterator it(connected_phis[i]); | 108 // Clear truncation flag of this group of connected phis. |
99 !it.Done(); | 109 for (BitVector::Iterator it(connected_phis[i]); |
100 it.Advance()) { | 110 !it.Done(); |
101 int index = it.Current(); | 111 it.Advance()) { |
102 phi_list->at(index)->ClearFlag(HInstruction::kTruncatingToInt32); | 112 int index = it.Current(); |
| 113 phi_list->at(index)->ClearFlag(HInstruction::kTruncatingToSmi); |
| 114 } |
103 } | 115 } |
104 } | 116 } |
105 } | 117 } |
106 | 118 |
107 // Simplify constant phi inputs where possible. | 119 // Simplify constant phi inputs where possible. |
108 // This step uses kTruncatingToInt32 flags of phis. | 120 // This step uses kTruncatingToInt32 flags of phis. |
109 for (int i = 0; i < phi_count; ++i) { | 121 for (int i = 0; i < phi_count; ++i) { |
110 phi_list->at(i)->SimplifyConstantInputs(); | 122 phi_list->at(i)->SimplifyConstantInputs(); |
111 } | 123 } |
112 | 124 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 current->ChangeRepresentation(Representation::Double()); | 175 current->ChangeRepresentation(Representation::Double()); |
164 } else { | 176 } else { |
165 current->ChangeRepresentation(Representation::Tagged()); | 177 current->ChangeRepresentation(Representation::Tagged()); |
166 } | 178 } |
167 } | 179 } |
168 } | 180 } |
169 } | 181 } |
170 } | 182 } |
171 | 183 |
172 } } // namespace v8::internal | 184 } } // namespace v8::internal |
OLD | NEW |