| 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/globals.h" // Needed here to get TARGET_ARCH_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 | 9 |
| 10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 ASSERT(smi_is_ok || malformed_error.IsNull()); | 237 ASSERT(smi_is_ok || malformed_error.IsNull()); |
| 238 __ tst(kInstanceReg, ShifterOperand(kSmiTagMask)); | 238 __ tst(kInstanceReg, ShifterOperand(kSmiTagMask)); |
| 239 if (smi_is_ok) { | 239 if (smi_is_ok) { |
| 240 __ b(is_instance_lbl, EQ); | 240 __ b(is_instance_lbl, EQ); |
| 241 } else { | 241 } else { |
| 242 __ b(is_not_instance_lbl, EQ); | 242 __ b(is_not_instance_lbl, EQ); |
| 243 } | 243 } |
| 244 const intptr_t num_type_args = type_class.NumTypeArguments(); | 244 const intptr_t num_type_args = type_class.NumTypeArguments(); |
| 245 const intptr_t num_type_params = type_class.NumTypeParameters(); | 245 const intptr_t num_type_params = type_class.NumTypeParameters(); |
| 246 const intptr_t from_index = num_type_args - num_type_params; | 246 const intptr_t from_index = num_type_args - num_type_params; |
| 247 const AbstractTypeArguments& type_arguments = | 247 const TypeArguments& type_arguments = |
| 248 AbstractTypeArguments::ZoneHandle(type.arguments()); | 248 TypeArguments::ZoneHandle(type.arguments()); |
| 249 const bool is_raw_type = type_arguments.IsNull() || | 249 const bool is_raw_type = type_arguments.IsNull() || |
| 250 type_arguments.IsRaw(from_index, num_type_params); | 250 type_arguments.IsRaw(from_index, num_type_params); |
| 251 // Signature class is an instantiated parameterized type. | 251 // Signature class is an instantiated parameterized type. |
| 252 if (!type_class.IsSignatureClass()) { | 252 if (!type_class.IsSignatureClass()) { |
| 253 if (is_raw_type) { | 253 if (is_raw_type) { |
| 254 const Register kClassIdReg = R2; | 254 const Register kClassIdReg = R2; |
| 255 // dynamic type argument, check only classes. | 255 // dynamic type argument, check only classes. |
| 256 __ LoadClassId(kClassIdReg, kInstanceReg); | 256 __ LoadClassId(kClassIdReg, kInstanceReg); |
| 257 __ CompareImmediate(kClassIdReg, type_class.id()); | 257 __ CompareImmediate(kClassIdReg, type_class.id()); |
| 258 __ b(is_instance_lbl, EQ); | 258 __ b(is_instance_lbl, EQ); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 Label* is_instance_lbl, | 410 Label* is_instance_lbl, |
| 411 Label* is_not_instance_lbl) { | 411 Label* is_not_instance_lbl) { |
| 412 __ Comment("UninstantiatedTypeTest"); | 412 __ Comment("UninstantiatedTypeTest"); |
| 413 ASSERT(!type.IsInstantiated()); | 413 ASSERT(!type.IsInstantiated()); |
| 414 // Skip check if destination is a dynamic type. | 414 // Skip check if destination is a dynamic type. |
| 415 if (type.IsTypeParameter()) { | 415 if (type.IsTypeParameter()) { |
| 416 const TypeParameter& type_param = TypeParameter::Cast(type); | 416 const TypeParameter& type_param = TypeParameter::Cast(type); |
| 417 // Load instantiator (or null) and instantiator type arguments on stack. | 417 // Load instantiator (or null) and instantiator type arguments on stack. |
| 418 __ ldr(R1, Address(SP, 0)); // Get instantiator type arguments. | 418 __ ldr(R1, Address(SP, 0)); // Get instantiator type arguments. |
| 419 // R1: instantiator type arguments. | 419 // R1: instantiator type arguments. |
| 420 // Check if type argument is dynamic. | 420 // Check if type arguments are null, i.e. equivalent to vector of dynamic. |
| 421 __ CompareImmediate(R1, reinterpret_cast<intptr_t>(Object::null())); | 421 __ CompareImmediate(R1, reinterpret_cast<intptr_t>(Object::null())); |
| 422 __ b(is_instance_lbl, EQ); | 422 __ b(is_instance_lbl, EQ); |
| 423 // Can handle only type arguments that are instances of TypeArguments. | |
| 424 // (runtime checks canonicalize type arguments). | |
| 425 Label fall_through; | |
| 426 __ CompareClassId(R1, kTypeArgumentsCid, R2); | |
| 427 __ b(&fall_through, NE); | |
| 428 __ ldr(R2, | 423 __ ldr(R2, |
| 429 FieldAddress(R1, TypeArguments::type_at_offset(type_param.index()))); | 424 FieldAddress(R1, TypeArguments::type_at_offset(type_param.index()))); |
| 430 // R2: concrete type of type. | 425 // R2: concrete type of type. |
| 431 // Check if type argument is dynamic. | 426 // Check if type argument is dynamic. |
| 432 __ CompareObject(R2, Type::ZoneHandle(Type::DynamicType())); | 427 __ CompareObject(R2, Type::ZoneHandle(Type::DynamicType())); |
| 433 __ b(is_instance_lbl, EQ); | 428 __ b(is_instance_lbl, EQ); |
| 434 __ CompareImmediate(R2, reinterpret_cast<intptr_t>(Object::null())); | 429 __ CompareObject(R2, Type::ZoneHandle(Type::ObjectType())); |
| 435 __ b(is_instance_lbl, EQ); | |
| 436 const Type& object_type = Type::ZoneHandle(Type::ObjectType()); | |
| 437 __ CompareObject(R2, object_type); | |
| 438 __ b(is_instance_lbl, EQ); | 430 __ b(is_instance_lbl, EQ); |
| 439 | 431 |
| 440 // For Smi check quickly against int and num interfaces. | 432 // For Smi check quickly against int and num interfaces. |
| 441 Label not_smi; | 433 Label not_smi; |
| 442 __ tst(R0, ShifterOperand(kSmiTagMask)); // Value is Smi? | 434 __ tst(R0, ShifterOperand(kSmiTagMask)); // Value is Smi? |
| 443 __ b(¬_smi, NE); | 435 __ b(¬_smi, NE); |
| 444 __ CompareObject(R2, Type::ZoneHandle(Type::IntType())); | 436 __ CompareObject(R2, Type::ZoneHandle(Type::IntType())); |
| 445 __ b(is_instance_lbl, EQ); | 437 __ b(is_instance_lbl, EQ); |
| 446 __ CompareObject(R2, Type::ZoneHandle(Type::Number())); | 438 __ CompareObject(R2, Type::ZoneHandle(Type::Number())); |
| 447 __ b(is_instance_lbl, EQ); | 439 __ b(is_instance_lbl, EQ); |
| 448 // Smi must be handled in runtime. | 440 // Smi must be handled in runtime. |
| 441 Label fall_through; |
| 449 __ b(&fall_through); | 442 __ b(&fall_through); |
| 450 | 443 |
| 451 __ Bind(¬_smi); | 444 __ Bind(¬_smi); |
| 452 // R1: instantiator type arguments. | 445 // R1: instantiator type arguments. |
| 453 // R0: instance. | 446 // R0: instance. |
| 454 const Register kInstanceReg = R0; | 447 const Register kInstanceReg = R0; |
| 455 const Register kTypeArgumentsReg = R1; | 448 const Register kTypeArgumentsReg = R1; |
| 456 const Register kTempReg = kNoRegister; | 449 const Register kTempReg = kNoRegister; |
| 457 const SubtypeTestCache& type_test_cache = | 450 const SubtypeTestCache& type_test_cache = |
| 458 SubtypeTestCache::ZoneHandle( | 451 SubtypeTestCache::ZoneHandle( |
| (...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1821 DRegister dreg = EvenDRegisterOf(reg); | 1814 DRegister dreg = EvenDRegisterOf(reg); |
| 1822 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); | 1815 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); |
| 1823 } | 1816 } |
| 1824 | 1817 |
| 1825 | 1818 |
| 1826 #undef __ | 1819 #undef __ |
| 1827 | 1820 |
| 1828 } // namespace dart | 1821 } // namespace dart |
| 1829 | 1822 |
| 1830 #endif // defined TARGET_ARCH_ARM | 1823 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |