| Index: src/arm/lithium-codegen-arm.cc
|
| diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
|
| index 61bdf68a13a0998600954aa377b5418e4fe125a8..b28a51871e0c9a5ba641ad011b795cbc38f7f850 100644
|
| --- a/src/arm/lithium-codegen-arm.cc
|
| +++ b/src/arm/lithium-codegen-arm.cc
|
| @@ -3592,86 +3592,14 @@ void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) {
|
| LStringCharCodeAt* instr_;
|
| };
|
|
|
| - Register string = ToRegister(instr->string());
|
| - Register index = ToRegister(instr->index());
|
| - Register result = ToRegister(instr->result());
|
| -
|
| DeferredStringCharCodeAt* deferred =
|
| new DeferredStringCharCodeAt(this, instr);
|
|
|
| - // Fetch the instance type of the receiver into result register.
|
| - __ ldr(result, FieldMemOperand(string, HeapObject::kMapOffset));
|
| - __ ldrb(result, FieldMemOperand(result, Map::kInstanceTypeOffset));
|
| -
|
| - // We need special handling for indirect strings.
|
| - Label check_sequential;
|
| - __ tst(result, Operand(kIsIndirectStringMask));
|
| - __ b(eq, &check_sequential);
|
| -
|
| - // Dispatch on the indirect string shape: slice or cons.
|
| - Label cons_string;
|
| - __ tst(result, Operand(kSlicedNotConsMask));
|
| - __ b(eq, &cons_string);
|
| -
|
| - // Handle slices.
|
| - Label indirect_string_loaded;
|
| - __ ldr(result, FieldMemOperand(string, SlicedString::kOffsetOffset));
|
| - __ add(index, index, Operand(result, ASR, kSmiTagSize));
|
| - __ ldr(string, FieldMemOperand(string, SlicedString::kParentOffset));
|
| - __ jmp(&indirect_string_loaded);
|
| -
|
| - // Handle conses.
|
| - // Check whether the right hand side is the empty string (i.e. if
|
| - // this is really a flat string in a cons string). If that is not
|
| - // the case we would rather go to the runtime system now to flatten
|
| - // the string.
|
| - __ bind(&cons_string);
|
| - __ ldr(result, FieldMemOperand(string, ConsString::kSecondOffset));
|
| - __ LoadRoot(ip, Heap::kEmptyStringRootIndex);
|
| - __ cmp(result, ip);
|
| - __ b(ne, deferred->entry());
|
| - // Get the first of the two strings and load its instance type.
|
| - __ ldr(string, FieldMemOperand(string, ConsString::kFirstOffset));
|
| -
|
| - __ bind(&indirect_string_loaded);
|
| - __ ldr(result, FieldMemOperand(string, HeapObject::kMapOffset));
|
| - __ ldrb(result, FieldMemOperand(result, Map::kInstanceTypeOffset));
|
| -
|
| - // Check whether the string is sequential. The only non-sequential
|
| - // shapes we support have just been unwrapped above.
|
| - // Note that if the original string is a cons or slice with an external
|
| - // string as underlying string, we pass that unpacked underlying string with
|
| - // the adjusted index to the runtime function.
|
| - __ bind(&check_sequential);
|
| - STATIC_ASSERT(kSeqStringTag == 0);
|
| - __ tst(result, Operand(kStringRepresentationMask));
|
| - __ b(ne, deferred->entry());
|
| -
|
| - // Dispatch on the encoding: ASCII or two-byte.
|
| - Label ascii_string;
|
| - STATIC_ASSERT((kStringEncodingMask & kAsciiStringTag) != 0);
|
| - STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0);
|
| - __ tst(result, Operand(kStringEncodingMask));
|
| - __ b(ne, &ascii_string);
|
| -
|
| - // Two-byte string.
|
| - // Load the two-byte character code into the result register.
|
| - Label done;
|
| - __ add(result,
|
| - string,
|
| - Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag));
|
| - __ ldrh(result, MemOperand(result, index, LSL, 1));
|
| - __ jmp(&done);
|
| -
|
| - // ASCII string.
|
| - // Load the byte into the result register.
|
| - __ bind(&ascii_string);
|
| - __ add(result,
|
| - string,
|
| - Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag));
|
| - __ ldrb(result, MemOperand(result, index));
|
| -
|
| - __ bind(&done);
|
| + StringCharLoadGenerator::Generate(masm(),
|
| + ToRegister(instr->string()),
|
| + ToRegister(instr->index()),
|
| + ToRegister(instr->result()),
|
| + deferred->entry());
|
| __ bind(deferred->exit());
|
| }
|
|
|
|
|