| Index: runtime/vm/intermediate_language_arm.cc
|
| ===================================================================
|
| --- runtime/vm/intermediate_language_arm.cc (revision 31282)
|
| +++ runtime/vm/intermediate_language_arm.cc (working copy)
|
| @@ -720,7 +720,7 @@
|
| }
|
|
|
|
|
| -LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(bool opt) const {
|
| +LocationSummary* StringCharCodeInstr::MakeLocationSummary(bool opt) const {
|
| const intptr_t kNumInputs = 1;
|
| // TODO(fschneider): Allow immediate operands for the char code.
|
| return LocationSummary::Make(kNumInputs,
|
| @@ -729,13 +729,25 @@
|
| }
|
|
|
|
|
| -void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| - Register char_code = locs()->in(0).reg();
|
| - Register result = locs()->out().reg();
|
| - __ LoadImmediate(result,
|
| - reinterpret_cast<uword>(Symbols::PredefinedAddress()));
|
| - __ AddImmediate(result, Symbols::kNullCharCodeSymbolOffset * kWordSize);
|
| - __ ldr(result, Address(result, char_code, LSL, 1)); // Char code is a smi.
|
| +void StringCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| + if (kind() == StringCharCodeInstr::kFromCharCode) {
|
| + Register char_code = locs()->in(0).reg();
|
| + Register result = locs()->out().reg();
|
| + __ LoadImmediate(result,
|
| + reinterpret_cast<uword>(Symbols::PredefinedAddress()));
|
| + __ AddImmediate(result, Symbols::kNullCharCodeSymbolOffset * kWordSize);
|
| + __ ldr(result, Address(result, char_code, LSL, 1)); // Char code is a smi.
|
| + } else {
|
| + ASSERT(kind() == StringCharCodeInstr::kToCharCode);
|
| + ASSERT(cid_ == kOneByteStringCid);
|
| + Register str = locs()->in(0).reg();
|
| + Register result = locs()->out().reg();
|
| + __ ldr(result, FieldAddress(str, String::length_offset()));
|
| + __ cmp(result, ShifterOperand(Smi::RawValue(1)));
|
| + __ LoadImmediate(result, Smi::RawValue(-1), NE);
|
| + __ ldrb(result, FieldAddress(str, OneByteString::data_offset()), EQ);
|
| + __ SmiTag(result);
|
| + }
|
| }
|
|
|
|
|
|
|