| 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/flow_graph_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
| 9 #include "vm/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/hash_map.h" | 10 #include "vm/hash_map.h" |
| (...skipping 2179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2190 SetValue(instr, non_constant_); | 2190 SetValue(instr, non_constant_); |
| 2191 } else if (IsConstant(left) && IsConstant(right)) { | 2191 } else if (IsConstant(left) && IsConstant(right)) { |
| 2192 if (left.IsSmi() && right.IsSmi()) { | 2192 if (left.IsSmi() && right.IsSmi()) { |
| 2193 switch (instr->op_kind()) { | 2193 switch (instr->op_kind()) { |
| 2194 case Token::kADD: | 2194 case Token::kADD: |
| 2195 case Token::kSUB: | 2195 case Token::kSUB: |
| 2196 case Token::kMUL: | 2196 case Token::kMUL: |
| 2197 case Token::kTRUNCDIV: | 2197 case Token::kTRUNCDIV: |
| 2198 case Token::kMOD: { | 2198 case Token::kMOD: { |
| 2199 const Object& result = | 2199 const Object& result = |
| 2200 Integer::ZoneHandle(Integer::BinaryOp(instr->op_kind(), | 2200 Integer::ZoneHandle(Smi::Cast(left).BinaryOp(instr->op_kind(), |
| 2201 Smi::Cast(left), | 2201 Smi::Cast(right))); |
| 2202 Smi::Cast(right))); | |
| 2203 SetValue(instr, result); | 2202 SetValue(instr, result); |
| 2204 break; | 2203 break; |
| 2205 } | 2204 } |
| 2206 default: | 2205 default: |
| 2207 // TODO(kmillikin): support other smi operations. | 2206 // TODO(kmillikin): support other smi operations. |
| 2208 SetValue(instr, non_constant_); | 2207 SetValue(instr, non_constant_); |
| 2209 } | 2208 } |
| 2210 } else { | 2209 } else { |
| 2211 // TODO(kmillikin): support other types. | 2210 // TODO(kmillikin): support other types. |
| 2212 SetValue(instr, non_constant_); | 2211 SetValue(instr, non_constant_); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2460 it.Advance()) { | 2459 it.Advance()) { |
| 2461 JoinEntryInstr* join = it.Current()->AsJoinEntry(); | 2460 JoinEntryInstr* join = it.Current()->AsJoinEntry(); |
| 2462 if (join != NULL) join->EliminateUnreachablePhiInputs(); | 2461 if (join != NULL) join->EliminateUnreachablePhiInputs(); |
| 2463 } | 2462 } |
| 2464 | 2463 |
| 2465 graph_->ComputeUseLists(); | 2464 graph_->ComputeUseLists(); |
| 2466 } | 2465 } |
| 2467 | 2466 |
| 2468 | 2467 |
| 2469 } // namespace dart | 2468 } // namespace dart |
| OLD | NEW |