| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 __ LoadImmediate(T5, entry); | 773 __ LoadImmediate(T5, entry); |
| 774 __ LoadImmediate(A1, NativeArguments::ComputeArgcTag(function())); | 774 __ LoadImmediate(A1, NativeArguments::ComputeArgcTag(function())); |
| 775 compiler->GenerateCall(token_pos(), | 775 compiler->GenerateCall(token_pos(), |
| 776 stub_entry, | 776 stub_entry, |
| 777 PcDescriptors::kOther, | 777 PcDescriptors::kOther, |
| 778 locs()); | 778 locs()); |
| 779 __ Pop(result); | 779 __ Pop(result); |
| 780 } | 780 } |
| 781 | 781 |
| 782 | 782 |
| 783 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(bool opt) const { | 783 LocationSummary* StringCharCodeInstr::MakeLocationSummary(bool opt) const { |
| 784 const intptr_t kNumInputs = 1; | 784 const intptr_t kNumInputs = 1; |
| 785 // TODO(fschneider): Allow immediate operands for the char code. | 785 // TODO(fschneider): Allow immediate operands for the char code. |
| 786 return LocationSummary::Make(kNumInputs, | 786 return LocationSummary::Make(kNumInputs, |
| 787 Location::RequiresRegister(), | 787 Location::RequiresRegister(), |
| 788 LocationSummary::kNoCall); | 788 LocationSummary::kNoCall); |
| 789 } | 789 } |
| 790 | 790 |
| 791 | 791 |
| 792 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 792 void StringCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 793 Register char_code = locs()->in(0).reg(); | 793 if (kind() == StringCharCodeInstr::kFromCharCode) { |
| 794 Register result = locs()->out().reg(); | 794 Register char_code = locs()->in(0).reg(); |
| 795 Register result = locs()->out().reg(); |
| 795 | 796 |
| 796 __ TraceSimMsg("StringFromCharCodeInstr"); | 797 __ TraceSimMsg("StringCharCodeInstr From"); |
| 797 | 798 |
| 798 __ LoadImmediate(result, | 799 __ LoadImmediate(result, |
| 799 reinterpret_cast<uword>(Symbols::PredefinedAddress())); | 800 reinterpret_cast<uword>(Symbols::PredefinedAddress())); |
| 800 __ AddImmediate(result, Symbols::kNullCharCodeSymbolOffset * kWordSize); | 801 __ AddImmediate(result, Symbols::kNullCharCodeSymbolOffset * kWordSize); |
| 801 __ sll(TMP, char_code, 1); // Char code is a smi. | 802 __ sll(TMP, char_code, 1); // Char code is a smi. |
| 802 __ addu(TMP, TMP, result); | 803 __ addu(TMP, TMP, result); |
| 803 __ lw(result, Address(TMP)); | 804 __ lw(result, Address(TMP)); |
| 805 } else { |
| 806 __ TraceSimMsg("StringCharCodeInstr To"); |
| 807 |
| 808 ASSERT(kind() == StringCharCodeInstr::kToCharCode); |
| 809 ASSERT(cid_ == kOneByteStringCid); |
| 810 Register str = locs()->in(0).reg(); |
| 811 Register result = locs()->out().reg(); |
| 812 Label done, is_one; |
| 813 __ lw(result, FieldAddress(str, String::length_offset())); |
| 814 __ BranchEqual(result, Smi::RawValue(1), &is_one); |
| 815 __ LoadImmediate(result, Smi::RawValue(-1)); |
| 816 __ b(&done); |
| 817 __ Bind(&is_one); |
| 818 __ lbu(result, FieldAddress(str, OneByteString::data_offset())); |
| 819 __ SmiTag(result); |
| 820 __ Bind(&done); |
| 821 } |
| 804 } | 822 } |
| 805 | 823 |
| 806 | 824 |
| 807 LocationSummary* StringInterpolateInstr::MakeLocationSummary(bool opt) const { | 825 LocationSummary* StringInterpolateInstr::MakeLocationSummary(bool opt) const { |
| 808 const intptr_t kNumInputs = 1; | 826 const intptr_t kNumInputs = 1; |
| 809 const intptr_t kNumTemps = 0; | 827 const intptr_t kNumTemps = 0; |
| 810 LocationSummary* summary = | 828 LocationSummary* summary = |
| 811 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | 829 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 812 summary->set_in(0, Location::RegisterLocation(A0)); | 830 summary->set_in(0, Location::RegisterLocation(A0)); |
| 813 summary->set_out(Location::RegisterLocation(V0)); | 831 summary->set_out(Location::RegisterLocation(V0)); |
| (...skipping 3367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4181 compiler->GenerateCall(token_pos(), | 4199 compiler->GenerateCall(token_pos(), |
| 4182 &label, | 4200 &label, |
| 4183 PcDescriptors::kOther, | 4201 PcDescriptors::kOther, |
| 4184 locs()); | 4202 locs()); |
| 4185 __ Drop(2); // Discard type arguments and receiver. | 4203 __ Drop(2); // Discard type arguments and receiver. |
| 4186 } | 4204 } |
| 4187 | 4205 |
| 4188 } // namespace dart | 4206 } // namespace dart |
| 4189 | 4207 |
| 4190 #endif // defined TARGET_ARCH_MIPS | 4208 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |