Index: src/mips/code-stubs-mips.cc |
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc |
index b5ecc68ee0d4e51a98fa7f034ff76be40ffcd66a..a0c6d5055981b215eb0f2ba17aca0b6a70dcdc88 100644 |
--- a/src/mips/code-stubs-mips.cc |
+++ b/src/mips/code-stubs-mips.cc |
@@ -5130,24 +5130,27 @@ void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { |
__ Branch(&call_runtime_, ne, result_, Operand(t0)); |
// Get the first of the two strings and load its instance type. |
- __ lw(object_, FieldMemOperand(object_, ConsString::kFirstOffset)); |
+ __ lw(result_, 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(object_, FieldMemOperand(object_, SlicedString::kParentOffset)); |
+ __ lw(result_, 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(object_, HeapObject::kMapOffset)); |
+ __ lw(result_, FieldMemOperand(result_, HeapObject::kMapOffset)); |
__ lbu(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset)); |
// Check that parent is not an external string. Go to runtime otherwise. |
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); |