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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 // Clobbers: T0, T1, T2 | 493 // Clobbers: T0, T1, T2 |
494 // Note that this inlined code must be followed by the runtime_call code, as it | 494 // Note that this inlined code must be followed by the runtime_call code, as it |
495 // may fall through to it. Otherwise, this inline code will jump to the label | 495 // may fall through to it. Otherwise, this inline code will jump to the label |
496 // is_instance or to the label is_not_instance. | 496 // is_instance or to the label is_not_instance. |
497 RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof( | 497 RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof( |
498 TokenPosition token_pos, | 498 TokenPosition token_pos, |
499 const AbstractType& type, | 499 const AbstractType& type, |
500 Label* is_instance_lbl, | 500 Label* is_instance_lbl, |
501 Label* is_not_instance_lbl) { | 501 Label* is_not_instance_lbl) { |
502 __ Comment("InlineInstanceof"); | 502 __ Comment("InlineInstanceof"); |
503 if (type.IsVoidType()) { | |
504 // A non-null value is returned from a void function, which will result in a | |
505 // type error. A null value is handled prior to executing this inline code. | |
506 return SubtypeTestCache::null(); | |
507 } | |
508 if (type.IsInstantiated()) { | 503 if (type.IsInstantiated()) { |
509 const Class& type_class = Class::ZoneHandle(zone(), type.type_class()); | 504 const Class& type_class = Class::ZoneHandle(zone(), type.type_class()); |
510 // A class equality check is only applicable with a dst type (not a | 505 // A class equality check is only applicable with a dst type (not a |
511 // function type) of a non-parameterized class or with a raw dst type of | 506 // function type) of a non-parameterized class or with a raw dst type of |
512 // a parameterized class. | 507 // a parameterized class. |
513 if (type.IsFunctionType() || (type_class.NumTypeArguments() > 0)) { | 508 if (type.IsFunctionType() || (type_class.NumTypeArguments() > 0)) { |
514 return GenerateInstantiatedTypeWithArgumentsTest( | 509 return GenerateInstantiatedTypeWithArgumentsTest( |
515 token_pos, type, is_instance_lbl, is_not_instance_lbl); | 510 token_pos, type, is_instance_lbl, is_not_instance_lbl); |
516 // Fall through to runtime call. | 511 // Fall through to runtime call. |
517 } | 512 } |
(...skipping 22 matching lines...) Expand all Loading... |
540 // - A0: object. | 535 // - A0: object. |
541 // - A1: instantiator type arguments or raw_null. | 536 // - A1: instantiator type arguments or raw_null. |
542 // Returns: | 537 // Returns: |
543 // - true or false in V0. | 538 // - true or false in V0. |
544 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, | 539 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, |
545 intptr_t deopt_id, | 540 intptr_t deopt_id, |
546 const AbstractType& type, | 541 const AbstractType& type, |
547 bool negate_result, | 542 bool negate_result, |
548 LocationSummary* locs) { | 543 LocationSummary* locs) { |
549 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); | 544 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); |
550 ASSERT(!type.IsObjectType() && !type.IsDynamicType()); | 545 ASSERT(!type.IsObjectType() && !type.IsDynamicType() && !type.IsVoidType()); |
551 | 546 |
552 // Preserve instantiator type arguments (A1). | 547 // Preserve instantiator type arguments (A1). |
553 __ addiu(SP, SP, Immediate(-1 * kWordSize)); | 548 __ addiu(SP, SP, Immediate(-1 * kWordSize)); |
554 __ sw(A1, Address(SP, 0 * kWordSize)); | 549 __ sw(A1, Address(SP, 0 * kWordSize)); |
555 | 550 |
556 Label is_instance, is_not_instance; | 551 Label is_instance, is_not_instance; |
557 // If type is instantiated and non-parameterized, we can inline code | 552 // If type is instantiated and non-parameterized, we can inline code |
558 // checking whether the tested instance is a Smi. | 553 // checking whether the tested instance is a Smi. |
559 if (type.IsInstantiated()) { | 554 if (type.IsInstantiated()) { |
560 // A null object is only an instance of Null, Object, and dynamic. | 555 // A null object is only an instance of Null, Object, and dynamic. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 intptr_t deopt_id, | 626 intptr_t deopt_id, |
632 const AbstractType& dst_type, | 627 const AbstractType& dst_type, |
633 const String& dst_name, | 628 const String& dst_name, |
634 LocationSummary* locs) { | 629 LocationSummary* locs) { |
635 __ Comment("AssertAssignable"); | 630 __ Comment("AssertAssignable"); |
636 ASSERT(!token_pos.IsClassifying()); | 631 ASSERT(!token_pos.IsClassifying()); |
637 ASSERT(!dst_type.IsNull()); | 632 ASSERT(!dst_type.IsNull()); |
638 ASSERT(dst_type.IsFinalized()); | 633 ASSERT(dst_type.IsFinalized()); |
639 // Assignable check is skipped in FlowGraphBuilder, not here. | 634 // Assignable check is skipped in FlowGraphBuilder, not here. |
640 ASSERT(dst_type.IsMalformedOrMalbounded() || | 635 ASSERT(dst_type.IsMalformedOrMalbounded() || |
641 (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); | 636 (!dst_type.IsDynamicType() && !dst_type.IsObjectType() && |
| 637 !dst_type.IsVoidType())); |
642 // Preserve instantiator type arguments. | 638 // Preserve instantiator type arguments. |
643 __ addiu(SP, SP, Immediate(-1 * kWordSize)); | 639 __ addiu(SP, SP, Immediate(-1 * kWordSize)); |
644 __ sw(A1, Address(SP, 0 * kWordSize)); | 640 __ sw(A1, Address(SP, 0 * kWordSize)); |
645 | 641 |
646 // A null object is always assignable and is returned as result. | 642 // A null object is always assignable and is returned as result. |
647 Label is_assignable, runtime_call; | 643 Label is_assignable, runtime_call; |
648 | 644 |
649 __ BranchEqual(A0, Object::null_object(), &is_assignable); | 645 __ BranchEqual(A0, Object::null_object(), &is_assignable); |
650 __ delay_slot()->sw(A1, Address(SP, 0 * kWordSize)); | 646 __ delay_slot()->sw(A1, Address(SP, 0 * kWordSize)); |
651 | 647 |
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1869 __ AddImmediate(SP, kDoubleSize); | 1865 __ AddImmediate(SP, kDoubleSize); |
1870 } | 1866 } |
1871 | 1867 |
1872 | 1868 |
1873 #undef __ | 1869 #undef __ |
1874 | 1870 |
1875 | 1871 |
1876 } // namespace dart | 1872 } // namespace dart |
1877 | 1873 |
1878 #endif // defined TARGET_ARCH_MIPS | 1874 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |