| 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 // TODO(regis): Introduce and use TypeParameter::Cast(). | 315 const TypeParameter& type_param = TypeParameter::Cast(type); |
| 316 const TypeParameter* type_param = | |
| 317 reinterpret_cast<const TypeParameter*>(&type); | |
| 318 // Load instantiator (or null) and instantiator type arguments on stack. | 316 // Load instantiator (or null) and instantiator type arguments on stack. |
| 319 __ movl(EDX, Address(ESP, 0)); // Get instantiator type arguments. | 317 __ movl(EDX, Address(ESP, 0)); // Get instantiator type arguments. |
| 320 // EDX: instantiator type arguments. | 318 // EDX: instantiator type arguments. |
| 321 // Check if type argument is Dynamic. | 319 // Check if type argument is Dynamic. |
| 322 __ cmpl(EDX, raw_null); | 320 __ cmpl(EDX, raw_null); |
| 323 __ j(EQUAL, is_instance_lbl); | 321 __ j(EQUAL, is_instance_lbl); |
| 324 // Can handle only type arguments that are instances of TypeArguments. | 322 // Can handle only type arguments that are instances of TypeArguments. |
| 325 // (runtime checks canonicalize type arguments). | 323 // (runtime checks canonicalize type arguments). |
| 326 Label fall_through; | 324 Label fall_through; |
| 327 __ CompareClassId(EDX, kTypeArguments, EDI); | 325 __ CompareClassId(EDX, kTypeArguments, EDI); |
| 328 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); | 326 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); |
| 329 __ movl(EDI, | 327 __ movl(EDI, |
| 330 FieldAddress(EDX, TypeArguments::type_at_offset(type_param->index()))); | 328 FieldAddress(EDX, TypeArguments::type_at_offset(type_param.index()))); |
| 331 // EDI: concrete type of type. | 329 // EDI: concrete type of type. |
| 332 // Check if type argument is dynamic. | 330 // Check if type argument is dynamic. |
| 333 __ CompareObject(EDI, Type::ZoneHandle(Type::DynamicType())); | 331 __ CompareObject(EDI, Type::ZoneHandle(Type::DynamicType())); |
| 334 __ j(EQUAL, is_instance_lbl); | 332 __ j(EQUAL, is_instance_lbl); |
| 335 __ cmpl(EDI, raw_null); | 333 __ cmpl(EDI, raw_null); |
| 336 __ j(EQUAL, is_instance_lbl); | 334 __ j(EQUAL, is_instance_lbl); |
| 337 const Type& object_type = Type::ZoneHandle(Type::ObjectType()); | 335 const Type& object_type = Type::ZoneHandle(Type::ObjectType()); |
| 338 __ CompareObject(EDI, object_type); | 336 __ CompareObject(EDI, object_type); |
| 339 __ j(EQUAL, is_instance_lbl); | 337 __ j(EQUAL, is_instance_lbl); |
| 340 | 338 |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1076 __ cvtsi2sd(result, temp); | 1074 __ cvtsi2sd(result, temp); |
| 1077 __ Bind(&done); | 1075 __ Bind(&done); |
| 1078 } | 1076 } |
| 1079 | 1077 |
| 1080 | 1078 |
| 1081 #undef __ | 1079 #undef __ |
| 1082 | 1080 |
| 1083 } // namespace dart | 1081 } // namespace dart |
| 1084 | 1082 |
| 1085 #endif // defined TARGET_ARCH_IA32 | 1083 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |