| Index: src/mips/code-stubs-mips.cc
|
| diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
|
| index 5e0e238df17c4dac6e5fea2c2eaa5412180be075..e0f5b2768c2de277af00728f22f6697207976eae 100644
|
| --- a/src/mips/code-stubs-mips.cc
|
| +++ b/src/mips/code-stubs-mips.cc
|
| @@ -5243,7 +5243,6 @@ void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) {
|
| Label got_char_code;
|
| Label sliced_string;
|
|
|
| - ASSERT(!t0.is(scratch_));
|
| ASSERT(!t0.is(index_));
|
| ASSERT(!t0.is(result_));
|
| ASSERT(!t0.is(object_));
|
| @@ -5261,13 +5260,11 @@ void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) {
|
| // If the index is non-smi trigger the non-smi case.
|
| __ JumpIfNotSmi(index_, &index_not_smi_);
|
|
|
| - // Put smi-tagged index into scratch register.
|
| - __ mov(scratch_, index_);
|
| __ bind(&got_smi_index_);
|
|
|
| // Check for index out of range.
|
| __ lw(t0, FieldMemOperand(object_, String::kLengthOffset));
|
| - __ Branch(index_out_of_range_, ls, t0, Operand(scratch_));
|
| + __ Branch(index_out_of_range_, ls, t0, Operand(index_));
|
|
|
| // We need special handling for non-flat strings.
|
| STATIC_ASSERT(kSeqStringTag == 0);
|
| @@ -5291,28 +5288,28 @@ void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) {
|
| __ LoadRoot(t0, Heap::kEmptyStringRootIndex);
|
| __ Branch(&call_runtime_, ne, result_, Operand(t0));
|
|
|
| - // Get the first of the two strings and load its instance type.
|
| - __ lw(result_, FieldMemOperand(object_, ConsString::kFirstOffset));
|
| + // Get the first of the two parts.
|
| + __ lw(object_, FieldMemOperand(object_, ConsString::kFirstOffset));
|
| __ jmp(&assure_seq_string);
|
|
|
| // SlicedString, unpack and add offset.
|
| __ bind(&sliced_string);
|
| __ lw(result_, FieldMemOperand(object_, SlicedString::kOffsetOffset));
|
| - __ addu(scratch_, scratch_, result_);
|
| - __ lw(result_, FieldMemOperand(object_, SlicedString::kParentOffset));
|
| + __ Addu(index_, index_, result_);
|
| + __ lw(object_, FieldMemOperand(object_, SlicedString::kParentOffset));
|
|
|
| // Assure that we are dealing with a sequential string. Go to runtime if not.
|
| __ bind(&assure_seq_string);
|
| - __ lw(result_, FieldMemOperand(result_, HeapObject::kMapOffset));
|
| + __ lw(result_, FieldMemOperand(object_, HeapObject::kMapOffset));
|
| __ lbu(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset));
|
| // Check that parent is not an external string. Go to runtime otherwise.
|
| + // 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 updated index to the runtime function.
|
| STATIC_ASSERT(kSeqStringTag == 0);
|
|
|
| __ And(t0, result_, Operand(kStringRepresentationMask));
|
| __ Branch(&call_runtime_, ne, t0, Operand(zero_reg));
|
| - // Actually fetch the parent string if it is confirmed to be sequential.
|
| - STATIC_ASSERT(SlicedString::kParentOffset == ConsString::kFirstOffset);
|
| - __ lw(object_, FieldMemOperand(object_, SlicedString::kParentOffset));
|
|
|
| // Check for 1-byte or 2-byte string.
|
| __ bind(&flat_string);
|
| @@ -5326,18 +5323,18 @@ void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) {
|
| // add without shifting since the smi tag size is the log2 of the
|
| // number of bytes in a two-byte character.
|
| STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize == 1 && kSmiShiftSize == 0);
|
| - __ Addu(scratch_, object_, Operand(scratch_));
|
| - __ lhu(result_, FieldMemOperand(scratch_, SeqTwoByteString::kHeaderSize));
|
| + __ Addu(index_, object_, Operand(index_));
|
| + __ lhu(result_, FieldMemOperand(index_, SeqTwoByteString::kHeaderSize));
|
| __ Branch(&got_char_code);
|
|
|
| // ASCII string.
|
| // Load the byte into the result register.
|
| __ bind(&ascii_string);
|
|
|
| - __ srl(t0, scratch_, kSmiTagSize);
|
| - __ Addu(scratch_, object_, t0);
|
| + __ srl(t0, index_, kSmiTagSize);
|
| + __ Addu(index_, object_, t0);
|
|
|
| - __ lbu(result_, FieldMemOperand(scratch_, SeqAsciiString::kHeaderSize));
|
| + __ lbu(result_, FieldMemOperand(index_, SeqAsciiString::kHeaderSize));
|
|
|
| __ bind(&got_char_code);
|
| __ sll(result_, result_, kSmiTagSize);
|
| @@ -5354,13 +5351,13 @@ void StringCharCodeAtGenerator::GenerateSlow(
|
| __ bind(&index_not_smi_);
|
| // If index is a heap number, try converting it to an integer.
|
| __ CheckMap(index_,
|
| - scratch_,
|
| + result_,
|
| Heap::kHeapNumberMapRootIndex,
|
| index_not_number_,
|
| DONT_DO_SMI_CHECK);
|
| call_helper.BeforeCall(masm);
|
| // Consumed by runtime conversion function:
|
| - __ Push(object_, index_, index_);
|
| + __ Push(object_, index_);
|
| if (index_flags_ == STRING_INDEX_IS_NUMBER) {
|
| __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1);
|
| } else {
|
| @@ -5372,16 +5369,14 @@ void StringCharCodeAtGenerator::GenerateSlow(
|
| // Save the conversion result before the pop instructions below
|
| // have a chance to overwrite it.
|
|
|
| - __ Move(scratch_, v0);
|
| -
|
| - __ pop(index_);
|
| + __ Move(index_, v0);
|
| __ pop(object_);
|
| // Reload the instance type.
|
| __ lw(result_, FieldMemOperand(object_, HeapObject::kMapOffset));
|
| __ lbu(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset));
|
| call_helper.AfterCall(masm);
|
| // If index is still not a smi, it must be out of range.
|
| - __ JumpIfNotSmi(scratch_, index_out_of_range_);
|
| + __ JumpIfNotSmi(index_, index_out_of_range_);
|
| // Otherwise, return to the fast path.
|
| __ Branch(&got_smi_index_);
|
|
|
|
|