Index: src/mips/lithium-codegen-mips.cc |
diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc |
index 5d09a302aece1186d3808a785768633a1ff30420..2d8939f8dae3ec3b2c9f57e3361ee18dbd4299e5 100644 |
--- a/src/mips/lithium-codegen-mips.cc |
+++ b/src/mips/lithium-codegen-mips.cc |
@@ -1756,6 +1756,34 @@ MemOperand LCodeGen::BuildSeqStringOperand(Register string, |
} |
+void LCodeGen::DoSeqStringGetChar(LSeqStringGetChar* instr) { |
+ String::Encoding encoding = instr->hydrogen()->encoding(); |
+ Register string = ToRegister(instr->string()); |
+ Register result = ToRegister(instr->result()); |
+ |
+ if (FLAG_debug_code) { |
+ Register scratch = scratch0(); |
+ __ lw(scratch, FieldMemOperand(string, HeapObject::kMapOffset)); |
+ __ lbu(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); |
+ |
+ __ And(scratch, scratch, |
+ Operand(kStringRepresentationMask | kStringEncodingMask)); |
+ static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; |
+ static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; |
+ __ Subu(at, scratch, Operand(encoding == String::ONE_BYTE_ENCODING |
+ ? one_byte_seq_type : two_byte_seq_type)); |
+ __ Check(eq, kUnexpectedStringType, at, Operand(zero_reg)); |
+ } |
+ |
+ MemOperand operand = BuildSeqStringOperand(string, instr->index(), encoding); |
+ if (encoding == String::ONE_BYTE_ENCODING) { |
+ __ lbu(result, operand); |
+ } else { |
+ __ lhu(result, operand); |
+ } |
+} |
+ |
+ |
void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { |
String::Encoding encoding = instr->hydrogen()->encoding(); |
Register string = ToRegister(instr->string()); |