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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 | 803 |
804 __ LoadImmediate(result, | 804 __ LoadImmediate(result, |
805 reinterpret_cast<uword>(Symbols::PredefinedAddress())); | 805 reinterpret_cast<uword>(Symbols::PredefinedAddress())); |
806 __ AddImmediate(result, Symbols::kNullCharCodeSymbolOffset * kWordSize); | 806 __ AddImmediate(result, Symbols::kNullCharCodeSymbolOffset * kWordSize); |
807 __ sll(TMP, char_code, 1); // Char code is a smi. | 807 __ sll(TMP, char_code, 1); // Char code is a smi. |
808 __ addu(TMP, TMP, result); | 808 __ addu(TMP, TMP, result); |
809 __ lw(result, Address(TMP)); | 809 __ lw(result, Address(TMP)); |
810 } | 810 } |
811 | 811 |
812 | 812 |
| 813 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(bool opt) const { |
| 814 const intptr_t kNumInputs = 1; |
| 815 return LocationSummary::Make(kNumInputs, |
| 816 Location::RequiresRegister(), |
| 817 LocationSummary::kNoCall); |
| 818 } |
| 819 |
| 820 |
| 821 void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 822 __ TraceSimMsg("StringToCharCodeInstr"); |
| 823 |
| 824 ASSERT(cid_ == kOneByteStringCid); |
| 825 Register str = locs()->in(0).reg(); |
| 826 Register result = locs()->out().reg(); |
| 827 Label done, is_one; |
| 828 __ lw(result, FieldAddress(str, String::length_offset())); |
| 829 __ BranchEqual(result, Smi::RawValue(1), &is_one); |
| 830 __ LoadImmediate(result, Smi::RawValue(-1)); |
| 831 __ b(&done); |
| 832 __ Bind(&is_one); |
| 833 __ lbu(result, FieldAddress(str, OneByteString::data_offset())); |
| 834 __ SmiTag(result); |
| 835 __ Bind(&done); |
| 836 } |
| 837 |
| 838 |
813 LocationSummary* StringInterpolateInstr::MakeLocationSummary(bool opt) const { | 839 LocationSummary* StringInterpolateInstr::MakeLocationSummary(bool opt) const { |
814 const intptr_t kNumInputs = 1; | 840 const intptr_t kNumInputs = 1; |
815 const intptr_t kNumTemps = 0; | 841 const intptr_t kNumTemps = 0; |
816 LocationSummary* summary = | 842 LocationSummary* summary = |
817 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | 843 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
818 summary->set_in(0, Location::RegisterLocation(A0)); | 844 summary->set_in(0, Location::RegisterLocation(A0)); |
819 summary->set_out(Location::RegisterLocation(V0)); | 845 summary->set_out(Location::RegisterLocation(V0)); |
820 return summary; | 846 return summary; |
821 } | 847 } |
822 | 848 |
(...skipping 3364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4187 compiler->GenerateCall(token_pos(), | 4213 compiler->GenerateCall(token_pos(), |
4188 &label, | 4214 &label, |
4189 PcDescriptors::kOther, | 4215 PcDescriptors::kOther, |
4190 locs()); | 4216 locs()); |
4191 __ Drop(2); // Discard type arguments and receiver. | 4217 __ Drop(2); // Discard type arguments and receiver. |
4192 } | 4218 } |
4193 | 4219 |
4194 } // namespace dart | 4220 } // namespace dart |
4195 | 4221 |
4196 #endif // defined TARGET_ARCH_MIPS | 4222 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |