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/constant_propagator.h" | 5 #include "vm/constant_propagator.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/flow_graph_builder.h" | 8 #include "vm/flow_graph_builder.h" |
9 #include "vm/flow_graph_compiler.h" | 9 #include "vm/flow_graph_compiler.h" |
10 #include "vm/flow_graph_range_analysis.h" | 10 #include "vm/flow_graph_range_analysis.h" |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 // The representation guarantees the type check to be true. | 757 // The representation guarantees the type check to be true. |
758 SetValue(instr, Bool::True()); | 758 SetValue(instr, Bool::True()); |
759 } else { | 759 } else { |
760 SetValue(instr, non_constant_); | 760 SetValue(instr, non_constant_); |
761 } | 761 } |
762 } else if (IsConstant(value)) { | 762 } else if (IsConstant(value)) { |
763 if (value.IsInstance()) { | 763 if (value.IsInstance()) { |
764 const Instance& instance = Instance::Cast(value); | 764 const Instance& instance = Instance::Cast(value); |
765 const AbstractType& checked_type = instr->type(); | 765 const AbstractType& checked_type = instr->type(); |
766 if (instr->instantiator_type_arguments()->BindsToConstantNull() && | 766 if (instr->instantiator_type_arguments()->BindsToConstantNull() && |
767 instr->function_type_arguments()->BindsToConstantNull() && | 767 instr->function_type_arguments()->BindsToConstantNull()) { |
768 checked_type.IsInstantiated(kParentFunctions)) { | |
769 Error& bound_error = Error::Handle(); | 768 Error& bound_error = Error::Handle(); |
770 bool is_instance = | 769 bool is_instance = |
771 instance.IsInstanceOf(checked_type, Object::null_type_arguments(), | 770 instance.IsInstanceOf(checked_type, Object::null_type_arguments(), |
772 Object::null_type_arguments(), &bound_error); | 771 Object::null_type_arguments(), &bound_error); |
773 // Can only have bound error with generics. | 772 // Can only have bound error with generics. |
774 ASSERT(bound_error.IsNull()); | 773 ASSERT(bound_error.IsNull()); |
775 SetValue(instr, Bool::Get(is_instance)); | 774 SetValue(instr, Bool::Get(is_instance)); |
776 return; | 775 return; |
777 } | 776 } |
778 } | 777 } |
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1732 GrowableArray<BitVector*> dominance_frontier; | 1731 GrowableArray<BitVector*> dominance_frontier; |
1733 graph_->ComputeDominators(&dominance_frontier); | 1732 graph_->ComputeDominators(&dominance_frontier); |
1734 | 1733 |
1735 if (FLAG_trace_constant_propagation && | 1734 if (FLAG_trace_constant_propagation && |
1736 FlowGraphPrinter::ShouldPrint(graph_->function())) { | 1735 FlowGraphPrinter::ShouldPrint(graph_->function())) { |
1737 FlowGraphPrinter::PrintGraph("After CP", graph_); | 1736 FlowGraphPrinter::PrintGraph("After CP", graph_); |
1738 } | 1737 } |
1739 } | 1738 } |
1740 | 1739 |
1741 } // namespace dart | 1740 } // namespace dart |
OLD | NEW |