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/intrinsifier.h" | 8 #include "vm/intrinsifier.h" |
9 | 9 |
10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
(...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 void Intrinsifier::String_getHashCode(Assembler* assembler) { | 1675 void Intrinsifier::String_getHashCode(Assembler* assembler) { |
1676 Label fall_through; | 1676 Label fall_through; |
1677 __ lw(T0, Address(SP, 0 * kWordSize)); | 1677 __ lw(T0, Address(SP, 0 * kWordSize)); |
1678 __ lw(V0, FieldAddress(T0, String::hash_offset())); | 1678 __ lw(V0, FieldAddress(T0, String::hash_offset())); |
1679 __ beq(V0, ZR, &fall_through); | 1679 __ beq(V0, ZR, &fall_through); |
1680 __ Ret(); | 1680 __ Ret(); |
1681 __ Bind(&fall_through); // Hash not yet computed. | 1681 __ Bind(&fall_through); // Hash not yet computed. |
1682 } | 1682 } |
1683 | 1683 |
1684 | 1684 |
1685 void Intrinsifier::StringBaseCodeUnitAt(Assembler* assembler) { | |
1686 Label fall_through, try_two_byte_string; | |
1687 | |
1688 __ lw(T1, Address(SP, 0 * kWordSize)); // Index. | |
1689 __ lw(T0, Address(SP, 1 * kWordSize)); // String. | |
1690 | |
1691 // Checks. | |
1692 __ andi(CMPRES1, T1, Immediate(kSmiTagMask)); | |
1693 __ bne(CMPRES1, ZR, &fall_through); // Index is not a Smi. | |
1694 __ lw(T2, FieldAddress(T0, String::length_offset())); // Range check. | |
1695 // Runtime throws exception. | |
1696 __ BranchUnsignedGreaterEqual(T1, T2, &fall_through); | |
1697 __ LoadClassId(CMPRES1, T0); // Class ID check. | |
1698 __ BranchNotEqual( | |
1699 CMPRES1, Immediate(kOneByteStringCid), &try_two_byte_string); | |
1700 | |
1701 // Grab byte and return. | |
1702 __ SmiUntag(T1); | |
1703 __ addu(T2, T0, T1); | |
1704 __ lbu(V0, FieldAddress(T2, OneByteString::data_offset())); | |
1705 __ Ret(); | |
1706 __ delay_slot()->SmiTag(V0); | |
1707 | |
1708 __ Bind(&try_two_byte_string); | |
1709 __ BranchNotEqual(CMPRES1, Immediate(kTwoByteStringCid), &fall_through); | |
1710 ASSERT(kSmiTagShift == 1); | |
1711 __ addu(T2, T0, T1); | |
1712 __ lhu(V0, FieldAddress(T2, TwoByteString::data_offset())); | |
1713 __ Ret(); | |
1714 __ delay_slot()->SmiTag(V0); | |
1715 | |
1716 __ Bind(&fall_through); | |
1717 } | |
1718 | |
1719 | |
1720 void GenerateSubstringMatchesSpecialization(Assembler* assembler, | 1685 void GenerateSubstringMatchesSpecialization(Assembler* assembler, |
1721 intptr_t receiver_cid, | 1686 intptr_t receiver_cid, |
1722 intptr_t other_cid, | 1687 intptr_t other_cid, |
1723 Label* return_true, | 1688 Label* return_true, |
1724 Label* return_false) { | 1689 Label* return_false) { |
1725 __ SmiUntag(A1); | 1690 __ SmiUntag(A1); |
1726 __ lw(T1, FieldAddress(A0, String::length_offset())); // this.length | 1691 __ lw(T1, FieldAddress(A0, String::length_offset())); // this.length |
1727 __ SmiUntag(T1); | 1692 __ SmiUntag(T1); |
1728 __ lw(T2, FieldAddress(A2, String::length_offset())); // other.length | 1693 __ lw(T2, FieldAddress(A2, String::length_offset())); // other.length |
1729 __ SmiUntag(T2); | 1694 __ SmiUntag(T2); |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2239 | 2204 |
2240 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { | 2205 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { |
2241 __ LoadIsolate(V0); | 2206 __ LoadIsolate(V0); |
2242 __ Ret(); | 2207 __ Ret(); |
2243 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); | 2208 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); |
2244 } | 2209 } |
2245 | 2210 |
2246 } // namespace dart | 2211 } // namespace dart |
2247 | 2212 |
2248 #endif // defined TARGET_ARCH_MIPS | 2213 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |