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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 void FlowGraphCompiler::GenerateAssertAssignable(intptr_t token_pos, | 644 void FlowGraphCompiler::GenerateAssertAssignable(intptr_t token_pos, |
645 intptr_t deopt_id, | 645 intptr_t deopt_id, |
646 const AbstractType& dst_type, | 646 const AbstractType& dst_type, |
647 const String& dst_name, | 647 const String& dst_name, |
648 LocationSummary* locs) { | 648 LocationSummary* locs) { |
649 __ TraceSimMsg("AssertAssignable"); | 649 __ TraceSimMsg("AssertAssignable"); |
650 ASSERT(token_pos >= 0); | 650 ASSERT(token_pos >= 0); |
651 ASSERT(!dst_type.IsNull()); | 651 ASSERT(!dst_type.IsNull()); |
652 ASSERT(dst_type.IsFinalized()); | 652 ASSERT(dst_type.IsFinalized()); |
653 // Assignable check is skipped in FlowGraphBuilder, not here. | 653 // Assignable check is skipped in FlowGraphBuilder, not here. |
654 ASSERT(dst_type.IsMalformed() || dst_type.IsMalbounded() || | 654 ASSERT(dst_type.IsMalformedOrMalbounded() || |
655 (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); | 655 (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); |
656 // Preserve instantiator and its type arguments. | 656 // Preserve instantiator and its type arguments. |
657 __ addiu(SP, SP, Immediate(-2 * kWordSize)); | 657 __ addiu(SP, SP, Immediate(-2 * kWordSize)); |
658 __ sw(A2, Address(SP, 1 * kWordSize)); | 658 __ sw(A2, Address(SP, 1 * kWordSize)); |
659 | 659 |
660 // A null object is always assignable and is returned as result. | 660 // A null object is always assignable and is returned as result. |
661 Label is_assignable, runtime_call; | 661 Label is_assignable, runtime_call; |
662 | 662 |
663 __ BranchEqual(A0, reinterpret_cast<int32_t>(Object::null()), &is_assignable); | 663 __ BranchEqual(A0, reinterpret_cast<int32_t>(Object::null()), &is_assignable); |
664 __ delay_slot()->sw(A1, Address(SP, 0 * kWordSize)); | 664 __ delay_slot()->sw(A1, Address(SP, 0 * kWordSize)); |
665 | 665 |
666 if (!FLAG_eliminate_type_checks || dst_type.IsMalformed()) { | 666 if (!FLAG_eliminate_type_checks || dst_type.IsMalformed()) { |
667 // If type checks are not eliminated during the graph building then | 667 // If type checks are not eliminated during the graph building then |
668 // a transition sentinel can be seen here. | 668 // a transition sentinel can be seen here. |
669 __ BranchEqual(A0, Object::transition_sentinel(), &is_assignable); | 669 __ BranchEqual(A0, Object::transition_sentinel(), &is_assignable); |
670 } | 670 } |
671 | 671 |
672 // Generate throw new TypeError() if the type is malformed or malbounded. | 672 // Generate throw new TypeError() if the type is malformed or malbounded. |
673 if (dst_type.IsMalformed() || dst_type.IsMalbounded()) { | 673 if (dst_type.IsMalformedOrMalbounded()) { |
674 __ addiu(SP, SP, Immediate(-4 * kWordSize)); | 674 __ addiu(SP, SP, Immediate(-4 * kWordSize)); |
675 __ LoadObject(TMP, Object::ZoneHandle()); | 675 __ LoadObject(TMP, Object::ZoneHandle()); |
676 __ sw(TMP, Address(SP, 3 * kWordSize)); // Make room for the result. | 676 __ sw(TMP, Address(SP, 3 * kWordSize)); // Make room for the result. |
677 __ sw(A0, Address(SP, 2 * kWordSize)); // Push the source object. | 677 __ sw(A0, Address(SP, 2 * kWordSize)); // Push the source object. |
678 __ LoadObject(TMP, dst_name); | 678 __ LoadObject(TMP, dst_name); |
679 __ sw(TMP, Address(SP, 1 * kWordSize)); // Push the destination name. | 679 __ sw(TMP, Address(SP, 1 * kWordSize)); // Push the destination name. |
680 __ LoadObject(TMP, dst_type); | 680 __ LoadObject(TMP, dst_type); |
681 __ sw(TMP, Address(SP, 0 * kWordSize)); // Push the destination type. | 681 __ sw(TMP, Address(SP, 0 * kWordSize)); // Push the destination type. |
682 | 682 |
683 GenerateRuntimeCall(token_pos, | 683 GenerateRuntimeCall(token_pos, |
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1925 __ AddImmediate(SP, kDoubleSize); | 1925 __ AddImmediate(SP, kDoubleSize); |
1926 } | 1926 } |
1927 | 1927 |
1928 | 1928 |
1929 #undef __ | 1929 #undef __ |
1930 | 1930 |
1931 | 1931 |
1932 } // namespace dart | 1932 } // namespace dart |
1933 | 1933 |
1934 #endif // defined TARGET_ARCH_MIPS | 1934 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |