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_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 "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 = RAX; |
| 398 __ testq(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); |
| 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 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1395 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { | 1409 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { |
1396 __ Exchange(mem1, mem2); | 1410 __ Exchange(mem1, mem2); |
1397 } | 1411 } |
1398 | 1412 |
1399 | 1413 |
1400 #undef __ | 1414 #undef __ |
1401 | 1415 |
1402 } // namespace dart | 1416 } // namespace dart |
1403 | 1417 |
1404 #endif // defined TARGET_ARCH_X64 | 1418 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |