| 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 2031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2042 if (dst_type().IsInstantiated()) return this; | 2042 if (dst_type().IsInstantiated()) return this; |
| 2043 | 2043 |
| 2044 ConstantInstr* constant_type_args = | 2044 ConstantInstr* constant_type_args = |
| 2045 instantiator_type_arguments()->definition()->AsConstant(); | 2045 instantiator_type_arguments()->definition()->AsConstant(); |
| 2046 if (constant_type_args != NULL && | 2046 if (constant_type_args != NULL && |
| 2047 !constant_type_args->value().IsNull() && | 2047 !constant_type_args->value().IsNull() && |
| 2048 constant_type_args->value().IsTypeArguments()) { | 2048 constant_type_args->value().IsTypeArguments()) { |
| 2049 const TypeArguments& instantiator_type_args = | 2049 const TypeArguments& instantiator_type_args = |
| 2050 TypeArguments::Cast(constant_type_args->value()); | 2050 TypeArguments::Cast(constant_type_args->value()); |
| 2051 Error& bound_error = Error::Handle(); | 2051 Error& bound_error = Error::Handle(); |
| 2052 const AbstractType& new_dst_type = AbstractType::Handle( | 2052 AbstractType& new_dst_type = AbstractType::Handle( |
| 2053 dst_type().InstantiateFrom( | 2053 dst_type().InstantiateFrom( |
| 2054 instantiator_type_args, &bound_error, NULL, NULL, Heap::kOld)); | 2054 instantiator_type_args, &bound_error, NULL, NULL, Heap::kOld)); |
| 2055 // If dst_type is instantiated to dynamic or Object, skip the test. | 2055 if (new_dst_type.IsMalformedOrMalbounded() || !bound_error.IsNull()) { |
| 2056 if (!new_dst_type.IsMalformedOrMalbounded() && bound_error.IsNull() && | 2056 return this; |
| 2057 (new_dst_type.IsDynamicType() || new_dst_type.IsObjectType())) { | 2057 } |
| 2058 if (new_dst_type.IsTypeRef()) { |
| 2059 new_dst_type = TypeRef::Cast(new_dst_type).type(); |
| 2060 } |
| 2061 new_dst_type = new_dst_type.Canonicalize(); |
| 2062 set_dst_type(new_dst_type); |
| 2063 |
| 2064 if (new_dst_type.IsDynamicType() || |
| 2065 new_dst_type.IsObjectType() || |
| 2066 (FLAG_eliminate_type_checks && |
| 2067 value()->Type()->IsAssignableTo(new_dst_type))) { |
| 2058 return value()->definition(); | 2068 return value()->definition(); |
| 2059 } | 2069 } |
| 2060 set_dst_type(AbstractType::ZoneHandle(new_dst_type.Canonicalize())); | 2070 |
| 2061 if (FLAG_eliminate_type_checks && | |
| 2062 value()->Type()->IsAssignableTo(dst_type())) { | |
| 2063 return value()->definition(); | |
| 2064 } | |
| 2065 ConstantInstr* null_constant = flow_graph->constant_null(); | 2071 ConstantInstr* null_constant = flow_graph->constant_null(); |
| 2066 instantiator_type_arguments()->BindTo(null_constant); | 2072 instantiator_type_arguments()->BindTo(null_constant); |
| 2067 } | 2073 } |
| 2068 return this; | 2074 return this; |
| 2069 } | 2075 } |
| 2070 | 2076 |
| 2071 | 2077 |
| 2072 Definition* InstantiateTypeArgumentsInstr::Canonicalize(FlowGraph* flow_graph) { | 2078 Definition* InstantiateTypeArgumentsInstr::Canonicalize(FlowGraph* flow_graph) { |
| 2073 return (Isolate::Current()->flags().type_checks() || HasUses()) ? this : NULL; | 2079 return (Isolate::Current()->flags().type_checks() || HasUses()) ? this : NULL; |
| 2074 } | 2080 } |
| (...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3725 set_native_c_function(native_function); | 3731 set_native_c_function(native_function); |
| 3726 function().SetIsNativeAutoSetupScope(auto_setup_scope); | 3732 function().SetIsNativeAutoSetupScope(auto_setup_scope); |
| 3727 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); | 3733 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); |
| 3728 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); | 3734 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); |
| 3729 set_is_bootstrap_native(is_bootstrap_native); | 3735 set_is_bootstrap_native(is_bootstrap_native); |
| 3730 } | 3736 } |
| 3731 | 3737 |
| 3732 #undef __ | 3738 #undef __ |
| 3733 | 3739 |
| 3734 } // namespace dart | 3740 } // namespace dart |
| OLD | NEW |