Chromium Code Reviews| Index: src/mips/codegen-mips.cc |
| diff --git a/src/mips/codegen-mips.cc b/src/mips/codegen-mips.cc |
| index 0119c11f53b27102b3dda4aa5b18e8eb259b6054..9b33bee9891d02d66f181d12db4a2954d770917e 100644 |
| --- a/src/mips/codegen-mips.cc |
| +++ b/src/mips/codegen-mips.cc |
| @@ -517,6 +517,54 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm, |
| } |
| +void SeqStringSetCharGenerator::Generate(MacroAssembler* masm, |
| + String::Encoding encoding, |
| + Register string, |
| + Register index, |
| + Register value) { |
| + if (FLAG_debug_code) { |
| + __ And(at, index, Operand(kSmiTagMask)); |
| + __ Check(eq, "Non-smi index", at, Operand(zero_reg)); |
| + __ And(at, value, Operand(kSmiTagMask)); |
| + __ Check(eq, "Non-smi value", at, Operand(zero_reg)); |
| + |
| + __ lw(at, FieldMemOperand(string, String::kLengthOffset)); |
| + __ Check(lt, "Index is too large", at, Operand(index)); |
| + |
| + __ Check(ge, "Index is negative", index, Operand(Smi::FromInt(0))); |
| + |
| + __ lw(at, FieldMemOperand(string, HeapObject::kMapOffset)); |
| + __ lbu(at, FieldMemOperand(at, Map::kInstanceTypeOffset)); |
| + |
| + __ And(at, at, Operand(kStringRepresentationMask | kStringEncodingMask)); |
| + static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; |
| + static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; |
| + __ Check(eq, "Unexpected string type", at, |
| + Operand(encoding == String::ONE_BYTE_ENCODING |
| + ? one_byte_seq_type : two_byte_seq_type)); |
| + } |
| + |
| + __ SmiUntag(value, value); |
| + STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); |
| + if (encoding == String::ONE_BYTE_ENCODING) { |
| + // Smis are tagged by left shift by 1, thus LSR by 1 to smi-untag inline. |
|
Yang
2012/12/17 10:27:26
This comment does not apply to MIPS.
palfia
2012/12/17 18:46:55
Done.
|
| + __ srl(at, index, 1); |
|
Yang
2012/12/17 10:27:26
Isn't there a SmiUntag macro for MIPS as well?
palfia
2012/12/17 18:46:55
Done.
|
| + __ Addu(at, at, string); |
| + __ Addu(at, |
| + at, |
| + Operand(SeqString::kHeaderSize - kHeapObjectTag)); |
| + __ sb(value, MemOperand(at)); |
| + } else { |
| + // No need to untag a smi for two-byte addressing. |
| + __ Addu(at, |
| + string, |
| + Operand(SeqString::kHeaderSize - kHeapObjectTag)); |
| + __ Addu(at, at, index); |
| + __ sh(value, MemOperand(at)); |
| + } |
| +} |
| + |
| + |
| static MemOperand ExpConstant(int index, Register base) { |
| return MemOperand(base, index * kDoubleSize); |
| } |