OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/compiler/simplified-lowering.h" | 5 #include "src/compiler/simplified-lowering.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 VisitNode(node, GetUseInfo(node), lowering); | 117 VisitNode(node, GetUseInfo(node), lowering); |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 // Perform the final replacements. | 121 // Perform the final replacements. |
122 for (NodeVector::iterator i = replacements_.begin(); | 122 for (NodeVector::iterator i = replacements_.begin(); |
123 i != replacements_.end(); ++i) { | 123 i != replacements_.end(); ++i) { |
124 Node* node = *i; | 124 Node* node = *i; |
125 Node* replacement = *(++i); | 125 Node* replacement = *(++i); |
126 node->ReplaceUses(replacement); | 126 node->ReplaceUses(replacement); |
| 127 // We also need to replace the node in the rest of the vector. |
| 128 for (NodeVector::iterator j = i + 1; j != replacements_.end(); ++j) { |
| 129 ++j; |
| 130 if (*j == node) *j = replacement; |
| 131 } |
127 } | 132 } |
128 } | 133 } |
129 | 134 |
130 // Enqueue {node} if the {use} contains new information for that node. | 135 // Enqueue {node} if the {use} contains new information for that node. |
131 // Add {node} to {nodes_} if this is the first time it's been visited. | 136 // Add {node} to {nodes_} if this is the first time it's been visited. |
132 void Enqueue(Node* node, MachineTypeUnion use = 0) { | 137 void Enqueue(Node* node, MachineTypeUnion use = 0) { |
133 if (phase_ != PROPAGATE) return; | 138 if (phase_ != PROPAGATE) return; |
134 NodeInfo* info = GetInfo(node); | 139 NodeInfo* info = GetInfo(node); |
135 if (!info->visited) { | 140 if (!info->visited) { |
136 // First visit of this node. | 141 // First visit of this node. |
(...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1573 | 1578 |
1574 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { | 1579 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
1575 node->set_op(machine()->IntLessThanOrEqual()); | 1580 node->set_op(machine()->IntLessThanOrEqual()); |
1576 node->ReplaceInput(0, StringComparison(node, true)); | 1581 node->ReplaceInput(0, StringComparison(node, true)); |
1577 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1582 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
1578 } | 1583 } |
1579 | 1584 |
1580 } // namespace compiler | 1585 } // namespace compiler |
1581 } // namespace internal | 1586 } // namespace internal |
1582 } // namespace v8 | 1587 } // namespace v8 |
OLD | NEW |