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 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 break; | 1025 break; |
1026 } | 1026 } |
1027 } | 1027 } |
1028 | 1028 |
1029 void DeferReplacement(Node* node, Node* replacement) { | 1029 void DeferReplacement(Node* node, Node* replacement) { |
1030 if (FLAG_trace_representation) { | 1030 if (FLAG_trace_representation) { |
1031 TRACE(("defer replacement #%d:%s with #%d:%s\n", node->id(), | 1031 TRACE(("defer replacement #%d:%s with #%d:%s\n", node->id(), |
1032 node->op()->mnemonic(), replacement->id(), | 1032 node->op()->mnemonic(), replacement->id(), |
1033 replacement->op()->mnemonic())); | 1033 replacement->op()->mnemonic())); |
1034 } | 1034 } |
1035 if (replacement->id() < count_) { | 1035 if (replacement->id() < count_ && |
1036 // Replace with a previously existing node eagerly. | 1036 GetInfo(replacement)->output == GetInfo(node)->output) { |
| 1037 // Replace with a previously existing node eagerly only if the type is the |
| 1038 // same. |
1037 node->ReplaceUses(replacement); | 1039 node->ReplaceUses(replacement); |
1038 } else { | 1040 } else { |
1039 // Otherwise, we are replacing a node with a representation change. | 1041 // Otherwise, we are replacing a node with a representation change. |
1040 // Such a substitution must be done after all lowering is done, because | 1042 // Such a substitution must be done after all lowering is done, because |
1041 // new nodes do not have {NodeInfo} entries, and that would confuse | 1043 // changing the type could confuse the representation change |
1042 // the representation change insertion for uses of it. | 1044 // insertion for uses of the node. |
1043 replacements_.push_back(node); | 1045 replacements_.push_back(node); |
1044 replacements_.push_back(replacement); | 1046 replacements_.push_back(replacement); |
1045 } | 1047 } |
1046 // TODO(titzer) node->RemoveAllInputs(); // Node is now dead. | 1048 // TODO(titzer) node->RemoveAllInputs(); // Node is now dead. |
1047 } | 1049 } |
1048 | 1050 |
1049 void PrintUseInfo(Node* node) { | 1051 void PrintUseInfo(Node* node) { |
1050 TRACE(("#%d:%-20s ", node->id(), node->op()->mnemonic())); | 1052 TRACE(("#%d:%-20s ", node->id(), node->op()->mnemonic())); |
1051 PrintInfo(GetUseInfo(node)); | 1053 PrintInfo(GetUseInfo(node)); |
1052 TRACE(("\n")); | 1054 TRACE(("\n")); |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 | 1513 |
1512 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { | 1514 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
1513 node->set_op(machine()->IntLessThanOrEqual()); | 1515 node->set_op(machine()->IntLessThanOrEqual()); |
1514 node->ReplaceInput(0, StringComparison(node, true)); | 1516 node->ReplaceInput(0, StringComparison(node, true)); |
1515 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1517 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
1516 } | 1518 } |
1517 | 1519 |
1518 } // namespace compiler | 1520 } // namespace compiler |
1519 } // namespace internal | 1521 } // namespace internal |
1520 } // namespace v8 | 1522 } // namespace v8 |
OLD | NEW |