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

Unified Diff: runtime/vm/intrinsifier_arm.cc

Issue 17907003: Add two-byte string support in codeunitAt intrinsic. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/intrinsifier_ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intrinsifier_arm.cc
===================================================================
--- runtime/vm/intrinsifier_arm.cc (revision 24495)
+++ runtime/vm/intrinsifier_arm.cc (working copy)
@@ -1441,9 +1441,8 @@
}
-// TODO(srdjan): Implement for two and four byte strings as well.
bool Intrinsifier::String_codeUnitAt(Assembler* assembler) {
- Label fall_through;
+ Label fall_through, try_two_byte_string;
__ ldr(R1, Address(SP, 0 * kWordSize)); // Index.
__ ldr(R0, Address(SP, 1 * kWordSize)); // String.
@@ -1454,12 +1453,22 @@
__ cmp(R1, ShifterOperand(R2));
__ b(&fall_through, CS); // Runtime throws exception.
__ CompareClassId(R0, kOneByteStringCid, R3);
- __ b(&fall_through, NE);
+ __ b(&try_two_byte_string, NE);
__ SmiUntag(R1);
__ AddImmediate(R0, OneByteString::data_offset() - kHeapObjectTag);
__ ldrb(R0, Address(R0, R1));
__ SmiTag(R0);
__ Ret();
+
+ __ Bind(&try_two_byte_string);
+ __ CompareClassId(R0, kTwoByteStringCid, R3);
+ __ b(&fall_through, NE);
+ ASSERT(kSmiTagShift == 1);
+ __ AddImmediate(R0, OneByteString::data_offset() - kHeapObjectTag);
+ __ ldrh(R0, Address(R0, R1));
+ __ SmiTag(R0);
+ __ Ret();
+
__ Bind(&fall_through);
return false;
}
« no previous file with comments | « no previous file | runtime/vm/intrinsifier_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698