Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index b3b0aa0ad807ae0b7efaaf25f1b96dbd4ab227a9..44b952cfa702bbbb4030036695c32c25bf1e1b99 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -2078,6 +2078,34 @@ Operand LCodeGen::BuildSeqStringOperand(Register string, |
} |
+void LCodeGen::DoSeqStringGetChar(LSeqStringGetChar* instr) { |
+ String::Encoding encoding = instr->hydrogen()->encoding(); |
+ Register result = ToRegister(instr->result()); |
+ Register string = ToRegister(instr->string()); |
+ |
+ if (FLAG_debug_code) { |
+ __ push(string); |
+ __ mov(string, FieldOperand(string, HeapObject::kMapOffset)); |
+ __ movzx_b(string, FieldOperand(string, Map::kInstanceTypeOffset)); |
+ |
+ __ and_(string, Immediate(kStringRepresentationMask | kStringEncodingMask)); |
+ static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; |
+ static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; |
+ __ cmp(string, Immediate(encoding == String::ONE_BYTE_ENCODING |
+ ? one_byte_seq_type : two_byte_seq_type)); |
+ __ Check(equal, kUnexpectedStringType); |
+ __ pop(string); |
+ } |
+ |
+ Operand operand = BuildSeqStringOperand(string, instr->index(), encoding); |
+ if (encoding == String::ONE_BYTE_ENCODING) { |
+ __ movzx_b(result, operand); |
+ } else { |
+ __ movzx_w(result, operand); |
+ } |
+} |
+ |
+ |
void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { |
String::Encoding encoding = instr->hydrogen()->encoding(); |
Register string = ToRegister(instr->string()); |