| 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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 intptr_t token_pos, | 499 intptr_t token_pos, |
| 500 const AbstractType& type, | 500 const AbstractType& type, |
| 501 Label* is_instance_lbl, | 501 Label* is_instance_lbl, |
| 502 Label* is_not_instance_lbl) { | 502 Label* is_not_instance_lbl) { |
| 503 __ Comment("InlineInstanceof"); | 503 __ Comment("InlineInstanceof"); |
| 504 if (type.IsVoidType()) { | 504 if (type.IsVoidType()) { |
| 505 // A non-null value is returned from a void function, which will result in a | 505 // A non-null value is returned from a void function, which will result in a |
| 506 // type error. A null value is handled prior to executing this inline code. | 506 // type error. A null value is handled prior to executing this inline code. |
| 507 return SubtypeTestCache::null(); | 507 return SubtypeTestCache::null(); |
| 508 } | 508 } |
| 509 if (TypeCheckAsClassEquality(type)) { | |
| 510 const intptr_t type_cid = Class::Handle(type.type_class()).id(); | |
| 511 const Register kInstanceReg = RAX; | |
| 512 __ testq(kInstanceReg, Immediate(kSmiTagMask)); | |
| 513 if (type_cid == kSmiCid) { | |
| 514 __ j(ZERO, is_instance_lbl); | |
| 515 } else { | |
| 516 __ j(ZERO, is_not_instance_lbl); | |
| 517 __ CompareClassId(kInstanceReg, type_cid); | |
| 518 __ j(EQUAL, is_instance_lbl); | |
| 519 } | |
| 520 __ jmp(is_not_instance_lbl); | |
| 521 return SubtypeTestCache::null(); | |
| 522 } | |
| 523 if (type.IsInstantiated()) { | 509 if (type.IsInstantiated()) { |
| 524 const Class& type_class = Class::ZoneHandle(type.type_class()); | 510 const Class& type_class = Class::ZoneHandle(type.type_class()); |
| 525 // A class equality check is only applicable with a dst type of a | 511 // A class equality check is only applicable with a dst type of a |
| 526 // non-parameterized class, non-signature class, or with a raw dst type of | 512 // non-parameterized class, non-signature class, or with a raw dst type of |
| 527 // a parameterized class. | 513 // a parameterized class. |
| 528 if (type_class.IsSignatureClass() || (type_class.NumTypeArguments() > 0)) { | 514 if (type_class.IsSignatureClass() || (type_class.NumTypeArguments() > 0)) { |
| 529 return GenerateInstantiatedTypeWithArgumentsTest(token_pos, | 515 return GenerateInstantiatedTypeWithArgumentsTest(token_pos, |
| 530 type, | 516 type, |
| 531 is_instance_lbl, | 517 is_instance_lbl, |
| 532 is_not_instance_lbl); | 518 is_not_instance_lbl); |
| (...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1852 __ movups(reg, Address(RSP, 0)); | 1838 __ movups(reg, Address(RSP, 0)); |
| 1853 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); | 1839 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); |
| 1854 } | 1840 } |
| 1855 | 1841 |
| 1856 | 1842 |
| 1857 #undef __ | 1843 #undef __ |
| 1858 | 1844 |
| 1859 } // namespace dart | 1845 } // namespace dart |
| 1860 | 1846 |
| 1861 #endif // defined TARGET_ARCH_X64 | 1847 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |