| 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof( | 385 RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof( |
| 386 intptr_t token_pos, | 386 intptr_t token_pos, |
| 387 const AbstractType& type, | 387 const AbstractType& type, |
| 388 Label* is_instance_lbl, | 388 Label* is_instance_lbl, |
| 389 Label* is_not_instance_lbl) { | 389 Label* is_not_instance_lbl) { |
| 390 if (type.IsVoidType()) { | 390 if (type.IsVoidType()) { |
| 391 // A non-null value is returned from a void function, which will result in a | 391 // A non-null value is returned from a void function, which will result in a |
| 392 // type error. A null value is handled prior to executing this inline code. | 392 // type error. A null value is handled prior to executing this inline code. |
| 393 return SubtypeTestCache::null(); | 393 return SubtypeTestCache::null(); |
| 394 } | 394 } |
| 395 if (TypeCheckAsClassEquality(type)) { |
| 396 const intptr_t type_cid = Class::Handle(type.type_class()).id(); |
| 397 const Register kInstanceReg = EAX; |
| 398 __ testl(kInstanceReg, Immediate(kSmiTagMask)); |
| 399 if (type_cid == kSmiCid) { |
| 400 __ j(ZERO, is_instance_lbl); |
| 401 } else { |
| 402 __ j(ZERO, is_not_instance_lbl); |
| 403 __ CompareClassId(kInstanceReg, type_cid, EDI); |
| 404 __ j(EQUAL, is_instance_lbl); |
| 405 } |
| 406 __ jmp(is_not_instance_lbl); |
| 407 return SubtypeTestCache::null(); |
| 408 } |
| 395 if (type.IsInstantiated()) { | 409 if (type.IsInstantiated()) { |
| 396 const Class& type_class = Class::ZoneHandle(type.type_class()); | 410 const Class& type_class = Class::ZoneHandle(type.type_class()); |
| 397 // A Smi object cannot be the instance of a parameterized class. | 411 // A Smi object cannot be the instance of a parameterized class. |
| 398 // A class equality check is only applicable with a dst type of a | 412 // A class equality check is only applicable with a dst type of a |
| 399 // non-parameterized class or with a raw dst type of a parameterized class. | 413 // non-parameterized class or with a raw dst type of a parameterized class. |
| 400 if (type_class.HasTypeArguments()) { | 414 if (type_class.HasTypeArguments()) { |
| 401 return GenerateInstantiatedTypeWithArgumentsTest(token_pos, | 415 return GenerateInstantiatedTypeWithArgumentsTest(token_pos, |
| 402 type, | 416 type, |
| 403 is_instance_lbl, | 417 is_instance_lbl, |
| 404 is_not_instance_lbl); | 418 is_not_instance_lbl); |
| (...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1417 __ popl(ECX); | 1431 __ popl(ECX); |
| 1418 __ popl(EAX); | 1432 __ popl(EAX); |
| 1419 } | 1433 } |
| 1420 | 1434 |
| 1421 | 1435 |
| 1422 #undef __ | 1436 #undef __ |
| 1423 | 1437 |
| 1424 } // namespace dart | 1438 } // namespace dart |
| 1425 | 1439 |
| 1426 #endif // defined TARGET_ARCH_IA32 | 1440 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |