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

Unified Diff: runtime/vm/intrinsifier_mips.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 | « runtime/vm/intrinsifier_ia32.cc ('k') | runtime/vm/intrinsifier_x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intrinsifier_mips.cc
===================================================================
--- runtime/vm/intrinsifier_mips.cc (revision 24495)
+++ runtime/vm/intrinsifier_mips.cc (working copy)
@@ -1508,9 +1508,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;
__ lw(T1, Address(SP, 0 * kWordSize)); // Index.
__ lw(T0, Address(SP, 1 * kWordSize)); // String.
@@ -1522,7 +1521,7 @@
// Runtime throws exception.
__ BranchUnsignedGreaterEqual(T1, T2, &fall_through);
__ LoadClassId(TMP1, T0); // Class ID check.
- __ BranchNotEqual(TMP1, kOneByteStringCid, &fall_through);
+ __ BranchNotEqual(TMP1, kOneByteStringCid, &try_two_byte_string);
// Grab byte and return.
__ SmiUntag(T1);
@@ -1530,6 +1529,15 @@
__ lbu(V0, FieldAddress(T2, OneByteString::data_offset()));
__ Ret();
__ delay_slot()->SmiTag(V0);
+
+ __ Bind(&try_two_byte_string);
+ __ BranchNotEqual(TMP1, kTwoByteStringCid, &fall_through);
+ ASSERT(kSmiTagShift == 1);
+ __ addu(T2, T0, T1);
+ __ lhu(V0, FieldAddress(T2, OneByteString::data_offset()));
+ __ Ret();
+ __ delay_slot()->SmiTag(V0);
+
__ Bind(&fall_through);
return false;
}
« no previous file with comments | « runtime/vm/intrinsifier_ia32.cc ('k') | runtime/vm/intrinsifier_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698