Chromium Code Reviews| Index: src/a64/macro-assembler-a64.cc |
| diff --git a/src/a64/macro-assembler-a64.cc b/src/a64/macro-assembler-a64.cc |
| index 7a245ad65ac776592afb2ad7e7e4a33ec65fd6f0..24c7689f7409b794912f8628f60a58ed8514db72 100644 |
| --- a/src/a64/macro-assembler-a64.cc |
| +++ b/src/a64/macro-assembler-a64.cc |
| @@ -3621,29 +3621,34 @@ void MacroAssembler::IndexFromHash(Register hash, Register index) { |
| void MacroAssembler::EmitSeqStringSetCharCheck(Register string, |
| Register index, |
| + Register scratch, |
| uint32_t encoding_mask) { |
| - Register scratch = __ Tmp1(); |
| ASSERT(!AreAliased(string, index, scratch)); |
| - AssertSmi(index); |
| - |
| // Check that string is an object. |
| ThrowIfSmi(string, kNonObject); |
| // Check that string has an appropriate map. |
| Ldr(scratch, FieldMemOperand(string, HeapObject::kMapOffset)); |
| Ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); |
| + |
| And(scratch, scratch, kStringRepresentationMask | kStringEncodingMask); |
| Cmp(scratch, encoding_mask); |
| ThrowIf(ne, kUnexpectedStringType); |
| - // Check that the index points inside the string. |
| + // The index is assumed to be untagged coming in, tag it to compare with the |
| + // string length without using a temp register, it is restored at the end of |
| + // this function. |
| + SmiTag(index); |
| + |
| Ldr(scratch, FieldMemOperand(string, String::kLengthOffset)); |
| Cmp(index, scratch); |
|
baptiste.afsa1
2014/02/06 14:52:07
You can avoid to Tag/Untag the index by untagging
|
| ThrowIf(ge, kIndexIsTooLarge); |
| Cmp(index, Operand(Smi::FromInt(0))); |
| ThrowIf(lt, kIndexIsNegative); |
| + |
| + SmiUntag(index); |
| } |