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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 // conversion. | 105 // conversion. |
106 ZoneList<HPhi*> worklist(8, zone()); | 106 ZoneList<HPhi*> worklist(8, zone()); |
107 | 107 |
108 const ZoneList<HPhi*>* phi_list(graph()->phi_list()); | 108 const ZoneList<HPhi*>* phi_list(graph()->phi_list()); |
109 for (int i = 0; i < phi_list->length(); i++) { | 109 for (int i = 0; i < phi_list->length(); i++) { |
110 HPhi* phi = phi_list->at(i); | 110 HPhi* phi = phi_list->at(i); |
111 if (phi->representation().IsInteger32()) { | 111 if (phi->representation().IsInteger32()) { |
112 phi->SetFlag(HValue::kTruncatingToInt32); | 112 phi->SetFlag(HValue::kTruncatingToInt32); |
113 } else if (phi->representation().IsSmi()) { | 113 } else if (phi->representation().IsSmi()) { |
114 phi->SetFlag(HValue::kTruncatingToSmi); | 114 phi->SetFlag(HValue::kTruncatingToSmi); |
115 phi->SetFlag(HValue::kTruncatingToInt32); | |
115 } | 116 } |
116 } | 117 } |
117 | 118 |
118 for (int i = 0; i < phi_list->length(); i++) { | 119 for (int i = 0; i < phi_list->length(); i++) { |
119 HPhi* phi = phi_list->at(i); | 120 HPhi* phi = phi_list->at(i); |
120 for (HUseIterator it(phi->uses()); !it.Done(); it.Advance()) { | 121 for (HUseIterator it(phi->uses()); !it.Done(); it.Advance()) { |
121 // If a Phi is used as a non-truncating int32 or as a double, | 122 // If a Phi is used as a non-truncating int32 or as a double, |
122 // clear its "truncating" flag. | 123 // clear its "truncating" flag. |
123 HValue* use = it.value(); | 124 HValue* use = it.value(); |
124 Representation input_representation = | 125 Representation input_representation = |
125 use->RequiredInputRepresentation(it.index()); | 126 use->RequiredInputRepresentation(it.index()); |
126 if ((phi->representation().IsInteger32() && | 127 if ((phi->representation().IsInteger32() && |
127 !(input_representation.IsInteger32() && | 128 !(input_representation.IsInteger32() && |
128 use->CheckFlag(HValue::kTruncatingToInt32))) || | 129 use->CheckFlag(HValue::kTruncatingToInt32))) || |
129 (phi->representation().IsSmi() && | 130 (phi->representation().IsSmi() && |
130 !(input_representation.IsSmi() || | 131 !(input_representation.IsSmi() || |
Toon Verwaest
2013/08/10 14:13:19
What about just cleaning up the code (and making t
weiliang.lin2
2013/08/10 16:43:26
Done. And to keep trace_representation, add anothe
| |
131 use->CheckFlag(HValue::kTruncatingToSmi)))) { | 132 use->CheckFlag(HValue::kTruncatingToSmi)))) { |
132 if (FLAG_trace_representation) { | 133 if (FLAG_trace_representation) { |
133 PrintF("#%d Phi is not truncating because of #%d %s\n", | 134 PrintF("#%d Phi is not truncating because of #%d %s\n", |
134 phi->id(), it.value()->id(), it.value()->Mnemonic()); | 135 phi->id(), it.value()->id(), it.value()->Mnemonic()); |
135 } | 136 } |
136 phi->ClearFlag(HValue::kTruncatingToInt32); | 137 phi->ClearFlag(HValue::kTruncatingToInt32); |
137 phi->ClearFlag(HValue::kTruncatingToSmi); | 138 phi->ClearFlag(HValue::kTruncatingToSmi); |
138 worklist.Add(phi, zone()); | 139 worklist.Add(phi, zone()); |
139 break; | 140 break; |
140 } | 141 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 // Process normal instructions. | 174 // Process normal instructions. |
174 for (HInstruction* current = block->first(); current != NULL; ) { | 175 for (HInstruction* current = block->first(); current != NULL; ) { |
175 HInstruction* next = current->next(); | 176 HInstruction* next = current->next(); |
176 InsertRepresentationChangesForValue(current); | 177 InsertRepresentationChangesForValue(current); |
177 current = next; | 178 current = next; |
178 } | 179 } |
179 } | 180 } |
180 } | 181 } |
181 | 182 |
182 } } // namespace v8::internal | 183 } } // namespace v8::internal |
OLD | NEW |