OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/hydrogen-representation-changes.h" | 5 #include "src/hydrogen-representation-changes.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 | 9 |
10 void HRepresentationChangesPhase::InsertRepresentationChangeForUse( | 10 void HRepresentationChangesPhase::InsertRepresentationChangeForUse( |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 Representation to_rep = change->to(); | 56 Representation to_rep = change->to(); |
57 // Flags indicating Uint32 operations are set in a later Hydrogen phase. | 57 // Flags indicating Uint32 operations are set in a later Hydrogen phase. |
58 DCHECK(!change->CheckFlag(HValue::kUint32)); | 58 DCHECK(!change->CheckFlag(HValue::kUint32)); |
59 return from_rep.IsInteger32() && to_rep.IsSmi() && SmiValuesAre32Bits(); | 59 return from_rep.IsInteger32() && to_rep.IsSmi() && SmiValuesAre32Bits(); |
60 } | 60 } |
61 | 61 |
62 | 62 |
63 void HRepresentationChangesPhase::InsertRepresentationChangesForValue( | 63 void HRepresentationChangesPhase::InsertRepresentationChangesForValue( |
64 HValue* value) { | 64 HValue* value) { |
65 Representation r = value->representation(); | 65 Representation r = value->representation(); |
66 if (r.IsNone()) return; | 66 if (r.IsNone()) { |
| 67 #ifdef DEBUG |
| 68 for (HUseIterator it(value->uses()); !it.Done(); it.Advance()) { |
| 69 HValue* use_value = it.value(); |
| 70 int use_index = it.index(); |
| 71 Representation req = use_value->RequiredInputRepresentation(use_index); |
| 72 DCHECK(req.IsNone()); |
| 73 } |
| 74 #endif |
| 75 return; |
| 76 } |
67 if (value->HasNoUses()) { | 77 if (value->HasNoUses()) { |
68 if (value->IsForceRepresentation()) value->DeleteAndReplaceWith(NULL); | 78 if (value->IsForceRepresentation()) value->DeleteAndReplaceWith(NULL); |
69 return; | 79 return; |
70 } | 80 } |
71 | 81 |
72 for (HUseIterator it(value->uses()); !it.Done(); it.Advance()) { | 82 for (HUseIterator it(value->uses()); !it.Done(); it.Advance()) { |
73 HValue* use_value = it.value(); | 83 HValue* use_value = it.value(); |
74 int use_index = it.index(); | 84 int use_index = it.index(); |
75 Representation req = use_value->RequiredInputRepresentation(use_index); | 85 Representation req = use_value->RequiredInputRepresentation(use_index); |
76 if (req.IsNone() || req.Equals(r)) continue; | 86 if (req.IsNone() || req.Equals(r)) continue; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 // Process normal instructions. | 204 // Process normal instructions. |
195 for (HInstruction* current = block->first(); current != NULL; ) { | 205 for (HInstruction* current = block->first(); current != NULL; ) { |
196 HInstruction* next = current->next(); | 206 HInstruction* next = current->next(); |
197 InsertRepresentationChangesForValue(current); | 207 InsertRepresentationChangesForValue(current); |
198 current = next; | 208 current = next; |
199 } | 209 } |
200 } | 210 } |
201 } | 211 } |
202 | 212 |
203 } } // namespace v8::internal | 213 } } // namespace v8::internal |
OLD | NEW |