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 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 bool opt) const { | 1015 bool opt) const { |
1016 const intptr_t kNumInputs = 1; | 1016 const intptr_t kNumInputs = 1; |
1017 return LocationSummary::Make(isolate, | 1017 return LocationSummary::Make(isolate, |
1018 kNumInputs, | 1018 kNumInputs, |
1019 Location::RequiresRegister(), | 1019 Location::RequiresRegister(), |
1020 LocationSummary::kNoCall); | 1020 LocationSummary::kNoCall); |
1021 } | 1021 } |
1022 | 1022 |
1023 | 1023 |
1024 void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1024 void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1025 Register object = locs()->in(0).reg(); | 1025 Register obj = locs()->in(0).reg(); |
1026 Register result = locs()->out(0).reg(); | 1026 Register result = locs()->out(0).reg(); |
1027 __ LoadFromOffset(result, object, offset() - kHeapObjectTag); | 1027 if (object()->definition()->representation() == kUntagged) { |
| 1028 __ LoadFromOffset(result, obj, offset()); |
| 1029 } else { |
| 1030 ASSERT(object()->definition()->representation() == kTagged); |
| 1031 __ LoadFieldFromOffset(result, obj, offset()); |
| 1032 } |
1028 } | 1033 } |
1029 | 1034 |
1030 | 1035 |
1031 LocationSummary* LoadClassIdInstr::MakeLocationSummary(Isolate* isolate, | 1036 LocationSummary* LoadClassIdInstr::MakeLocationSummary(Isolate* isolate, |
1032 bool opt) const { | 1037 bool opt) const { |
1033 const intptr_t kNumInputs = 1; | 1038 const intptr_t kNumInputs = 1; |
1034 return LocationSummary::Make(isolate, | 1039 return LocationSummary::Make(isolate, |
1035 kNumInputs, | 1040 kNumInputs, |
1036 Location::RequiresRegister(), | 1041 Location::RequiresRegister(), |
1037 LocationSummary::kNoCall); | 1042 LocationSummary::kNoCall); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1252 | 1257 |
1253 // TODO(zerny): Handle mints properly once possible. | 1258 // TODO(zerny): Handle mints properly once possible. |
1254 ASSERT(representation() == kTagged); | 1259 ASSERT(representation() == kTagged); |
1255 summary->set_out(0, Location::RequiresRegister()); | 1260 summary->set_out(0, Location::RequiresRegister()); |
1256 | 1261 |
1257 return summary; | 1262 return summary; |
1258 } | 1263 } |
1259 | 1264 |
1260 | 1265 |
1261 void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1266 void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1262 const Register array = locs()->in(0).reg(); | 1267 // The string register points to the backing store for external strings. |
| 1268 const Register str = locs()->in(0).reg(); |
1263 const Location index = locs()->in(1); | 1269 const Location index = locs()->in(1); |
1264 | 1270 |
1265 Address element_address = __ ElementAddressForRegIndex( | 1271 Address element_address = __ ElementAddressForRegIndex( |
1266 true, IsExternal(), class_id(), index_scale(), array, index.reg()); | 1272 true, IsExternal(), class_id(), index_scale(), str, index.reg()); |
1267 // Warning: element_address may use register TMP as base. | 1273 // Warning: element_address may use register TMP as base. |
1268 | 1274 |
1269 ASSERT(representation() == kTagged); | 1275 ASSERT(representation() == kTagged); |
1270 Register result = locs()->out(0).reg(); | 1276 Register result = locs()->out(0).reg(); |
1271 switch (class_id()) { | 1277 switch (class_id()) { |
1272 case kOneByteStringCid: | 1278 case kOneByteStringCid: |
| 1279 case kExternalOneByteStringCid: |
1273 switch (element_count()) { | 1280 switch (element_count()) { |
1274 case 1: __ lbu(result, element_address); break; | 1281 case 1: __ lbu(result, element_address); break; |
1275 case 2: __ lhu(result, element_address); break; | 1282 case 2: __ lhu(result, element_address); break; |
1276 case 4: // Loading multiple code units is disabled on MIPS. | 1283 case 4: // Loading multiple code units is disabled on MIPS. |
1277 default: UNREACHABLE(); | 1284 default: UNREACHABLE(); |
1278 } | 1285 } |
1279 __ SmiTag(result); | 1286 __ SmiTag(result); |
1280 break; | 1287 break; |
1281 case kTwoByteStringCid: | 1288 case kTwoByteStringCid: |
| 1289 case kExternalTwoByteStringCid: |
1282 switch (element_count()) { | 1290 switch (element_count()) { |
1283 case 1: __ lhu(result, element_address); break; | 1291 case 1: __ lhu(result, element_address); break; |
1284 case 2: // Loading multiple code units is disabled on MIPS. | 1292 case 2: // Loading multiple code units is disabled on MIPS. |
1285 default: UNREACHABLE(); | 1293 default: UNREACHABLE(); |
1286 } | 1294 } |
1287 __ SmiTag(result); | 1295 __ SmiTag(result); |
1288 break; | 1296 break; |
1289 default: | 1297 default: |
1290 UNREACHABLE(); | 1298 UNREACHABLE(); |
1291 break; | 1299 break; |
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2234 __ lw(temp, FieldAddress(instance_reg, offset_in_bytes())); | 2242 __ lw(temp, FieldAddress(instance_reg, offset_in_bytes())); |
2235 __ LoadDFromOffset(value, temp, Double::value_offset() - kHeapObjectTag); | 2243 __ LoadDFromOffset(value, temp, Double::value_offset() - kHeapObjectTag); |
2236 __ StoreDToOffset(value, | 2244 __ StoreDToOffset(value, |
2237 result_reg, | 2245 result_reg, |
2238 Double::value_offset() - kHeapObjectTag); | 2246 Double::value_offset() - kHeapObjectTag); |
2239 __ b(&done); | 2247 __ b(&done); |
2240 } | 2248 } |
2241 | 2249 |
2242 __ Bind(&load_pointer); | 2250 __ Bind(&load_pointer); |
2243 } | 2251 } |
2244 __ LoadFromOffset( | 2252 __ LoadFieldFromOffset(result_reg, instance_reg, offset_in_bytes()); |
2245 result_reg, instance_reg, offset_in_bytes() - kHeapObjectTag); | |
2246 __ Bind(&done); | 2253 __ Bind(&done); |
2247 } | 2254 } |
2248 | 2255 |
2249 | 2256 |
2250 LocationSummary* InstantiateTypeInstr::MakeLocationSummary(Isolate* isolate, | 2257 LocationSummary* InstantiateTypeInstr::MakeLocationSummary(Isolate* isolate, |
2251 bool opt) const { | 2258 bool opt) const { |
2252 const intptr_t kNumInputs = 1; | 2259 const intptr_t kNumInputs = 1; |
2253 const intptr_t kNumTemps = 0; | 2260 const intptr_t kNumTemps = 0; |
2254 LocationSummary* locs = new(isolate) LocationSummary( | 2261 LocationSummary* locs = new(isolate) LocationSummary( |
2255 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); | 2262 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); |
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3314 summary->set_in(0, Location::RequiresRegister()); | 3321 summary->set_in(0, Location::RequiresRegister()); |
3315 summary->set_out(0, Location::RequiresRegister()); | 3322 summary->set_out(0, Location::RequiresRegister()); |
3316 return summary; | 3323 return summary; |
3317 } | 3324 } |
3318 | 3325 |
3319 | 3326 |
3320 static void LoadInt32FromMint(FlowGraphCompiler* compiler, | 3327 static void LoadInt32FromMint(FlowGraphCompiler* compiler, |
3321 Register mint, | 3328 Register mint, |
3322 Register result, | 3329 Register result, |
3323 Label* deopt) { | 3330 Label* deopt) { |
3324 __ LoadFromOffset(result, | 3331 __ LoadFieldFromOffset(result, mint, Mint::value_offset()); |
3325 mint, | |
3326 Mint::value_offset() - kHeapObjectTag); | |
3327 if (deopt != NULL) { | 3332 if (deopt != NULL) { |
3328 __ LoadFromOffset(CMPRES1, | 3333 __ LoadFieldFromOffset(CMPRES1, |
3329 mint, | 3334 mint, |
3330 Mint::value_offset() - kHeapObjectTag + kWordSize); | 3335 Mint::value_offset() + kWordSize); |
3331 __ sra(CMPRES2, result, kBitsPerWord - 1); | 3336 __ sra(CMPRES2, result, kBitsPerWord - 1); |
3332 __ BranchNotEqual(CMPRES1, CMPRES2, deopt); | 3337 __ BranchNotEqual(CMPRES1, CMPRES2, deopt); |
3333 } | 3338 } |
3334 } | 3339 } |
3335 | 3340 |
3336 | 3341 |
3337 void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3342 void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { |
3338 const intptr_t value_cid = value()->Type()->ToCid(); | 3343 const intptr_t value_cid = value()->Type()->ToCid(); |
3339 const Register value = locs()->in(0).reg(); | 3344 const Register value = locs()->in(0).reg(); |
3340 const Register out = locs()->out(0).reg(); | 3345 const Register out = locs()->out(0).reg(); |
(...skipping 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4959 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 4964 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
4960 #if defined(DEBUG) | 4965 #if defined(DEBUG) |
4961 __ LoadImmediate(S4, kInvalidObjectPointer); | 4966 __ LoadImmediate(S4, kInvalidObjectPointer); |
4962 __ LoadImmediate(S5, kInvalidObjectPointer); | 4967 __ LoadImmediate(S5, kInvalidObjectPointer); |
4963 #endif | 4968 #endif |
4964 } | 4969 } |
4965 | 4970 |
4966 } // namespace dart | 4971 } // namespace dart |
4967 | 4972 |
4968 #endif // defined TARGET_ARCH_MIPS | 4973 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |