| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 return InlineFloat32x4BinaryOp(call, op_kind); | 1223 return InlineFloat32x4BinaryOp(call, op_kind); |
| 1224 } else if (operands_type == kUint32x4Cid) { | 1224 } else if (operands_type == kUint32x4Cid) { |
| 1225 return InlineUint32x4BinaryOp(call, op_kind); | 1225 return InlineUint32x4BinaryOp(call, op_kind); |
| 1226 } else if (op_kind == Token::kMOD) { | 1226 } else if (op_kind == Token::kMOD) { |
| 1227 // TODO(vegorov): implement fast path code for modulo. | 1227 // TODO(vegorov): implement fast path code for modulo. |
| 1228 ASSERT(operands_type == kSmiCid); | 1228 ASSERT(operands_type == kSmiCid); |
| 1229 if (!right->IsConstant()) return false; | 1229 if (!right->IsConstant()) return false; |
| 1230 const Object& obj = right->AsConstant()->value(); | 1230 const Object& obj = right->AsConstant()->value(); |
| 1231 if (!obj.IsSmi()) return false; | 1231 if (!obj.IsSmi()) return false; |
| 1232 const intptr_t value = Smi::Cast(obj).Value(); | 1232 const intptr_t value = Smi::Cast(obj).Value(); |
| 1233 if ((value <= 0) || !Utils::IsPowerOfTwo(value)) return false; | 1233 if (!Utils::IsPowerOfTwo(value)) return false; |
| 1234 | 1234 |
| 1235 // Insert smi check and attach a copy of the original environment | 1235 // Insert smi check and attach a copy of the original environment |
| 1236 // because the smi operation can still deoptimize. | 1236 // because the smi operation can still deoptimize. |
| 1237 InsertBefore(call, | 1237 InsertBefore(call, |
| 1238 new CheckSmiInstr(new Value(left), call->deopt_id()), | 1238 new CheckSmiInstr(new Value(left), call->deopt_id()), |
| 1239 call->env(), | 1239 call->env(), |
| 1240 Definition::kEffect); | 1240 Definition::kEffect); |
| 1241 ConstantInstr* constant = | 1241 ConstantInstr* constant = |
| 1242 flow_graph()->GetConstant(Smi::Handle(Smi::New(value - 1))); | 1242 flow_graph()->GetConstant(Smi::Handle(Smi::New(value - 1))); |
| 1243 BinarySmiOpInstr* bin_op = | 1243 BinarySmiOpInstr* bin_op = |
| (...skipping 6231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7475 } | 7475 } |
| 7476 | 7476 |
| 7477 // Insert materializations at environment uses. | 7477 // Insert materializations at environment uses. |
| 7478 for (intptr_t i = 0; i < exits.length(); i++) { | 7478 for (intptr_t i = 0; i < exits.length(); i++) { |
| 7479 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); | 7479 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); |
| 7480 } | 7480 } |
| 7481 } | 7481 } |
| 7482 | 7482 |
| 7483 | 7483 |
| 7484 } // namespace dart | 7484 } // namespace dart |
| OLD | NEW |