| Index: src/arm/lithium-codegen-arm.cc
|
| diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
|
| index b7fc3b6055c67704f1065e3f232f039aa52bb745..7f65023ed00827e58d8629af5a563327bd92f9d5 100644
|
| --- a/src/arm/lithium-codegen-arm.cc
|
| +++ b/src/arm/lithium-codegen-arm.cc
|
| @@ -1975,42 +1975,32 @@ void LCodeGen::DoDateField(LDateField* instr) {
|
|
|
| void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) {
|
| Register string = ToRegister(instr->string());
|
| - LOperand* index_op = instr->index();
|
| + Register index = ToRegister(instr->index());
|
| Register value = ToRegister(instr->value());
|
| - Register scratch = scratch0();
|
| String::Encoding encoding = instr->encoding();
|
|
|
| if (FLAG_debug_code) {
|
| - __ ldr(scratch, FieldMemOperand(string, HeapObject::kMapOffset));
|
| - __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset));
|
| + __ ldr(ip, FieldMemOperand(string, HeapObject::kMapOffset));
|
| + __ ldrb(ip, FieldMemOperand(ip, Map::kInstanceTypeOffset));
|
|
|
| - __ and_(scratch, scratch,
|
| - Operand(kStringRepresentationMask | kStringEncodingMask));
|
| + __ and_(ip, ip, Operand(kStringRepresentationMask | kStringEncodingMask));
|
| static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
|
| static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
|
| - __ cmp(scratch, Operand(encoding == String::ONE_BYTE_ENCODING
|
| - ? one_byte_seq_type : two_byte_seq_type));
|
| + __ cmp(ip, Operand(encoding == String::ONE_BYTE_ENCODING
|
| + ? one_byte_seq_type : two_byte_seq_type));
|
| __ Check(eq, kUnexpectedStringType);
|
| }
|
|
|
| - if (index_op->IsConstantOperand()) {
|
| - int constant_index = ToInteger32(LConstantOperand::cast(index_op));
|
| - if (encoding == String::ONE_BYTE_ENCODING) {
|
| - __ strb(value,
|
| - FieldMemOperand(string, SeqString::kHeaderSize + constant_index));
|
| - } else {
|
| - __ strh(value,
|
| - FieldMemOperand(string, SeqString::kHeaderSize + constant_index * 2));
|
| - }
|
| + __ add(ip,
|
| + string,
|
| + Operand(SeqString::kHeaderSize - kHeapObjectTag));
|
| + if (encoding == String::ONE_BYTE_ENCODING) {
|
| + __ strb(value, MemOperand(ip, index));
|
| } else {
|
| - Register index = ToRegister(index_op);
|
| - if (encoding == String::ONE_BYTE_ENCODING) {
|
| - __ add(scratch, string, Operand(index));
|
| - __ strb(value, FieldMemOperand(scratch, SeqString::kHeaderSize));
|
| - } else {
|
| - __ add(scratch, string, Operand(index, LSL, 1));
|
| - __ strh(value, FieldMemOperand(scratch, SeqString::kHeaderSize));
|
| - }
|
| + // MemOperand with ip as the base register is not allowed for strh, so
|
| + // we do the address calculation explicitly.
|
| + __ add(ip, ip, Operand(index, LSL, 1));
|
| + __ strh(value, MemOperand(ip));
|
| }
|
| }
|
|
|
|
|