| 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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // Clobbers T0. | 217 // Clobbers T0. |
| 218 RawSubtypeTestCache* | 218 RawSubtypeTestCache* |
| 219 FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest( | 219 FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest( |
| 220 intptr_t token_pos, | 220 intptr_t token_pos, |
| 221 const AbstractType& type, | 221 const AbstractType& type, |
| 222 Label* is_instance_lbl, | 222 Label* is_instance_lbl, |
| 223 Label* is_not_instance_lbl) { | 223 Label* is_not_instance_lbl) { |
| 224 __ Comment("InstantiatedTypeWithArgumentsTest"); | 224 __ Comment("InstantiatedTypeWithArgumentsTest"); |
| 225 ASSERT(type.IsInstantiated()); | 225 ASSERT(type.IsInstantiated()); |
| 226 const Class& type_class = Class::ZoneHandle(type.type_class()); | 226 const Class& type_class = Class::ZoneHandle(type.type_class()); |
| 227 ASSERT(type_class.HasTypeArguments() || type_class.IsSignatureClass()); | 227 ASSERT((type_class.NumTypeArguments() > 0) || type_class.IsSignatureClass()); |
| 228 const Register kInstanceReg = A0; | 228 const Register kInstanceReg = A0; |
| 229 Error& malformed_error = Error::Handle(); | 229 Error& malformed_error = Error::Handle(); |
| 230 const Type& int_type = Type::Handle(Type::IntType()); | 230 const Type& int_type = Type::Handle(Type::IntType()); |
| 231 const bool smi_is_ok = int_type.IsSubtypeOf(type, &malformed_error); | 231 const bool smi_is_ok = int_type.IsSubtypeOf(type, &malformed_error); |
| 232 // Malformed type should have been handled at graph construction time. | 232 // Malformed type should have been handled at graph construction time. |
| 233 ASSERT(smi_is_ok || malformed_error.IsNull()); | 233 ASSERT(smi_is_ok || malformed_error.IsNull()); |
| 234 __ andi(CMPRES, kInstanceReg, Immediate(kSmiTagMask)); | 234 __ andi(CMPRES, kInstanceReg, Immediate(kSmiTagMask)); |
| 235 if (smi_is_ok) { | 235 if (smi_is_ok) { |
| 236 __ beq(CMPRES, ZR, is_instance_lbl); | 236 __ beq(CMPRES, ZR, is_instance_lbl); |
| 237 } else { | 237 } else { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 // Returns true if there is a fallthrough. | 304 // Returns true if there is a fallthrough. |
| 305 bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest( | 305 bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest( |
| 306 intptr_t token_pos, | 306 intptr_t token_pos, |
| 307 const AbstractType& type, | 307 const AbstractType& type, |
| 308 Label* is_instance_lbl, | 308 Label* is_instance_lbl, |
| 309 Label* is_not_instance_lbl) { | 309 Label* is_not_instance_lbl) { |
| 310 __ TraceSimMsg("InstantiatedTypeNoArgumentsTest"); | 310 __ TraceSimMsg("InstantiatedTypeNoArgumentsTest"); |
| 311 __ Comment("InstantiatedTypeNoArgumentsTest"); | 311 __ Comment("InstantiatedTypeNoArgumentsTest"); |
| 312 ASSERT(type.IsInstantiated()); | 312 ASSERT(type.IsInstantiated()); |
| 313 const Class& type_class = Class::Handle(type.type_class()); | 313 const Class& type_class = Class::Handle(type.type_class()); |
| 314 ASSERT(!type_class.HasTypeArguments()); | 314 ASSERT(type_class.NumTypeArguments() == 0); |
| 315 | 315 |
| 316 const Register kInstanceReg = A0; | 316 const Register kInstanceReg = A0; |
| 317 __ andi(T0, A0, Immediate(kSmiTagMask)); | 317 __ andi(T0, A0, Immediate(kSmiTagMask)); |
| 318 // If instance is Smi, check directly. | 318 // If instance is Smi, check directly. |
| 319 const Class& smi_class = Class::Handle(Smi::Class()); | 319 const Class& smi_class = Class::Handle(Smi::Class()); |
| 320 if (smi_class.IsSubtypeOf(TypeArguments::Handle(), | 320 if (smi_class.IsSubtypeOf(TypeArguments::Handle(), |
| 321 type_class, | 321 type_class, |
| 322 TypeArguments::Handle(), | 322 TypeArguments::Handle(), |
| 323 NULL)) { | 323 NULL)) { |
| 324 __ beq(T0, ZR, is_instance_lbl); | 324 __ beq(T0, ZR, is_instance_lbl); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 __ BranchEqual(T0, type_cid, is_instance_lbl); | 507 __ BranchEqual(T0, type_cid, is_instance_lbl); |
| 508 } | 508 } |
| 509 __ b(is_not_instance_lbl); | 509 __ b(is_not_instance_lbl); |
| 510 return SubtypeTestCache::null(); | 510 return SubtypeTestCache::null(); |
| 511 } | 511 } |
| 512 if (type.IsInstantiated()) { | 512 if (type.IsInstantiated()) { |
| 513 const Class& type_class = Class::ZoneHandle(type.type_class()); | 513 const Class& type_class = Class::ZoneHandle(type.type_class()); |
| 514 // A class equality check is only applicable with a dst type of a | 514 // A class equality check is only applicable with a dst type of a |
| 515 // non-parameterized class, non-signature class, or with a raw dst type of | 515 // non-parameterized class, non-signature class, or with a raw dst type of |
| 516 // a parameterized class. | 516 // a parameterized class. |
| 517 if (type_class.IsSignatureClass() || type_class.HasTypeArguments()) { | 517 if (type_class.IsSignatureClass() || (type_class.NumTypeArguments() > 0)) { |
| 518 return GenerateInstantiatedTypeWithArgumentsTest(token_pos, | 518 return GenerateInstantiatedTypeWithArgumentsTest(token_pos, |
| 519 type, | 519 type, |
| 520 is_instance_lbl, | 520 is_instance_lbl, |
| 521 is_not_instance_lbl); | 521 is_not_instance_lbl); |
| 522 // Fall through to runtime call. | 522 // Fall through to runtime call. |
| 523 } | 523 } |
| 524 const bool has_fall_through = | 524 const bool has_fall_through = |
| 525 GenerateInstantiatedTypeNoArgumentsTest(token_pos, | 525 GenerateInstantiatedTypeNoArgumentsTest(token_pos, |
| 526 type, | 526 type, |
| 527 is_instance_lbl, | 527 is_instance_lbl, |
| (...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2006 __ AddImmediate(SP, kDoubleSize); | 2006 __ AddImmediate(SP, kDoubleSize); |
| 2007 } | 2007 } |
| 2008 | 2008 |
| 2009 | 2009 |
| 2010 #undef __ | 2010 #undef __ |
| 2011 | 2011 |
| 2012 | 2012 |
| 2013 } // namespace dart | 2013 } // namespace dart |
| 2014 | 2014 |
| 2015 #endif // defined TARGET_ARCH_MIPS | 2015 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |