| 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/constant_propagator.h" | 8 #include "vm/constant_propagator.h" |
| 9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2026 | 2026 |
| 2027 ConstantInstr* constant_type_args = | 2027 ConstantInstr* constant_type_args = |
| 2028 instantiator_type_arguments()->definition()->AsConstant(); | 2028 instantiator_type_arguments()->definition()->AsConstant(); |
| 2029 if (constant_type_args != NULL && | 2029 if (constant_type_args != NULL && |
| 2030 !constant_type_args->value().IsNull() && | 2030 !constant_type_args->value().IsNull() && |
| 2031 constant_type_args->value().IsTypeArguments()) { | 2031 constant_type_args->value().IsTypeArguments()) { |
| 2032 const TypeArguments& instantiator_type_args = | 2032 const TypeArguments& instantiator_type_args = |
| 2033 TypeArguments::Cast(constant_type_args->value()); | 2033 TypeArguments::Cast(constant_type_args->value()); |
| 2034 Error& bound_error = Error::Handle(); | 2034 Error& bound_error = Error::Handle(); |
| 2035 const AbstractType& new_dst_type = AbstractType::Handle( | 2035 const AbstractType& new_dst_type = AbstractType::Handle( |
| 2036 dst_type().InstantiateFrom(instantiator_type_args, &bound_error)); | 2036 dst_type().InstantiateFrom( |
| 2037 instantiator_type_args, &bound_error, NULL, Heap::kOld)); |
| 2037 // If dst_type is instantiated to dynamic or Object, skip the test. | 2038 // If dst_type is instantiated to dynamic or Object, skip the test. |
| 2038 if (!new_dst_type.IsMalformedOrMalbounded() && bound_error.IsNull() && | 2039 if (!new_dst_type.IsMalformedOrMalbounded() && bound_error.IsNull() && |
| 2039 (new_dst_type.IsDynamicType() || new_dst_type.IsObjectType())) { | 2040 (new_dst_type.IsDynamicType() || new_dst_type.IsObjectType())) { |
| 2040 return value()->definition(); | 2041 return value()->definition(); |
| 2041 } | 2042 } |
| 2042 set_dst_type(AbstractType::ZoneHandle(new_dst_type.Canonicalize())); | 2043 set_dst_type(AbstractType::ZoneHandle(new_dst_type.Canonicalize())); |
| 2043 if (FLAG_eliminate_type_checks && | 2044 if (FLAG_eliminate_type_checks && |
| 2044 value()->Type()->IsAssignableTo(dst_type())) { | 2045 value()->Type()->IsAssignableTo(dst_type())) { |
| 2045 return value()->definition(); | 2046 return value()->definition(); |
| 2046 } | 2047 } |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2311 static bool MayBeBoxableNumber(intptr_t cid) { | 2312 static bool MayBeBoxableNumber(intptr_t cid) { |
| 2312 return (cid == kDynamicCid) || | 2313 return (cid == kDynamicCid) || |
| 2313 (cid == kMintCid) || | 2314 (cid == kMintCid) || |
| 2314 (cid == kBigintCid) || | 2315 (cid == kBigintCid) || |
| 2315 (cid == kDoubleCid); | 2316 (cid == kDoubleCid); |
| 2316 } | 2317 } |
| 2317 | 2318 |
| 2318 | 2319 |
| 2319 static bool MaybeNumber(CompileType* type) { | 2320 static bool MaybeNumber(CompileType* type) { |
| 2320 ASSERT(Type::Handle(Type::Number()).IsMoreSpecificThan( | 2321 ASSERT(Type::Handle(Type::Number()).IsMoreSpecificThan( |
| 2321 Type::Handle(Type::Number()), NULL)); | 2322 Type::Handle(Type::Number()), NULL, Heap::kOld)); |
| 2322 return type->ToAbstractType()->IsDynamicType() | 2323 return type->ToAbstractType()->IsDynamicType() |
| 2323 || type->ToAbstractType()->IsObjectType() | 2324 || type->ToAbstractType()->IsObjectType() |
| 2324 || type->ToAbstractType()->IsTypeParameter() | 2325 || type->ToAbstractType()->IsTypeParameter() |
| 2325 || type->IsMoreSpecificThan(Type::Handle(Type::Number())); | 2326 || type->IsMoreSpecificThan(Type::Handle(Type::Number())); |
| 2326 } | 2327 } |
| 2327 | 2328 |
| 2328 | 2329 |
| 2329 // Returns a replacement for a strict comparison and signals if the result has | 2330 // Returns a replacement for a strict comparison and signals if the result has |
| 2330 // to be negated. | 2331 // to be negated. |
| 2331 static Definition* CanonicalizeStrictCompare(StrictCompareInstr* compare, | 2332 static Definition* CanonicalizeStrictCompare(StrictCompareInstr* compare, |
| (...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3645 case Token::kTRUNCDIV: return 0; | 3646 case Token::kTRUNCDIV: return 0; |
| 3646 case Token::kMOD: return 1; | 3647 case Token::kMOD: return 1; |
| 3647 default: UNIMPLEMENTED(); return -1; | 3648 default: UNIMPLEMENTED(); return -1; |
| 3648 } | 3649 } |
| 3649 } | 3650 } |
| 3650 | 3651 |
| 3651 | 3652 |
| 3652 #undef __ | 3653 #undef __ |
| 3653 | 3654 |
| 3654 } // namespace dart | 3655 } // namespace dart |
| OLD | NEW |