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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 new_value->InsertBefore(next); | 72 new_value->InsertBefore(next); |
73 use_value->SetOperandAt(use_index, new_value); | 73 use_value->SetOperandAt(use_index, new_value); |
74 } | 74 } |
75 | 75 |
76 | 76 |
77 void HRepresentationChangesPhase::InsertRepresentationChangesForValue( | 77 void HRepresentationChangesPhase::InsertRepresentationChangesForValue( |
78 HValue* value) { | 78 HValue* value) { |
79 Representation r = value->representation(); | 79 Representation r = value->representation(); |
80 if (r.IsNone()) return; | 80 if (r.IsNone()) return; |
81 if (value->HasNoUses()) return; | 81 if (value->HasNoUses()) { |
| 82 if (value->IsForceRepresentation()) value->DeleteAndReplaceWith(NULL); |
| 83 return; |
| 84 } |
82 | 85 |
83 for (HUseIterator it(value->uses()); !it.Done(); it.Advance()) { | 86 for (HUseIterator it(value->uses()); !it.Done(); it.Advance()) { |
84 HValue* use_value = it.value(); | 87 HValue* use_value = it.value(); |
85 int use_index = it.index(); | 88 int use_index = it.index(); |
86 Representation req = use_value->RequiredInputRepresentation(use_index); | 89 Representation req = use_value->RequiredInputRepresentation(use_index); |
87 if (req.IsNone() || req.Equals(r)) continue; | 90 if (req.IsNone() || req.Equals(r)) continue; |
88 InsertRepresentationChangeForUse(value, use_value, use_index, req); | 91 InsertRepresentationChangeForUse(value, use_value, use_index, req); |
89 } | 92 } |
90 if (value->HasNoUses()) { | 93 if (value->HasNoUses()) { |
91 ASSERT(value->IsConstant()); | 94 ASSERT(value->IsConstant()); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 // Process normal instructions. | 192 // Process normal instructions. |
190 for (HInstruction* current = block->first(); current != NULL; ) { | 193 for (HInstruction* current = block->first(); current != NULL; ) { |
191 HInstruction* next = current->next(); | 194 HInstruction* next = current->next(); |
192 InsertRepresentationChangesForValue(current); | 195 InsertRepresentationChangesForValue(current); |
193 current = next; | 196 current = next; |
194 } | 197 } |
195 } | 198 } |
196 } | 199 } |
197 | 200 |
198 } } // namespace v8::internal | 201 } } // namespace v8::internal |
OLD | NEW |