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 5887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5898 } | 5898 } |
5899 SetValue(instr, non_constant_); | 5899 SetValue(instr, non_constant_); |
5900 } | 5900 } |
5901 | 5901 |
5902 | 5902 |
5903 void ConstantPropagator::VisitStoreVMField(StoreVMFieldInstr* instr) { | 5903 void ConstantPropagator::VisitStoreVMField(StoreVMFieldInstr* instr) { |
5904 SetValue(instr, instr->value()->definition()->constant_value()); | 5904 SetValue(instr, instr->value()->definition()->constant_value()); |
5905 } | 5905 } |
5906 | 5906 |
5907 | 5907 |
| 5908 void ConstantPropagator::VisitInstantiateType(InstantiateTypeInstr* instr) { |
| 5909 const Object& object = |
| 5910 instr->instantiator()->definition()->constant_value(); |
| 5911 if (IsNonConstant(object)) { |
| 5912 SetValue(instr, non_constant_); |
| 5913 return; |
| 5914 } |
| 5915 if (IsConstant(object)) { |
| 5916 if (instr->type().IsTypeParameter()) { |
| 5917 if (object.IsNull()) { |
| 5918 SetValue(instr, Type::ZoneHandle(Type::DynamicType())); |
| 5919 return; |
| 5920 } |
| 5921 // We could try to instantiate the type parameter and return it if no |
| 5922 // malformed error is reported. |
| 5923 } |
| 5924 SetValue(instr, non_constant_); |
| 5925 } |
| 5926 } |
| 5927 |
| 5928 |
5908 void ConstantPropagator::VisitInstantiateTypeArguments( | 5929 void ConstantPropagator::VisitInstantiateTypeArguments( |
5909 InstantiateTypeArgumentsInstr* instr) { | 5930 InstantiateTypeArgumentsInstr* instr) { |
5910 const Object& object = | 5931 const Object& object = |
5911 instr->instantiator()->definition()->constant_value(); | 5932 instr->instantiator()->definition()->constant_value(); |
5912 if (IsNonConstant(object)) { | 5933 if (IsNonConstant(object)) { |
5913 SetValue(instr, non_constant_); | 5934 SetValue(instr, non_constant_); |
5914 return; | 5935 return; |
5915 } | 5936 } |
5916 if (IsConstant(object)) { | 5937 if (IsConstant(object)) { |
5917 const intptr_t len = instr->type_arguments().Length(); | 5938 const intptr_t len = instr->type_arguments().Length(); |
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7160 | 7181 |
7161 // Insert materializations at environment uses. | 7182 // Insert materializations at environment uses. |
7162 const Class& cls = Class::Handle(alloc->constructor().Owner()); | 7183 const Class& cls = Class::Handle(alloc->constructor().Owner()); |
7163 for (intptr_t i = 0; i < exits.length(); i++) { | 7184 for (intptr_t i = 0; i < exits.length(); i++) { |
7164 CreateMaterializationAt(exits[i], alloc, cls, *fields); | 7185 CreateMaterializationAt(exits[i], alloc, cls, *fields); |
7165 } | 7186 } |
7166 } | 7187 } |
7167 | 7188 |
7168 | 7189 |
7169 } // namespace dart | 7190 } // namespace dart |
OLD | NEW |