| 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/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1761 | 1761 |
| 1762 | 1762 |
| 1763 // Returns a Boolean constant if all classes in ic_data yield the same type-test | 1763 // Returns a Boolean constant if all classes in ic_data yield the same type-test |
| 1764 // result and the type tests do not depend on type arguments. Otherwise return | 1764 // result and the type tests do not depend on type arguments. Otherwise return |
| 1765 // Bool::null(). | 1765 // Bool::null(). |
| 1766 RawBool* FlowGraphOptimizer::InstanceOfAsBool(const ICData& ic_data, | 1766 RawBool* FlowGraphOptimizer::InstanceOfAsBool(const ICData& ic_data, |
| 1767 const AbstractType& type) const { | 1767 const AbstractType& type) const { |
| 1768 ASSERT(ic_data.num_args_tested() == 1); // Unary checks only. | 1768 ASSERT(ic_data.num_args_tested() == 1); // Unary checks only. |
| 1769 if (!type.IsInstantiated() || type.IsMalformed()) return Bool::null(); | 1769 if (!type.IsInstantiated() || type.IsMalformed()) return Bool::null(); |
| 1770 const Class& type_class = Class::Handle(type.type_class()); | 1770 const Class& type_class = Class::Handle(type.type_class()); |
| 1771 if (type_class.HasTypeArguments()) return Bool::null(); | 1771 if (type_class.HasTypeArguments()) { |
| 1772 // Only raw types can be directly compared, thus disregarding type |
| 1773 // arguments. |
| 1774 const AbstractTypeArguments& type_arguments = |
| 1775 AbstractTypeArguments::Handle(type.arguments()); |
| 1776 const bool is_raw_type = type_arguments.IsNull() || |
| 1777 type_arguments.IsRaw(type_arguments.Length()); |
| 1778 if (!is_raw_type) { |
| 1779 // Unknown result. |
| 1780 return Bool::null(); |
| 1781 } |
| 1782 } |
| 1772 const ClassTable& class_table = *Isolate::Current()->class_table(); | 1783 const ClassTable& class_table = *Isolate::Current()->class_table(); |
| 1773 Bool& prev = Bool::Handle(); | 1784 Bool& prev = Bool::Handle(); |
| 1774 Class& cls = Class::Handle(); | 1785 Class& cls = Class::Handle(); |
| 1775 for (int i = 0; i < ic_data.NumberOfChecks(); i++) { | 1786 for (int i = 0; i < ic_data.NumberOfChecks(); i++) { |
| 1776 cls = class_table.At(ic_data.GetReceiverClassIdAt(i)); | 1787 cls = class_table.At(ic_data.GetReceiverClassIdAt(i)); |
| 1777 if (cls.HasTypeArguments()) return Bool::null(); | 1788 if (cls.HasTypeArguments()) return Bool::null(); |
| 1778 const bool is_subtype = cls.IsSubtypeOf(TypeArguments::Handle(), | 1789 const bool is_subtype = cls.IsSubtypeOf(TypeArguments::Handle(), |
| 1779 type_class, | 1790 type_class, |
| 1780 TypeArguments::Handle(), | 1791 TypeArguments::Handle(), |
| 1781 NULL); | 1792 NULL); |
| (...skipping 2832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4614 if (changed) { | 4625 if (changed) { |
| 4615 // We may have changed the block order and the dominator tree. | 4626 // We may have changed the block order and the dominator tree. |
| 4616 flow_graph->DiscoverBlocks(); | 4627 flow_graph->DiscoverBlocks(); |
| 4617 GrowableArray<BitVector*> dominance_frontier; | 4628 GrowableArray<BitVector*> dominance_frontier; |
| 4618 flow_graph->ComputeDominators(&dominance_frontier); | 4629 flow_graph->ComputeDominators(&dominance_frontier); |
| 4619 } | 4630 } |
| 4620 } | 4631 } |
| 4621 | 4632 |
| 4622 | 4633 |
| 4623 } // namespace dart | 4634 } // namespace dart |
| OLD | NEW |