Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(841)

Side by Side Diff: runtime/vm/intrinsifier_arm64.cc

Issue 1961393002: VM: Optimized code for all of [External]{One|Two}ByteString::codeUnitAt. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: addressed comment Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/intrinsifier_arm.cc ('k') | runtime/vm/intrinsifier_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 __ ldr(R0, Address(SP, 0 * kWordSize)); 1648 __ ldr(R0, Address(SP, 0 * kWordSize));
1649 __ ldr(R0, FieldAddress(R0, String::hash_offset())); 1649 __ ldr(R0, FieldAddress(R0, String::hash_offset()));
1650 __ CompareRegisters(R0, ZR); 1650 __ CompareRegisters(R0, ZR);
1651 __ b(&fall_through, EQ); 1651 __ b(&fall_through, EQ);
1652 __ ret(); 1652 __ ret();
1653 // Hash not yet computed. 1653 // Hash not yet computed.
1654 __ Bind(&fall_through); 1654 __ Bind(&fall_through);
1655 } 1655 }
1656 1656
1657 1657
1658 void Intrinsifier::StringBaseCodeUnitAt(Assembler* assembler) {
1659 Label fall_through, try_two_byte_string;
1660
1661 __ ldr(R1, Address(SP, 0 * kWordSize)); // Index.
1662 __ ldr(R0, Address(SP, 1 * kWordSize)); // String.
1663 __ tsti(R1, Immediate(kSmiTagMask));
1664 __ b(&fall_through, NE); // Index is not a Smi.
1665 // Range check.
1666 __ ldr(R2, FieldAddress(R0, String::length_offset()));
1667 __ cmp(R1, Operand(R2));
1668 __ b(&fall_through, CS); // Runtime throws exception.
1669 __ CompareClassId(R0, kOneByteStringCid);
1670 __ b(&try_two_byte_string, NE);
1671 __ SmiUntag(R1);
1672 __ AddImmediate(R0, R0, OneByteString::data_offset() - kHeapObjectTag);
1673 __ ldr(R0, Address(R0, R1), kUnsignedByte);
1674 __ SmiTag(R0);
1675 __ ret();
1676
1677 __ Bind(&try_two_byte_string);
1678 __ CompareClassId(R0, kTwoByteStringCid);
1679 __ b(&fall_through, NE);
1680 ASSERT(kSmiTagShift == 1);
1681 __ AddImmediate(R0, R0, TwoByteString::data_offset() - kHeapObjectTag);
1682 __ ldr(R0, Address(R0, R1), kUnsignedHalfword);
1683 __ SmiTag(R0);
1684 __ ret();
1685
1686 __ Bind(&fall_through);
1687 }
1688
1689
1690 void GenerateSubstringMatchesSpecialization(Assembler* assembler, 1658 void GenerateSubstringMatchesSpecialization(Assembler* assembler,
1691 intptr_t receiver_cid, 1659 intptr_t receiver_cid,
1692 intptr_t other_cid, 1660 intptr_t other_cid,
1693 Label* return_true, 1661 Label* return_true,
1694 Label* return_false) { 1662 Label* return_false) {
1695 __ SmiUntag(R1); 1663 __ SmiUntag(R1);
1696 __ ldr(R8, FieldAddress(R0, String::length_offset())); // this.length 1664 __ ldr(R8, FieldAddress(R0, String::length_offset())); // this.length
1697 __ SmiUntag(R8); 1665 __ SmiUntag(R8);
1698 __ ldr(R9, FieldAddress(R2, String::length_offset())); // other.length 1666 __ ldr(R9, FieldAddress(R2, String::length_offset())); // other.length
1699 __ SmiUntag(R9); 1667 __ SmiUntag(R9);
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
2206 2174
2207 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { 2175 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) {
2208 __ LoadIsolate(R0); 2176 __ LoadIsolate(R0);
2209 __ ldr(R0, Address(R0, Isolate::current_tag_offset())); 2177 __ ldr(R0, Address(R0, Isolate::current_tag_offset()));
2210 __ ret(); 2178 __ ret();
2211 } 2179 }
2212 2180
2213 } // namespace dart 2181 } // namespace dart
2214 2182
2215 #endif // defined TARGET_ARCH_ARM64 2183 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_arm.cc ('k') | runtime/vm/intrinsifier_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698