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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 // Clobbers: T0, T1, T2 | 513 // Clobbers: T0, T1, T2 |
514 // Note that this inlined code must be followed by the runtime_call code, as it | 514 // Note that this inlined code must be followed by the runtime_call code, as it |
515 // may fall through to it. Otherwise, this inline code will jump to the label | 515 // may fall through to it. Otherwise, this inline code will jump to the label |
516 // is_instance or to the label is_not_instance. | 516 // is_instance or to the label is_not_instance. |
517 RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof( | 517 RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof( |
518 TokenPosition token_pos, | 518 TokenPosition token_pos, |
519 const AbstractType& type, | 519 const AbstractType& type, |
520 Label* is_instance_lbl, | 520 Label* is_instance_lbl, |
521 Label* is_not_instance_lbl) { | 521 Label* is_not_instance_lbl) { |
522 __ Comment("InlineInstanceof"); | 522 __ Comment("InlineInstanceof"); |
| 523 if (type.IsVoidType()) { |
| 524 // A non-null value is returned from a void function, which will result in a |
| 525 // type error. A null value is handled prior to executing this inline code. |
| 526 return SubtypeTestCache::null(); |
| 527 } |
523 if (type.IsInstantiated()) { | 528 if (type.IsInstantiated()) { |
524 const Class& type_class = Class::ZoneHandle(zone(), type.type_class()); | 529 const Class& type_class = Class::ZoneHandle(zone(), type.type_class()); |
525 // A class equality check is only applicable with a dst type (not a | 530 // A class equality check is only applicable with a dst type (not a |
526 // function type) of a non-parameterized class or with a raw dst type of | 531 // function type) of a non-parameterized class or with a raw dst type of |
527 // a parameterized class. | 532 // a parameterized class. |
528 if (type.IsFunctionType() || (type_class.NumTypeArguments() > 0)) { | 533 if (type.IsFunctionType() || (type_class.NumTypeArguments() > 0)) { |
529 return GenerateInstantiatedTypeWithArgumentsTest( | 534 return GenerateInstantiatedTypeWithArgumentsTest( |
530 token_pos, type, is_instance_lbl, is_not_instance_lbl); | 535 token_pos, type, is_instance_lbl, is_not_instance_lbl); |
531 // Fall through to runtime call. | 536 // Fall through to runtime call. |
532 } | 537 } |
(...skipping 22 matching lines...) Expand all Loading... |
555 // - A0: object. | 560 // - A0: object. |
556 // - A1: instantiator type arguments or raw_null. | 561 // - A1: instantiator type arguments or raw_null. |
557 // - A2: function type arguments or raw_null. | 562 // - A2: function type arguments or raw_null. |
558 // Returns: | 563 // Returns: |
559 // - true or false in V0. | 564 // - true or false in V0. |
560 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, | 565 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, |
561 intptr_t deopt_id, | 566 intptr_t deopt_id, |
562 const AbstractType& type, | 567 const AbstractType& type, |
563 LocationSummary* locs) { | 568 LocationSummary* locs) { |
564 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); | 569 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); |
565 ASSERT(!type.IsObjectType() && !type.IsDynamicType() && !type.IsVoidType()); | 570 ASSERT(!type.IsObjectType() && !type.IsDynamicType()); |
566 | 571 |
567 // Preserve instantiator type arguments (A1) and function type arguments (A2). | 572 // Preserve instantiator type arguments (A1) and function type arguments (A2). |
568 __ addiu(SP, SP, Immediate(-2 * kWordSize)); | 573 __ addiu(SP, SP, Immediate(-2 * kWordSize)); |
569 __ sw(A1, Address(SP, 1 * kWordSize)); | 574 __ sw(A1, Address(SP, 1 * kWordSize)); |
570 __ sw(A2, Address(SP, 0 * kWordSize)); | 575 __ sw(A2, Address(SP, 0 * kWordSize)); |
571 | 576 |
572 Label is_instance, is_not_instance; | 577 Label is_instance, is_not_instance; |
573 // If type is instantiated and non-parameterized, we can inline code | 578 // If type is instantiated and non-parameterized, we can inline code |
574 // checking whether the tested instance is a Smi. | 579 // checking whether the tested instance is a Smi. |
575 if (type.IsInstantiated()) { | 580 if (type.IsInstantiated()) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 intptr_t deopt_id, | 646 intptr_t deopt_id, |
642 const AbstractType& dst_type, | 647 const AbstractType& dst_type, |
643 const String& dst_name, | 648 const String& dst_name, |
644 LocationSummary* locs) { | 649 LocationSummary* locs) { |
645 __ Comment("AssertAssignable"); | 650 __ Comment("AssertAssignable"); |
646 ASSERT(!token_pos.IsClassifying()); | 651 ASSERT(!token_pos.IsClassifying()); |
647 ASSERT(!dst_type.IsNull()); | 652 ASSERT(!dst_type.IsNull()); |
648 ASSERT(dst_type.IsFinalized()); | 653 ASSERT(dst_type.IsFinalized()); |
649 // Assignable check is skipped in FlowGraphBuilder, not here. | 654 // Assignable check is skipped in FlowGraphBuilder, not here. |
650 ASSERT(dst_type.IsMalformedOrMalbounded() || | 655 ASSERT(dst_type.IsMalformedOrMalbounded() || |
651 (!dst_type.IsDynamicType() && !dst_type.IsObjectType() && | 656 (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); |
652 !dst_type.IsVoidType())); | |
653 | 657 |
654 // Preserve instantiator type arguments (A1) and function type arguments (A2). | 658 // Preserve instantiator type arguments (A1) and function type arguments (A2). |
655 __ addiu(SP, SP, Immediate(-2 * kWordSize)); | 659 __ addiu(SP, SP, Immediate(-2 * kWordSize)); |
656 __ sw(A1, Address(SP, 1 * kWordSize)); | 660 __ sw(A1, Address(SP, 1 * kWordSize)); |
657 __ sw(A2, Address(SP, 0 * kWordSize)); | 661 __ sw(A2, Address(SP, 0 * kWordSize)); |
658 | 662 |
659 // A null object is always assignable and is returned as result. | 663 // A null object is always assignable and is returned as result. |
660 Label is_assignable, runtime_call; | 664 Label is_assignable, runtime_call; |
661 | 665 |
662 __ BranchEqual(A0, Object::null_object(), &is_assignable); | 666 __ BranchEqual(A0, Object::null_object(), &is_assignable); |
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1811 __ AddImmediate(SP, kDoubleSize); | 1815 __ AddImmediate(SP, kDoubleSize); |
1812 } | 1816 } |
1813 | 1817 |
1814 | 1818 |
1815 #undef __ | 1819 #undef __ |
1816 | 1820 |
1817 | 1821 |
1818 } // namespace dart | 1822 } // namespace dart |
1819 | 1823 |
1820 #endif // defined TARGET_ARCH_MIPS | 1824 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |