Index: src/arm/codegen-arm.cc |
diff --git a/src/arm/codegen-arm.cc b/src/arm/codegen-arm.cc |
index af2f21623160a9aa192c142115547dd1e8d45c0b..81e23e334b42a5777d71db010a3deb1621b670ef 100644 |
--- a/src/arm/codegen-arm.cc |
+++ b/src/arm/codegen-arm.cc |
@@ -521,6 +521,48 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm, |
} |
+void SeqStringSetCharGenerator::Generate(MacroAssembler* masm, |
+ bool one_byte_string, |
+ Register string, |
+ Register index, |
+ Register value) { |
+ if (FLAG_debug_code) { |
+ __ tst(index, Operand(kSmiTagMask)); |
+ __ Check(eq, "Non-smi index"); |
+ __ tst(value, Operand(kSmiTagMask)); |
+ __ Check(eq, "Non-smi value"); |
+ |
+ __ ldr(ip, FieldMemOperand(string, String::kLengthOffset)); |
+ __ cmp(index, ip); |
+ __ Check(lt, "Index is too large"); |
+ |
+ __ cmp(index, Operand(Smi::FromInt(0))); |
+ __ Check(ge, "Index is negative"); |
+ |
+ __ ldr(ip, FieldMemOperand(string, HeapObject::kMapOffset)); |
+ __ ldrb(ip, FieldMemOperand(ip, Map::kInstanceTypeOffset)); |
+ |
+ __ and_(ip, ip, Operand(kStringRepresentationMask | kStringEncodingMask)); |
+ static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; |
+ static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; |
+ __ cmp(ip, Operand(one_byte_string ? one_byte_seq_type |
+ : two_byte_seq_type)); |
+ __ Check(eq, "Unexpected string type"); |
+ } |
+ |
+ __ add(ip, |
+ string, |
+ Operand(SeqString::kHeaderSize - kHeapObjectTag)); |
+ STATIC_ASSERT(kSmiTagSize == 1); |
+ __ SmiUntag(value, value); |
+ if (one_byte_string) { |
+ __ strb(value, MemOperand(ip, index, LSR, 1)); |
+ } else { |
+ __ strh(value, MemOperand(ip, index)); |
Toon Verwaest
2012/12/05 14:29:12
Please add a comment here as well to indicate that
|
+ } |
+} |
+ |
+ |
static MemOperand ExpConstant(int index, Register base) { |
return MemOperand(base, index * kDoubleSize); |
} |