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 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 __ SmiTag(result); | 1234 __ SmiTag(result); |
1235 break; | 1235 break; |
1236 default: | 1236 default: |
1237 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); | 1237 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); |
1238 __ lw(result, element_address); | 1238 __ lw(result, element_address); |
1239 break; | 1239 break; |
1240 } | 1240 } |
1241 } | 1241 } |
1242 | 1242 |
1243 | 1243 |
| 1244 LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Isolate* isolate, |
| 1245 bool opt) const { |
| 1246 const intptr_t kNumInputs = 2; |
| 1247 const intptr_t kNumTemps = 0; |
| 1248 LocationSummary* summary = new(isolate) LocationSummary( |
| 1249 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1250 summary->set_in(0, Location::RequiresRegister()); |
| 1251 summary->set_in(1, Location::RequiresRegister()); |
| 1252 |
| 1253 // TODO(zerny): Handle mints properly once possible. |
| 1254 ASSERT(representation() == kTagged); |
| 1255 summary->set_out(0, Location::RequiresRegister()); |
| 1256 |
| 1257 return summary; |
| 1258 } |
| 1259 |
| 1260 |
| 1261 void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1262 const Register array = locs()->in(0).reg(); |
| 1263 const Location index = locs()->in(1); |
| 1264 |
| 1265 Address element_address = __ ElementAddressForRegIndex( |
| 1266 true, IsExternal(), class_id(), index_scale(), array, index.reg()); |
| 1267 // Warning: element_address may use register TMP as base. |
| 1268 |
| 1269 ASSERT(representation() == kTagged); |
| 1270 Register result = locs()->out(0).reg(); |
| 1271 switch (class_id()) { |
| 1272 case kOneByteStringCid: |
| 1273 switch (element_count()) { |
| 1274 case 1: __ lbu(result, element_address); break; |
| 1275 case 2: __ lhu(result, element_address); break; |
| 1276 case 4: // Loading multiple code units is disabled on MIPS. |
| 1277 default: UNREACHABLE(); |
| 1278 } |
| 1279 __ SmiTag(result); |
| 1280 break; |
| 1281 case kTwoByteStringCid: |
| 1282 switch (element_count()) { |
| 1283 case 1: __ lhu(result, element_address); break; |
| 1284 case 2: // Loading multiple code units is disabled on MIPS. |
| 1285 default: UNREACHABLE(); |
| 1286 } |
| 1287 __ SmiTag(result); |
| 1288 break; |
| 1289 default: |
| 1290 UNREACHABLE(); |
| 1291 break; |
| 1292 } |
| 1293 } |
| 1294 |
| 1295 |
1244 Representation StoreIndexedInstr::RequiredInputRepresentation( | 1296 Representation StoreIndexedInstr::RequiredInputRepresentation( |
1245 intptr_t idx) const { | 1297 intptr_t idx) const { |
1246 // Array can be a Dart object or a pointer to external data. | 1298 // Array can be a Dart object or a pointer to external data. |
1247 if (idx == 0) return kNoRepresentation; // Flexible input representation. | 1299 if (idx == 0) return kNoRepresentation; // Flexible input representation. |
1248 if (idx == 1) return kTagged; // Index is a smi. | 1300 if (idx == 1) return kTagged; // Index is a smi. |
1249 ASSERT(idx == 2); | 1301 ASSERT(idx == 2); |
1250 switch (class_id_) { | 1302 switch (class_id_) { |
1251 case kArrayCid: | 1303 case kArrayCid: |
1252 case kOneByteStringCid: | 1304 case kOneByteStringCid: |
1253 case kTypedDataInt8ArrayCid: | 1305 case kTypedDataInt8ArrayCid: |
(...skipping 2483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3737 } else if (kind() == MathUnaryInstr::kDoubleSquare) { | 3789 } else if (kind() == MathUnaryInstr::kDoubleSquare) { |
3738 DRegister val = locs()->in(0).fpu_reg(); | 3790 DRegister val = locs()->in(0).fpu_reg(); |
3739 DRegister result = locs()->out(0).fpu_reg(); | 3791 DRegister result = locs()->out(0).fpu_reg(); |
3740 __ muld(result, val, val); | 3792 __ muld(result, val, val); |
3741 } else { | 3793 } else { |
3742 __ CallRuntime(TargetFunction(), InputCount()); | 3794 __ CallRuntime(TargetFunction(), InputCount()); |
3743 } | 3795 } |
3744 } | 3796 } |
3745 | 3797 |
3746 | 3798 |
| 3799 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary( |
| 3800 Isolate* isolate, bool opt) const { |
| 3801 const intptr_t kNumTemps = 0; |
| 3802 LocationSummary* summary = new(isolate) LocationSummary( |
| 3803 isolate, InputCount(), kNumTemps, LocationSummary::kCall); |
| 3804 summary->set_in(0, Location::RegisterLocation(A0)); |
| 3805 summary->set_in(1, Location::RegisterLocation(A1)); |
| 3806 summary->set_in(2, Location::RegisterLocation(A2)); |
| 3807 summary->set_in(3, Location::RegisterLocation(A3)); |
| 3808 summary->set_out(0, Location::RegisterLocation(V0)); |
| 3809 return summary; |
| 3810 } |
| 3811 |
| 3812 |
| 3813 void CaseInsensitiveCompareUC16Instr::EmitNativeCode( |
| 3814 FlowGraphCompiler* compiler) { |
| 3815 |
| 3816 // Call the function. |
| 3817 __ CallRuntime(TargetFunction(), TargetFunction().argument_count()); |
| 3818 } |
| 3819 |
| 3820 |
3747 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, | 3821 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, |
3748 bool opt) const { | 3822 bool opt) const { |
3749 if (result_cid() == kDoubleCid) { | 3823 if (result_cid() == kDoubleCid) { |
3750 const intptr_t kNumInputs = 2; | 3824 const intptr_t kNumInputs = 2; |
3751 const intptr_t kNumTemps = 1; | 3825 const intptr_t kNumTemps = 1; |
3752 LocationSummary* summary = new(isolate) LocationSummary( | 3826 LocationSummary* summary = new(isolate) LocationSummary( |
3753 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 3827 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
3754 summary->set_in(0, Location::RequiresFpuRegister()); | 3828 summary->set_in(0, Location::RequiresFpuRegister()); |
3755 summary->set_in(1, Location::RequiresFpuRegister()); | 3829 summary->set_in(1, Location::RequiresFpuRegister()); |
3756 // Reuse the left register so that code can be made shorter. | 3830 // Reuse the left register so that code can be made shorter. |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4714 } | 4788 } |
4715 | 4789 |
4716 // We can fall through if the successor is the next block in the list. | 4790 // We can fall through if the successor is the next block in the list. |
4717 // Otherwise, we need a jump. | 4791 // Otherwise, we need a jump. |
4718 if (!compiler->CanFallThroughTo(successor())) { | 4792 if (!compiler->CanFallThroughTo(successor())) { |
4719 __ b(compiler->GetJumpLabel(successor())); | 4793 __ b(compiler->GetJumpLabel(successor())); |
4720 } | 4794 } |
4721 } | 4795 } |
4722 | 4796 |
4723 | 4797 |
| 4798 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Isolate* isolate, |
| 4799 bool opt) const { |
| 4800 const intptr_t kNumInputs = 1; |
| 4801 const intptr_t kNumTemps = 1; |
| 4802 |
| 4803 LocationSummary* summary = new(isolate) LocationSummary( |
| 4804 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4805 |
| 4806 summary->set_in(0, Location::RequiresRegister()); |
| 4807 summary->set_temp(0, Location::RequiresRegister()); |
| 4808 |
| 4809 return summary; |
| 4810 } |
| 4811 |
| 4812 |
| 4813 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4814 Register target_address_reg = locs()->temp_slot(0)->reg(); |
| 4815 |
| 4816 // Load from [current frame pointer] + kPcMarkerSlotFromFp. |
| 4817 __ lw(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize)); |
| 4818 |
| 4819 // Add the offset. |
| 4820 Register offset_reg = locs()->in(0).reg(); |
| 4821 __ SmiUntag(offset_reg); |
| 4822 __ addu(target_address_reg, target_address_reg, offset_reg); |
| 4823 |
| 4824 // Jump to the absolute address. |
| 4825 __ jr(target_address_reg); |
| 4826 } |
| 4827 |
| 4828 |
4724 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, | 4829 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, |
4725 bool opt) const { | 4830 bool opt) const { |
4726 const intptr_t kNumInputs = 2; | 4831 const intptr_t kNumInputs = 2; |
4727 const intptr_t kNumTemps = 0; | 4832 const intptr_t kNumTemps = 0; |
4728 if (needs_number_check()) { | 4833 if (needs_number_check()) { |
4729 LocationSummary* locs = new(isolate) LocationSummary( | 4834 LocationSummary* locs = new(isolate) LocationSummary( |
4730 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); | 4835 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); |
4731 locs->set_in(0, Location::RegisterLocation(A0)); | 4836 locs->set_in(0, Location::RegisterLocation(A0)); |
4732 locs->set_in(1, Location::RegisterLocation(A1)); | 4837 locs->set_in(1, Location::RegisterLocation(A1)); |
4733 locs->set_out(0, Location::RegisterLocation(A0)); | 4838 locs->set_out(0, Location::RegisterLocation(A0)); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4854 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 4959 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
4855 #if defined(DEBUG) | 4960 #if defined(DEBUG) |
4856 __ LoadImmediate(S4, kInvalidObjectPointer); | 4961 __ LoadImmediate(S4, kInvalidObjectPointer); |
4857 __ LoadImmediate(S5, kInvalidObjectPointer); | 4962 __ LoadImmediate(S5, kInvalidObjectPointer); |
4858 #endif | 4963 #endif |
4859 } | 4964 } |
4860 | 4965 |
4861 } // namespace dart | 4966 } // namespace dart |
4862 | 4967 |
4863 #endif // defined TARGET_ARCH_MIPS | 4968 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |