Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index bf014da2c7a3742cb848653d5557e31abc271ffb..f31dfaf655f4822516bd2504249d3ed5e83d67cc 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -1896,11 +1896,32 @@ void LCodeGen::DoDateField(LDateField* instr) { |
void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { |
- SeqStringSetCharGenerator::Generate(masm(), |
- instr->encoding(), |
- ToRegister(instr->string()), |
- ToRegister(instr->index()), |
- ToRegister(instr->value())); |
+ Register string = ToRegister(instr->string()); |
+ Register index = ToRegister(instr->index()); |
+ Register value = ToRegister(instr->value()); |
+ String::Encoding encoding = instr->encoding(); |
+ |
+ if (FLAG_debug_code) { |
+ __ push(value); |
+ __ mov(value, FieldOperand(string, HeapObject::kMapOffset)); |
+ __ movzx_b(value, FieldOperand(value, Map::kInstanceTypeOffset)); |
+ |
+ __ and_(value, Immediate(kStringRepresentationMask | kStringEncodingMask)); |
+ static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; |
+ static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; |
+ __ cmp(value, Immediate(encoding == String::ONE_BYTE_ENCODING |
+ ? one_byte_seq_type : two_byte_seq_type)); |
+ __ Check(equal, "Unexpected string type"); |
+ __ pop(value); |
+ } |
+ |
+ if (encoding == String::ONE_BYTE_ENCODING) { |
+ __ mov_b(FieldOperand(string, index, times_1, SeqString::kHeaderSize), |
+ value); |
+ } else { |
+ __ mov_w(FieldOperand(string, index, times_2, SeqString::kHeaderSize), |
+ value); |
+ } |
} |