| 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 const AbstractType& type, | 271 const AbstractType& type, |
| 272 Label* is_instance_lbl, | 272 Label* is_instance_lbl, |
| 273 Label* is_not_instance_lbl) { | 273 Label* is_not_instance_lbl) { |
| 274 __ Comment("InstantiatedTypeWithArgumentsTest"); | 274 __ Comment("InstantiatedTypeWithArgumentsTest"); |
| 275 ASSERT(type.IsInstantiated()); | 275 ASSERT(type.IsInstantiated()); |
| 276 const Class& type_class = Class::ZoneHandle(zone(), type.type_class()); | 276 const Class& type_class = Class::ZoneHandle(zone(), type.type_class()); |
| 277 ASSERT(type.IsFunctionType() || (type_class.NumTypeArguments() > 0)); | 277 ASSERT(type.IsFunctionType() || (type_class.NumTypeArguments() > 0)); |
| 278 const Register kInstanceReg = R0; | 278 const Register kInstanceReg = R0; |
| 279 Error& bound_error = Error::Handle(zone()); | 279 Error& bound_error = Error::Handle(zone()); |
| 280 const Type& int_type = Type::Handle(zone(), Type::IntType()); | 280 const Type& int_type = Type::Handle(zone(), Type::IntType()); |
| 281 const bool smi_is_ok = int_type.IsSubtypeOf(type, &bound_error, Heap::kOld); | 281 const bool smi_is_ok = |
| 282 int_type.IsSubtypeOf(type, &bound_error, NULL, Heap::kOld); |
| 282 // Malformed type should have been handled at graph construction time. | 283 // Malformed type should have been handled at graph construction time. |
| 283 ASSERT(smi_is_ok || bound_error.IsNull()); | 284 ASSERT(smi_is_ok || bound_error.IsNull()); |
| 284 __ tst(kInstanceReg, Operand(kSmiTagMask)); | 285 __ tst(kInstanceReg, Operand(kSmiTagMask)); |
| 285 if (smi_is_ok) { | 286 if (smi_is_ok) { |
| 286 __ b(is_instance_lbl, EQ); | 287 __ b(is_instance_lbl, EQ); |
| 287 } else { | 288 } else { |
| 288 __ b(is_not_instance_lbl, EQ); | 289 __ b(is_not_instance_lbl, EQ); |
| 289 } | 290 } |
| 290 // A function type test requires checking the function signature. | 291 // A function type test requires checking the function signature. |
| 291 if (!type.IsFunctionType()) { | 292 if (!type.IsFunctionType()) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 311 } | 312 } |
| 312 // If one type argument only, check if type argument is Object or dynamic. | 313 // If one type argument only, check if type argument is Object or dynamic. |
| 313 if (type_arguments.Length() == 1) { | 314 if (type_arguments.Length() == 1) { |
| 314 const AbstractType& tp_argument = AbstractType::ZoneHandle( | 315 const AbstractType& tp_argument = AbstractType::ZoneHandle( |
| 315 zone(), type_arguments.TypeAt(0)); | 316 zone(), type_arguments.TypeAt(0)); |
| 316 ASSERT(!tp_argument.IsMalformed()); | 317 ASSERT(!tp_argument.IsMalformed()); |
| 317 if (tp_argument.IsType()) { | 318 if (tp_argument.IsType()) { |
| 318 ASSERT(tp_argument.HasResolvedTypeClass()); | 319 ASSERT(tp_argument.HasResolvedTypeClass()); |
| 319 // Check if type argument is dynamic or Object. | 320 // Check if type argument is dynamic or Object. |
| 320 const Type& object_type = Type::Handle(zone(), Type::ObjectType()); | 321 const Type& object_type = Type::Handle(zone(), Type::ObjectType()); |
| 321 if (object_type.IsSubtypeOf(tp_argument, NULL, Heap::kOld)) { | 322 if (object_type.IsSubtypeOf(tp_argument, NULL, NULL, Heap::kOld)) { |
| 322 // Instance class test only necessary. | 323 // Instance class test only necessary. |
| 323 return GenerateSubtype1TestCacheLookup( | 324 return GenerateSubtype1TestCacheLookup( |
| 324 token_pos, type_class, is_instance_lbl, is_not_instance_lbl); | 325 token_pos, type_class, is_instance_lbl, is_not_instance_lbl); |
| 325 } | 326 } |
| 326 } | 327 } |
| 327 } | 328 } |
| 328 } | 329 } |
| 329 // Regular subtype test cache involving instance's type arguments. | 330 // Regular subtype test cache involving instance's type arguments. |
| 330 const Register kTypeArgumentsReg = kNoRegister; | 331 const Register kTypeArgumentsReg = kNoRegister; |
| 331 const Register kTempReg = kNoRegister; | 332 const Register kTempReg = kNoRegister; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 ASSERT(type_class.NumTypeArguments() == 0); | 372 ASSERT(type_class.NumTypeArguments() == 0); |
| 372 | 373 |
| 373 const Register kInstanceReg = R0; | 374 const Register kInstanceReg = R0; |
| 374 __ tst(kInstanceReg, Operand(kSmiTagMask)); | 375 __ tst(kInstanceReg, Operand(kSmiTagMask)); |
| 375 // If instance is Smi, check directly. | 376 // If instance is Smi, check directly. |
| 376 const Class& smi_class = Class::Handle(zone(), Smi::Class()); | 377 const Class& smi_class = Class::Handle(zone(), Smi::Class()); |
| 377 if (smi_class.IsSubtypeOf(TypeArguments::Handle(zone()), | 378 if (smi_class.IsSubtypeOf(TypeArguments::Handle(zone()), |
| 378 type_class, | 379 type_class, |
| 379 TypeArguments::Handle(zone()), | 380 TypeArguments::Handle(zone()), |
| 380 NULL, | 381 NULL, |
| 382 NULL, |
| 381 Heap::kOld)) { | 383 Heap::kOld)) { |
| 382 __ b(is_instance_lbl, EQ); | 384 __ b(is_instance_lbl, EQ); |
| 383 } else { | 385 } else { |
| 384 __ b(is_not_instance_lbl, EQ); | 386 __ b(is_not_instance_lbl, EQ); |
| 385 } | 387 } |
| 386 // Compare if the classes are equal. | 388 // Compare if the classes are equal. |
| 387 const Register kClassIdReg = R2; | 389 const Register kClassIdReg = R2; |
| 388 __ LoadClassId(kClassIdReg, kInstanceReg); | 390 __ LoadClassId(kClassIdReg, kInstanceReg); |
| 389 __ CompareImmediate(kClassIdReg, type_class.id()); | 391 __ CompareImmediate(kClassIdReg, type_class.id()); |
| 390 __ b(is_instance_lbl, EQ); | 392 __ b(is_instance_lbl, EQ); |
| 391 // See ClassFinalizer::ResolveSuperTypeAndInterfaces for list of restricted | 393 // See ClassFinalizer::ResolveSuperTypeAndInterfaces for list of restricted |
| 392 // interfaces. | 394 // interfaces. |
| 393 // Bool interface can be implemented only by core class Bool. | 395 // Bool interface can be implemented only by core class Bool. |
| 394 if (type.IsBoolType()) { | 396 if (type.IsBoolType()) { |
| 395 __ CompareImmediate(kClassIdReg, kBoolCid); | 397 __ CompareImmediate(kClassIdReg, kBoolCid); |
| 396 __ b(is_instance_lbl, EQ); | 398 __ b(is_instance_lbl, EQ); |
| 397 __ b(is_not_instance_lbl); | 399 __ b(is_not_instance_lbl); |
| 398 return false; | 400 return false; |
| 399 } | 401 } |
| 400 if (type.IsDartFunctionType()) { | 402 if (type.IsDartFunctionType()) { |
| 401 // Check if instance is a closure. | 403 // Check if instance is a closure. |
| 402 __ CompareImmediate(kClassIdReg, kClosureCid); | 404 __ CompareImmediate(kClassIdReg, kClosureCid); |
| 403 __ b(is_instance_lbl, EQ); | 405 __ b(is_instance_lbl, EQ); |
| 404 } | 406 } |
| 405 // Custom checking for numbers (Smi, Mint, Bigint and Double). | 407 // Custom checking for numbers (Smi, Mint, Bigint and Double). |
| 406 // Note that instance is not Smi (checked above). | 408 // Note that instance is not Smi (checked above). |
| 407 if (type.IsSubtypeOf( | 409 if (type.IsSubtypeOf( |
| 408 Type::Handle(zone(), Type::Number()), NULL, Heap::kOld)) { | 410 Type::Handle(zone(), Type::Number()), NULL, NULL, Heap::kOld)) { |
| 409 GenerateNumberTypeCheck( | 411 GenerateNumberTypeCheck( |
| 410 kClassIdReg, type, is_instance_lbl, is_not_instance_lbl); | 412 kClassIdReg, type, is_instance_lbl, is_not_instance_lbl); |
| 411 return false; | 413 return false; |
| 412 } | 414 } |
| 413 if (type.IsStringType()) { | 415 if (type.IsStringType()) { |
| 414 GenerateStringTypeCheck(kClassIdReg, is_instance_lbl, is_not_instance_lbl); | 416 GenerateStringTypeCheck(kClassIdReg, is_instance_lbl, is_not_instance_lbl); |
| 415 return false; | 417 return false; |
| 416 } | 418 } |
| 417 // Otherwise fallthrough. | 419 // Otherwise fallthrough. |
| 418 return true; | 420 return true; |
| (...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1936 DRegister dreg = EvenDRegisterOf(reg); | 1938 DRegister dreg = EvenDRegisterOf(reg); |
| 1937 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); | 1939 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); |
| 1938 } | 1940 } |
| 1939 | 1941 |
| 1940 | 1942 |
| 1941 #undef __ | 1943 #undef __ |
| 1942 | 1944 |
| 1943 } // namespace dart | 1945 } // namespace dart |
| 1944 | 1946 |
| 1945 #endif // defined TARGET_ARCH_ARM | 1947 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |