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

Side by Side Diff: runtime/vm/intrinsifier_arm.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.cc ('k') | runtime/vm/intrinsifier_arm64.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) 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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
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 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 1567
1568 1568
1569 void Intrinsifier::String_getHashCode(Assembler* assembler) { 1569 void Intrinsifier::String_getHashCode(Assembler* assembler) {
1570 __ ldr(R0, Address(SP, 0 * kWordSize)); 1570 __ ldr(R0, Address(SP, 0 * kWordSize));
1571 __ ldr(R0, FieldAddress(R0, String::hash_offset())); 1571 __ ldr(R0, FieldAddress(R0, String::hash_offset()));
1572 __ cmp(R0, Operand(0)); 1572 __ cmp(R0, Operand(0));
1573 __ bx(LR, NE); // Hash not yet computed. 1573 __ bx(LR, NE); // Hash not yet computed.
1574 } 1574 }
1575 1575
1576 1576
1577 void Intrinsifier::StringBaseCodeUnitAt(Assembler* assembler) {
1578 Label fall_through, try_two_byte_string;
1579
1580 __ ldr(R1, Address(SP, 0 * kWordSize)); // Index.
1581 __ ldr(R0, Address(SP, 1 * kWordSize)); // String.
1582 __ tst(R1, Operand(kSmiTagMask));
1583 __ b(&fall_through, NE); // Index is not a Smi.
1584 // Range check.
1585 __ ldr(R2, FieldAddress(R0, String::length_offset()));
1586 __ cmp(R1, Operand(R2));
1587 __ b(&fall_through, CS); // Runtime throws exception.
1588 __ CompareClassId(R0, kOneByteStringCid, R3);
1589 __ b(&try_two_byte_string, NE);
1590 __ SmiUntag(R1);
1591 __ AddImmediate(R0, OneByteString::data_offset() - kHeapObjectTag);
1592 __ ldrb(R0, Address(R0, R1));
1593 __ SmiTag(R0);
1594 __ Ret();
1595
1596 __ Bind(&try_two_byte_string);
1597 __ CompareClassId(R0, kTwoByteStringCid, R3);
1598 __ b(&fall_through, NE);
1599 ASSERT(kSmiTagShift == 1);
1600 __ AddImmediate(R0, TwoByteString::data_offset() - kHeapObjectTag);
1601 __ ldrh(R0, Address(R0, R1));
1602 __ SmiTag(R0);
1603 __ Ret();
1604
1605 __ Bind(&fall_through);
1606 }
1607
1608
1609 void GenerateSubstringMatchesSpecialization(Assembler* assembler, 1577 void GenerateSubstringMatchesSpecialization(Assembler* assembler,
1610 intptr_t receiver_cid, 1578 intptr_t receiver_cid,
1611 intptr_t other_cid, 1579 intptr_t other_cid,
1612 Label* return_true, 1580 Label* return_true,
1613 Label* return_false) { 1581 Label* return_false) {
1614 __ SmiUntag(R1); 1582 __ SmiUntag(R1);
1615 __ ldr(R8, FieldAddress(R0, String::length_offset())); // this.length 1583 __ ldr(R8, FieldAddress(R0, String::length_offset())); // this.length
1616 __ SmiUntag(R8); 1584 __ SmiUntag(R8);
1617 __ ldr(R9, FieldAddress(R2, String::length_offset())); // other.length 1585 __ ldr(R9, FieldAddress(R2, String::length_offset())); // other.length
1618 __ SmiUntag(R9); 1586 __ SmiUntag(R9);
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
2132 2100
2133 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { 2101 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) {
2134 __ LoadIsolate(R0); 2102 __ LoadIsolate(R0);
2135 __ ldr(R0, Address(R0, Isolate::current_tag_offset())); 2103 __ ldr(R0, Address(R0, Isolate::current_tag_offset()));
2136 __ Ret(); 2104 __ Ret();
2137 } 2105 }
2138 2106
2139 } // namespace dart 2107 } // namespace dart
2140 2108
2141 #endif // defined TARGET_ARCH_ARM 2109 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier.cc ('k') | runtime/vm/intrinsifier_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698