| Index: runtime/vm/intermediate_language_mips.cc
|
| ===================================================================
|
| --- runtime/vm/intermediate_language_mips.cc (revision 31282)
|
| +++ runtime/vm/intermediate_language_mips.cc (working copy)
|
| @@ -780,7 +780,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,
|
| @@ -789,18 +789,36 @@
|
| }
|
|
|
|
|
| -void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| - Register char_code = locs()->in(0).reg();
|
| - Register result = locs()->out().reg();
|
| +void StringCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| + if (kind() == StringCharCodeInstr::kFromCharCode) {
|
| + Register char_code = locs()->in(0).reg();
|
| + Register result = locs()->out().reg();
|
|
|
| - __ TraceSimMsg("StringFromCharCodeInstr");
|
| + __ TraceSimMsg("StringCharCodeInstr From");
|
|
|
| - __ LoadImmediate(result,
|
| - reinterpret_cast<uword>(Symbols::PredefinedAddress()));
|
| - __ AddImmediate(result, Symbols::kNullCharCodeSymbolOffset * kWordSize);
|
| - __ sll(TMP, char_code, 1); // Char code is a smi.
|
| - __ addu(TMP, TMP, result);
|
| - __ lw(result, Address(TMP));
|
| + __ LoadImmediate(result,
|
| + reinterpret_cast<uword>(Symbols::PredefinedAddress()));
|
| + __ AddImmediate(result, Symbols::kNullCharCodeSymbolOffset * kWordSize);
|
| + __ sll(TMP, char_code, 1); // Char code is a smi.
|
| + __ addu(TMP, TMP, result);
|
| + __ lw(result, Address(TMP));
|
| + } else {
|
| + __ TraceSimMsg("StringCharCodeInstr To");
|
| +
|
| + ASSERT(kind() == StringCharCodeInstr::kToCharCode);
|
| + ASSERT(cid_ == kOneByteStringCid);
|
| + Register str = locs()->in(0).reg();
|
| + Register result = locs()->out().reg();
|
| + Label done, is_one;
|
| + __ lw(result, FieldAddress(str, String::length_offset()));
|
| + __ BranchEqual(result, Smi::RawValue(1), &is_one);
|
| + __ LoadImmediate(result, Smi::RawValue(-1));
|
| + __ b(&done);
|
| + __ Bind(&is_one);
|
| + __ lbu(result, FieldAddress(str, OneByteString::data_offset()));
|
| + __ SmiTag(result);
|
| + __ Bind(&done);
|
| + }
|
| }
|
|
|
|
|
|
|