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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; | 94 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
95 ASSERT(fp_sp_dist <= 0); | 95 ASSERT(fp_sp_dist <= 0); |
96 __ subu(CMPRES1, SP, FP); | 96 __ subu(CMPRES1, SP, FP); |
97 | 97 |
98 __ BranchEqual(CMPRES1, fp_sp_dist, &stack_ok); | 98 __ BranchEqual(CMPRES1, fp_sp_dist, &stack_ok); |
99 __ break_(0); | 99 __ break_(0); |
100 | 100 |
101 __ Bind(&stack_ok); | 101 __ Bind(&stack_ok); |
102 } | 102 } |
103 #endif | 103 #endif |
104 // This sequence is patched by a debugger breakpoint. There is no need for | |
105 // extra NOP instructions here because the sequence patched in for a | |
106 // breakpoint is shorter than the sequence here. | |
107 __ LeaveDartFrameAndReturn(); | 104 __ LeaveDartFrameAndReturn(); |
108 compiler->AddCurrentDescriptor(PcDescriptors::kReturn, | |
109 Isolate::kNoDeoptId, | |
110 token_pos()); | |
111 } | 105 } |
112 | 106 |
113 | 107 |
114 static Condition NegateCondition(Condition condition) { | 108 static Condition NegateCondition(Condition condition) { |
115 switch (condition) { | 109 switch (condition) { |
116 case EQ: return NE; | 110 case EQ: return NE; |
117 case NE: return EQ; | 111 case NE: return EQ; |
118 case LT: return GE; | 112 case LT: return GE; |
119 case LE: return GT; | 113 case LE: return GT; |
120 case GT: return LE; | 114 case GT: return LE; |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 | 797 |
804 __ LoadImmediate(result, | 798 __ LoadImmediate(result, |
805 reinterpret_cast<uword>(Symbols::PredefinedAddress())); | 799 reinterpret_cast<uword>(Symbols::PredefinedAddress())); |
806 __ AddImmediate(result, Symbols::kNullCharCodeSymbolOffset * kWordSize); | 800 __ AddImmediate(result, Symbols::kNullCharCodeSymbolOffset * kWordSize); |
807 __ sll(TMP, char_code, 1); // Char code is a smi. | 801 __ sll(TMP, char_code, 1); // Char code is a smi. |
808 __ addu(TMP, TMP, result); | 802 __ addu(TMP, TMP, result); |
809 __ lw(result, Address(TMP)); | 803 __ lw(result, Address(TMP)); |
810 } | 804 } |
811 | 805 |
812 | 806 |
| 807 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(bool opt) const { |
| 808 const intptr_t kNumInputs = 1; |
| 809 return LocationSummary::Make(kNumInputs, |
| 810 Location::RequiresRegister(), |
| 811 LocationSummary::kNoCall); |
| 812 } |
| 813 |
| 814 |
| 815 void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 816 __ TraceSimMsg("StringToCharCodeInstr"); |
| 817 |
| 818 ASSERT(cid_ == kOneByteStringCid); |
| 819 Register str = locs()->in(0).reg(); |
| 820 Register result = locs()->out().reg(); |
| 821 Label done, is_one; |
| 822 __ lw(result, FieldAddress(str, String::length_offset())); |
| 823 __ BranchEqual(result, Smi::RawValue(1), &is_one); |
| 824 __ LoadImmediate(result, Smi::RawValue(-1)); |
| 825 __ b(&done); |
| 826 __ Bind(&is_one); |
| 827 __ lbu(result, FieldAddress(str, OneByteString::data_offset())); |
| 828 __ SmiTag(result); |
| 829 __ Bind(&done); |
| 830 } |
| 831 |
| 832 |
813 LocationSummary* StringInterpolateInstr::MakeLocationSummary(bool opt) const { | 833 LocationSummary* StringInterpolateInstr::MakeLocationSummary(bool opt) const { |
814 const intptr_t kNumInputs = 1; | 834 const intptr_t kNumInputs = 1; |
815 const intptr_t kNumTemps = 0; | 835 const intptr_t kNumTemps = 0; |
816 LocationSummary* summary = | 836 LocationSummary* summary = |
817 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | 837 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
818 summary->set_in(0, Location::RegisterLocation(A0)); | 838 summary->set_in(0, Location::RegisterLocation(A0)); |
819 summary->set_out(Location::RegisterLocation(V0)); | 839 summary->set_out(Location::RegisterLocation(V0)); |
820 return summary; | 840 return summary; |
821 } | 841 } |
822 | 842 |
(...skipping 3364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4187 compiler->GenerateCall(token_pos(), | 4207 compiler->GenerateCall(token_pos(), |
4188 &label, | 4208 &label, |
4189 PcDescriptors::kOther, | 4209 PcDescriptors::kOther, |
4190 locs()); | 4210 locs()); |
4191 __ Drop(2); // Discard type arguments and receiver. | 4211 __ Drop(2); // Discard type arguments and receiver. |
4192 } | 4212 } |
4193 | 4213 |
4194 } // namespace dart | 4214 } // namespace dart |
4195 | 4215 |
4196 #endif // defined TARGET_ARCH_MIPS | 4216 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |