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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/bootstrap.h" | 8 #include "vm/bootstrap.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/constant_propagator.h" | 10 #include "vm/constant_propagator.h" |
(...skipping 2046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2057 | 2057 |
2058 return this; | 2058 return this; |
2059 } | 2059 } |
2060 | 2060 |
2061 | 2061 |
2062 Definition* AssertAssignableInstr::Canonicalize(FlowGraph* flow_graph) { | 2062 Definition* AssertAssignableInstr::Canonicalize(FlowGraph* flow_graph) { |
2063 if (FLAG_eliminate_type_checks && | 2063 if (FLAG_eliminate_type_checks && |
2064 value()->Type()->IsAssignableTo(dst_type())) { | 2064 value()->Type()->IsAssignableTo(dst_type())) { |
2065 return value()->definition(); | 2065 return value()->definition(); |
2066 } | 2066 } |
2067 | 2067 if (dst_type().IsInstantiated()) { |
| 2068 return this; |
| 2069 } |
2068 // For uninstantiated target types: If the instantiator and function | 2070 // For uninstantiated target types: If the instantiator and function |
2069 // type arguments are constant, instantiate the target type here. | 2071 // type arguments are constant, instantiate the target type here. |
2070 // If the uninstantiated type refers to parent function type parameters, we | |
2071 // cannot instantiated it here. | |
2072 if (dst_type().IsInstantiated() || | |
2073 !dst_type().IsInstantiated(kParentFunctions)) { | |
2074 return this; | |
2075 } | |
2076 | |
2077 ConstantInstr* constant_instantiator_type_args = | 2072 ConstantInstr* constant_instantiator_type_args = |
2078 instantiator_type_arguments()->definition()->AsConstant(); | 2073 instantiator_type_arguments()->definition()->AsConstant(); |
2079 ConstantInstr* constant_function_type_args = | 2074 ConstantInstr* constant_function_type_args = |
2080 function_type_arguments()->definition()->AsConstant(); | 2075 function_type_arguments()->definition()->AsConstant(); |
2081 if ((constant_instantiator_type_args != NULL) && | 2076 if ((constant_instantiator_type_args != NULL) && |
2082 (constant_function_type_args != NULL)) { | 2077 (constant_function_type_args != NULL)) { |
2083 ASSERT(constant_instantiator_type_args->value().IsNull() || | 2078 ASSERT(constant_instantiator_type_args->value().IsNull() || |
2084 constant_instantiator_type_args->value().IsTypeArguments()); | 2079 constant_instantiator_type_args->value().IsTypeArguments()); |
2085 ASSERT(constant_function_type_args->value().IsNull() || | 2080 ASSERT(constant_function_type_args->value().IsNull() || |
2086 constant_function_type_args->value().IsTypeArguments()); | 2081 constant_function_type_args->value().IsTypeArguments()); |
(...skipping 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4007 "native function '%s' (%" Pd " arguments) cannot be found", | 4002 "native function '%s' (%" Pd " arguments) cannot be found", |
4008 native_name().ToCString(), function().NumParameters()); | 4003 native_name().ToCString(), function().NumParameters()); |
4009 } | 4004 } |
4010 set_is_auto_scope(auto_setup_scope); | 4005 set_is_auto_scope(auto_setup_scope); |
4011 set_native_c_function(native_function); | 4006 set_native_c_function(native_function); |
4012 } | 4007 } |
4013 | 4008 |
4014 #undef __ | 4009 #undef __ |
4015 | 4010 |
4016 } // namespace dart | 4011 } // namespace dart |
OLD | NEW |