Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/flow_graph_allocator.h" | 9 #include "vm/flow_graph_allocator.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1133 | 1133 |
| 1134 Definition* StrictCompareInstr::Canonicalize() { | 1134 Definition* StrictCompareInstr::Canonicalize() { |
| 1135 if (!right()->BindsToConstant()) return this; | 1135 if (!right()->BindsToConstant()) return this; |
| 1136 const Object& right_constant = right()->BoundConstant(); | 1136 const Object& right_constant = right()->BoundConstant(); |
| 1137 Definition* left_defn = left()->definition(); | 1137 Definition* left_defn = left()->definition(); |
| 1138 // TODO(fschneider): Handle other cases: e === false and e !== true/false. | 1138 // TODO(fschneider): Handle other cases: e === false and e !== true/false. |
| 1139 // Handles e === true. | 1139 // Handles e === true. |
| 1140 if ((kind() == Token::kEQ_STRICT) && | 1140 if ((kind() == Token::kEQ_STRICT) && |
| 1141 (right_constant.raw() == Bool::True()) && | 1141 (right_constant.raw() == Bool::True()) && |
| 1142 (left()->ResultCid() == kBoolCid)) { | 1142 (left()->ResultCid() == kBoolCid)) { |
| 1143 // Remove the constant from the graph. | |
| 1144 Definition* right_defn = right()->definition(); | |
| 1145 right_defn->RemoveFromGraph(); | |
|
srdjan
2012/09/13 12:51:09
Why don't you remove the right hand side?
Vyacheslav Egorov (Google)
2012/09/13 13:15:57
It can still have uses. It's not for canonicalizat
| |
| 1146 // Return left subexpression as the replacement for this instruction. | 1143 // Return left subexpression as the replacement for this instruction. |
| 1147 return left_defn; | 1144 return left_defn; |
| 1148 } | 1145 } |
| 1149 return this; | 1146 return this; |
| 1150 } | 1147 } |
| 1151 | 1148 |
| 1152 | 1149 |
| 1153 Definition* CheckClassInstr::Canonicalize() { | 1150 Definition* CheckClassInstr::Canonicalize() { |
| 1154 const intptr_t v_cid = value()->ResultCid(); | 1151 const intptr_t v_cid = value()->ResultCid(); |
| 1155 const intptr_t num_checks = unary_checks().NumberOfChecks(); | 1152 const intptr_t num_checks = unary_checks().NumberOfChecks(); |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1658 value->set_use_index(use_index++); | 1655 value->set_use_index(use_index++); |
| 1659 value->AddToEnvUseList(); | 1656 value->AddToEnvUseList(); |
| 1660 } | 1657 } |
| 1661 instr->set_env(copy); | 1658 instr->set_env(copy); |
| 1662 } | 1659 } |
| 1663 | 1660 |
| 1664 | 1661 |
| 1665 #undef __ | 1662 #undef __ |
| 1666 | 1663 |
| 1667 } // namespace dart | 1664 } // namespace dart |
| OLD | NEW |