| Index: runtime/vm/intrinsifier_x64.cc
|
| ===================================================================
|
| --- runtime/vm/intrinsifier_x64.cc (revision 24495)
|
| +++ runtime/vm/intrinsifier_x64.cc (working copy)
|
| @@ -1426,9 +1426,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;
|
| __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Index.
|
| __ movq(RAX, Address(RSP, + 2 * kWordSize)); // String.
|
| __ testq(RCX, Immediate(kSmiTagMask));
|
| @@ -1438,11 +1437,20 @@
|
| // Runtime throws exception.
|
| __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
|
| __ CompareClassId(RAX, kOneByteStringCid);
|
| - __ j(NOT_EQUAL, &fall_through);
|
| + __ j(NOT_EQUAL, &try_two_byte_string, Assembler::kNearJump);
|
| __ SmiUntag(RCX);
|
| __ movzxb(RAX, FieldAddress(RAX, RCX, TIMES_1, OneByteString::data_offset()));
|
| __ SmiTag(RAX);
|
| __ ret();
|
| +
|
| + __ Bind(&try_two_byte_string);
|
| + __ CompareClassId(RAX, kTwoByteStringCid);
|
| + __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump);
|
| + ASSERT(kSmiTagShift == 1);
|
| + __ movzxw(RAX, FieldAddress(RAX, RCX, TIMES_1, OneByteString::data_offset()));
|
| + __ SmiTag(RAX);
|
| + __ ret();
|
| +
|
| __ Bind(&fall_through);
|
| return false;
|
| }
|
|
|