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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 // optional function type arguments in R1. | 525 // optional function type arguments in R1. |
526 // Note that this inlined code must be followed by the runtime_call code, as it | 526 // Note that this inlined code must be followed by the runtime_call code, as it |
527 // may fall through to it. Otherwise, this inline code will jump to the label | 527 // may fall through to it. Otherwise, this inline code will jump to the label |
528 // is_instance or to the label is_not_instance. | 528 // is_instance or to the label is_not_instance. |
529 RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof( | 529 RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof( |
530 TokenPosition token_pos, | 530 TokenPosition token_pos, |
531 const AbstractType& type, | 531 const AbstractType& type, |
532 Label* is_instance_lbl, | 532 Label* is_instance_lbl, |
533 Label* is_not_instance_lbl) { | 533 Label* is_not_instance_lbl) { |
534 __ Comment("InlineInstanceof"); | 534 __ Comment("InlineInstanceof"); |
| 535 if (type.IsVoidType()) { |
| 536 // A non-null value is returned from a void function, which will result in a |
| 537 // type error. A null value is handled prior to executing this inline code. |
| 538 return SubtypeTestCache::null(); |
| 539 } |
535 if (type.IsInstantiated()) { | 540 if (type.IsInstantiated()) { |
536 const Class& type_class = Class::ZoneHandle(zone(), type.type_class()); | 541 const Class& type_class = Class::ZoneHandle(zone(), type.type_class()); |
537 // A class equality check is only applicable with a dst type (not a | 542 // A class equality check is only applicable with a dst type (not a |
538 // function type) of a non-parameterized class or with a raw dst type of | 543 // function type) of a non-parameterized class or with a raw dst type of |
539 // a parameterized class. | 544 // a parameterized class. |
540 if (type.IsFunctionType() || (type_class.NumTypeArguments() > 0)) { | 545 if (type.IsFunctionType() || (type_class.NumTypeArguments() > 0)) { |
541 return GenerateInstantiatedTypeWithArgumentsTest( | 546 return GenerateInstantiatedTypeWithArgumentsTest( |
542 token_pos, type, is_instance_lbl, is_not_instance_lbl); | 547 token_pos, type, is_instance_lbl, is_not_instance_lbl); |
543 // Fall through to runtime call. | 548 // Fall through to runtime call. |
544 } | 549 } |
(...skipping 22 matching lines...) Expand all Loading... |
567 // - R0: object. | 572 // - R0: object. |
568 // - R2: instantiator type arguments or raw_null. | 573 // - R2: instantiator type arguments or raw_null. |
569 // - R1: function type arguments or raw_null. | 574 // - R1: function type arguments or raw_null. |
570 // Returns: | 575 // Returns: |
571 // - true or false in R0. | 576 // - true or false in R0. |
572 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, | 577 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, |
573 intptr_t deopt_id, | 578 intptr_t deopt_id, |
574 const AbstractType& type, | 579 const AbstractType& type, |
575 LocationSummary* locs) { | 580 LocationSummary* locs) { |
576 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); | 581 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); |
577 ASSERT(!type.IsObjectType() && !type.IsDynamicType() && !type.IsVoidType()); | 582 ASSERT(!type.IsObjectType() && !type.IsDynamicType()); |
578 const Register kInstantiatorTypeArgumentsReg = R2; | 583 const Register kInstantiatorTypeArgumentsReg = R2; |
579 const Register kFunctionTypeArgumentsReg = R1; | 584 const Register kFunctionTypeArgumentsReg = R1; |
580 __ PushList((1 << kInstantiatorTypeArgumentsReg) | | 585 __ PushList((1 << kInstantiatorTypeArgumentsReg) | |
581 (1 << kFunctionTypeArgumentsReg)); | 586 (1 << kFunctionTypeArgumentsReg)); |
582 Label is_instance, is_not_instance; | 587 Label is_instance, is_not_instance; |
583 // If type is instantiated and non-parameterized, we can inline code | 588 // If type is instantiated and non-parameterized, we can inline code |
584 // checking whether the tested instance is a Smi. | 589 // checking whether the tested instance is a Smi. |
585 if (type.IsInstantiated()) { | 590 if (type.IsInstantiated()) { |
586 // A null object is only an instance of Null, Object, and dynamic. | 591 // A null object is only an instance of Null, Object, and dynamic. |
587 // Object and dynamic have already been checked above (if the type is | 592 // Object and dynamic have already been checked above (if the type is |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos, | 651 void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos, |
647 intptr_t deopt_id, | 652 intptr_t deopt_id, |
648 const AbstractType& dst_type, | 653 const AbstractType& dst_type, |
649 const String& dst_name, | 654 const String& dst_name, |
650 LocationSummary* locs) { | 655 LocationSummary* locs) { |
651 ASSERT(!token_pos.IsClassifying()); | 656 ASSERT(!token_pos.IsClassifying()); |
652 ASSERT(!dst_type.IsNull()); | 657 ASSERT(!dst_type.IsNull()); |
653 ASSERT(dst_type.IsFinalized()); | 658 ASSERT(dst_type.IsFinalized()); |
654 // Assignable check is skipped in FlowGraphBuilder, not here. | 659 // Assignable check is skipped in FlowGraphBuilder, not here. |
655 ASSERT(dst_type.IsMalformedOrMalbounded() || | 660 ASSERT(dst_type.IsMalformedOrMalbounded() || |
656 (!dst_type.IsDynamicType() && !dst_type.IsObjectType() && | 661 (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); |
657 !dst_type.IsVoidType())); | |
658 const Register kInstantiatorTypeArgumentsReg = R2; | 662 const Register kInstantiatorTypeArgumentsReg = R2; |
659 const Register kFunctionTypeArgumentsReg = R1; | 663 const Register kFunctionTypeArgumentsReg = R1; |
660 __ PushList((1 << kInstantiatorTypeArgumentsReg) | | 664 __ PushList((1 << kInstantiatorTypeArgumentsReg) | |
661 (1 << kFunctionTypeArgumentsReg)); | 665 (1 << kFunctionTypeArgumentsReg)); |
662 // A null object is always assignable and is returned as result. | 666 // A null object is always assignable and is returned as result. |
663 Label is_assignable, runtime_call; | 667 Label is_assignable, runtime_call; |
664 __ CompareObject(R0, Object::null_object()); | 668 __ CompareObject(R0, Object::null_object()); |
665 __ b(&is_assignable, EQ); | 669 __ b(&is_assignable, EQ); |
666 | 670 |
667 // Generate throw new TypeError() if the type is malformed or malbounded. | 671 // Generate throw new TypeError() if the type is malformed or malbounded. |
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1828 DRegister dreg = EvenDRegisterOf(reg); | 1832 DRegister dreg = EvenDRegisterOf(reg); |
1829 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); | 1833 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); |
1830 } | 1834 } |
1831 | 1835 |
1832 | 1836 |
1833 #undef __ | 1837 #undef __ |
1834 | 1838 |
1835 } // namespace dart | 1839 } // namespace dart |
1836 | 1840 |
1837 #endif // defined TARGET_ARCH_ARM | 1841 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |