Chromium Code Reviews| Index: src/arm/lithium-codegen-arm.cc |
| diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
| index 8eca27d77d9427f5c4fa58ae0d58e8cf4956b28c..c9008c221320fbe8cb732bd20d81d7c3e59d4767 100644 |
| --- a/src/arm/lithium-codegen-arm.cc |
| +++ b/src/arm/lithium-codegen-arm.cc |
| @@ -1948,6 +1948,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(); |
| + __ ldr(scratch, FieldMemOperand(string, HeapObject::kMapOffset)); |
| + __ ldrb(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; |
| + __ cmp(scratch, Operand(encoding == String::ONE_BYTE_ENCODING |
|
Sven Panne
2013/11/07 12:45:14
Hmmm, a pattern like this comes up several times a
|
| + ? one_byte_seq_type : two_byte_seq_type)); |
| + __ Check(eq, kUnexpectedStringType); |
| + } |
| + |
| + MemOperand operand = BuildSeqStringOperand(string, instr->index(), encoding); |
| + if (encoding == String::ONE_BYTE_ENCODING) { |
|
Sven Panne
2013/11/07 12:45:14
This would be nicer with the upcoming "Load" and a
|
| + __ ldrb(result, operand); |
| + } else { |
| + __ ldrh(result, operand); |
| + } |
| +} |
| + |
| + |
| void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { |
| String::Encoding encoding = instr->hydrogen()->encoding(); |
| Register string = ToRegister(instr->string()); |