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