| 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 2039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2050 ConstantInstr* constant_type_args = | 2050 ConstantInstr* constant_type_args = |
| 2051 instantiator_type_arguments()->definition()->AsConstant(); | 2051 instantiator_type_arguments()->definition()->AsConstant(); |
| 2052 if (constant_type_args != NULL && | 2052 if (constant_type_args != NULL && |
| 2053 !constant_type_args->value().IsNull() && | 2053 !constant_type_args->value().IsNull() && |
| 2054 constant_type_args->value().IsTypeArguments()) { | 2054 constant_type_args->value().IsTypeArguments()) { |
| 2055 const TypeArguments& instantiator_type_args = | 2055 const TypeArguments& instantiator_type_args = |
| 2056 TypeArguments::Cast(constant_type_args->value()); | 2056 TypeArguments::Cast(constant_type_args->value()); |
| 2057 Error& bound_error = Error::Handle(); | 2057 Error& bound_error = Error::Handle(); |
| 2058 const AbstractType& new_dst_type = AbstractType::Handle( | 2058 const AbstractType& new_dst_type = AbstractType::Handle( |
| 2059 dst_type().InstantiateFrom( | 2059 dst_type().InstantiateFrom( |
| 2060 instantiator_type_args, &bound_error, NULL, Heap::kOld)); | 2060 instantiator_type_args, &bound_error, NULL, NULL, Heap::kOld)); |
| 2061 // If dst_type is instantiated to dynamic or Object, skip the test. | 2061 // If dst_type is instantiated to dynamic or Object, skip the test. |
| 2062 if (!new_dst_type.IsMalformedOrMalbounded() && bound_error.IsNull() && | 2062 if (!new_dst_type.IsMalformedOrMalbounded() && bound_error.IsNull() && |
| 2063 (new_dst_type.IsDynamicType() || new_dst_type.IsObjectType())) { | 2063 (new_dst_type.IsDynamicType() || new_dst_type.IsObjectType())) { |
| 2064 return value()->definition(); | 2064 return value()->definition(); |
| 2065 } | 2065 } |
| 2066 set_dst_type(AbstractType::ZoneHandle(new_dst_type.Canonicalize())); | 2066 set_dst_type(AbstractType::ZoneHandle(new_dst_type.Canonicalize())); |
| 2067 if (FLAG_eliminate_type_checks && | 2067 if (FLAG_eliminate_type_checks && |
| 2068 value()->Type()->IsAssignableTo(dst_type())) { | 2068 value()->Type()->IsAssignableTo(dst_type())) { |
| 2069 return value()->definition(); | 2069 return value()->definition(); |
| 2070 } | 2070 } |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2337 static bool MayBeBoxableNumber(intptr_t cid) { | 2337 static bool MayBeBoxableNumber(intptr_t cid) { |
| 2338 return (cid == kDynamicCid) || | 2338 return (cid == kDynamicCid) || |
| 2339 (cid == kMintCid) || | 2339 (cid == kMintCid) || |
| 2340 (cid == kBigintCid) || | 2340 (cid == kBigintCid) || |
| 2341 (cid == kDoubleCid); | 2341 (cid == kDoubleCid); |
| 2342 } | 2342 } |
| 2343 | 2343 |
| 2344 | 2344 |
| 2345 static bool MaybeNumber(CompileType* type) { | 2345 static bool MaybeNumber(CompileType* type) { |
| 2346 ASSERT(Type::Handle(Type::Number()).IsMoreSpecificThan( | 2346 ASSERT(Type::Handle(Type::Number()).IsMoreSpecificThan( |
| 2347 Type::Handle(Type::Number()), NULL, Heap::kOld)); | 2347 Type::Handle(Type::Number()), NULL, NULL, Heap::kOld)); |
| 2348 return type->ToAbstractType()->IsDynamicType() | 2348 return type->ToAbstractType()->IsDynamicType() |
| 2349 || type->ToAbstractType()->IsObjectType() | 2349 || type->ToAbstractType()->IsObjectType() |
| 2350 || type->ToAbstractType()->IsTypeParameter() | 2350 || type->ToAbstractType()->IsTypeParameter() |
| 2351 || type->IsMoreSpecificThan(Type::Handle(Type::Number())); | 2351 || type->IsMoreSpecificThan(Type::Handle(Type::Number())); |
| 2352 } | 2352 } |
| 2353 | 2353 |
| 2354 | 2354 |
| 2355 // Returns a replacement for a strict comparison and signals if the result has | 2355 // Returns a replacement for a strict comparison and signals if the result has |
| 2356 // to be negated. | 2356 // to be negated. |
| 2357 static Definition* CanonicalizeStrictCompare(StrictCompareInstr* compare, | 2357 static Definition* CanonicalizeStrictCompare(StrictCompareInstr* compare, |
| (...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3731 set_native_c_function(native_function); | 3731 set_native_c_function(native_function); |
| 3732 function().SetIsNativeAutoSetupScope(auto_setup_scope); | 3732 function().SetIsNativeAutoSetupScope(auto_setup_scope); |
| 3733 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); | 3733 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); |
| 3734 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); | 3734 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); |
| 3735 set_is_bootstrap_native(is_bootstrap_native); | 3735 set_is_bootstrap_native(is_bootstrap_native); |
| 3736 } | 3736 } |
| 3737 | 3737 |
| 3738 #undef __ | 3738 #undef __ |
| 3739 | 3739 |
| 3740 } // namespace dart | 3740 } // namespace dart |
| OLD | NEW |