| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 intptr_t cid, | 305 intptr_t cid, |
| 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 ASSERT(!type.IsInstantiated()); | 310 ASSERT(!type.IsInstantiated()); |
| 311 // Skip check if destination is a dynamic type. | 311 // Skip check if destination is a dynamic type. |
| 312 const Immediate raw_null = | 312 const Immediate raw_null = |
| 313 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 313 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 314 if (type.IsTypeParameter()) { | 314 if (type.IsTypeParameter()) { |
| 315 // Load instantiator (or null) and instantiator type arguments on stack. | 315 // TODO(regis): Introduce and use TypeParameter::Cast(). |
| 316 const TypeParameter* type_param = |
| 317 reinterpret_cast<const TypeParameter*>(&type); |
| 318 // Load instantiator (or null) and instantiator type arguments on stack. |
| 316 __ movl(EDX, Address(ESP, 0)); // Get instantiator type arguments. | 319 __ movl(EDX, Address(ESP, 0)); // Get instantiator type arguments. |
| 317 // EDX: instantiator type arguments. | 320 // EDX: instantiator type arguments. |
| 318 // Check if type argument is Dynamic. | 321 // Check if type argument is Dynamic. |
| 319 __ cmpl(EDX, raw_null); | 322 __ cmpl(EDX, raw_null); |
| 320 __ j(EQUAL, is_instance_lbl); | 323 __ j(EQUAL, is_instance_lbl); |
| 321 // Can handle only type arguments that are instances of TypeArguments. | 324 // Can handle only type arguments that are instances of TypeArguments. |
| 322 // (runtime checks canonicalize type arguments). | 325 // (runtime checks canonicalize type arguments). |
| 323 Label fall_through; | 326 Label fall_through; |
| 324 __ CompareClassId(EDX, kTypeArguments, EDI); | 327 __ CompareClassId(EDX, kTypeArguments, EDI); |
| 325 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); | 328 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); |
| 326 __ movl(EDI, | 329 __ movl(EDI, |
| 327 FieldAddress(EDX, TypeArguments::type_at_offset(type.Index()))); | 330 FieldAddress(EDX, TypeArguments::type_at_offset(type_param->index()))); |
| 328 // EDI: concrete type of type. | 331 // EDI: concrete type of type. |
| 329 // Check if type argument is dynamic. | 332 // Check if type argument is dynamic. |
| 330 __ CompareObject(EDI, Type::ZoneHandle(Type::DynamicType())); | 333 __ CompareObject(EDI, Type::ZoneHandle(Type::DynamicType())); |
| 331 __ j(EQUAL, is_instance_lbl); | 334 __ j(EQUAL, is_instance_lbl); |
| 332 __ cmpl(EDI, raw_null); | 335 __ cmpl(EDI, raw_null); |
| 333 __ j(EQUAL, is_instance_lbl); | 336 __ j(EQUAL, is_instance_lbl); |
| 334 const Type& object_type = Type::ZoneHandle(Type::ObjectType()); | 337 const Type& object_type = Type::ZoneHandle(Type::ObjectType()); |
| 335 __ CompareObject(EDI, object_type); | 338 __ CompareObject(EDI, object_type); |
| 336 __ j(EQUAL, is_instance_lbl); | 339 __ j(EQUAL, is_instance_lbl); |
| 337 | 340 |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 __ cvtsi2sd(result, temp); | 1076 __ cvtsi2sd(result, temp); |
| 1074 __ Bind(&done); | 1077 __ Bind(&done); |
| 1075 } | 1078 } |
| 1076 | 1079 |
| 1077 | 1080 |
| 1078 #undef __ | 1081 #undef __ |
| 1079 | 1082 |
| 1080 } // namespace dart | 1083 } // namespace dart |
| 1081 | 1084 |
| 1082 #endif // defined TARGET_ARCH_IA32 | 1085 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |