OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
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 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 __ SmiTag(result); | 1127 __ SmiTag(result); |
1128 break; | 1128 break; |
1129 default: | 1129 default: |
1130 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); | 1130 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); |
1131 __ ldr(result, element_address); | 1131 __ ldr(result, element_address); |
1132 break; | 1132 break; |
1133 } | 1133 } |
1134 } | 1134 } |
1135 | 1135 |
1136 | 1136 |
| 1137 Representation LoadCodeUnitsInstr::representation() const { |
| 1138 switch (class_id()) { |
| 1139 case kOneByteStringCid: |
| 1140 case kTwoByteStringCid: |
| 1141 case kExternalOneByteStringCid: |
| 1142 case kExternalTwoByteStringCid: |
| 1143 return kTagged; |
| 1144 default: |
| 1145 UNIMPLEMENTED(); |
| 1146 return kTagged; |
| 1147 } |
| 1148 } |
| 1149 |
| 1150 |
| 1151 LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Isolate* isolate, |
| 1152 bool opt) const { |
| 1153 const intptr_t kNumInputs = 2; |
| 1154 const intptr_t kNumTemps = 0; |
| 1155 LocationSummary* locs = new(isolate) LocationSummary( |
| 1156 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1157 locs->set_in(0, Location::RequiresRegister()); |
| 1158 locs->set_in(1, Location::RequiresRegister()); |
| 1159 locs->set_out(0, Location::RequiresRegister()); |
| 1160 return locs; |
| 1161 } |
| 1162 |
| 1163 |
| 1164 void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1165 const Register array = locs()->in(0).reg(); |
| 1166 const Location index = locs()->in(1); |
| 1167 |
| 1168 Address element_address = __ ElementAddressForRegIndex( |
| 1169 true, IsExternal(), class_id(), index_scale(), array, index.reg()); |
| 1170 // Warning: element_address may use register TMP as base. |
| 1171 |
| 1172 Register result = locs()->out(0).reg(); |
| 1173 switch (class_id()) { |
| 1174 case kOneByteStringCid: |
| 1175 case kExternalOneByteStringCid: |
| 1176 switch (element_count()) { |
| 1177 case 1: __ ldr(result, element_address, kUnsignedByte); break; |
| 1178 case 2: __ ldr(result, element_address, kUnsignedHalfword); break; |
| 1179 case 4: __ ldr(result, element_address, kUnsignedWord); break; |
| 1180 default: UNREACHABLE(); |
| 1181 } |
| 1182 __ SmiTag(result); |
| 1183 break; |
| 1184 case kTwoByteStringCid: |
| 1185 case kExternalTwoByteStringCid: |
| 1186 switch (element_count()) { |
| 1187 case 1: __ ldr(result, element_address, kUnsignedHalfword); break; |
| 1188 case 2: __ ldr(result, element_address, kUnsignedWord); break; |
| 1189 default: UNREACHABLE(); |
| 1190 } |
| 1191 __ SmiTag(result); |
| 1192 break; |
| 1193 default: |
| 1194 UNREACHABLE(); |
| 1195 break; |
| 1196 } |
| 1197 } |
| 1198 |
| 1199 |
1137 Representation StoreIndexedInstr::RequiredInputRepresentation( | 1200 Representation StoreIndexedInstr::RequiredInputRepresentation( |
1138 intptr_t idx) const { | 1201 intptr_t idx) const { |
1139 // Array can be a Dart object or a pointer to external data. | 1202 // Array can be a Dart object or a pointer to external data. |
1140 if (idx == 0) return kNoRepresentation; // Flexible input representation. | 1203 if (idx == 0) return kNoRepresentation; // Flexible input representation. |
1141 if (idx == 1) return kTagged; // Index is a smi. | 1204 if (idx == 1) return kTagged; // Index is a smi. |
1142 ASSERT(idx == 2); | 1205 ASSERT(idx == 2); |
1143 switch (class_id_) { | 1206 switch (class_id_) { |
1144 case kArrayCid: | 1207 case kArrayCid: |
1145 case kOneByteStringCid: | 1208 case kOneByteStringCid: |
1146 case kTypedDataInt8ArrayCid: | 1209 case kTypedDataInt8ArrayCid: |
(...skipping 3090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4237 const VRegister result = locs()->out(0).fpu_reg(); | 4300 const VRegister result = locs()->out(0).fpu_reg(); |
4238 __ fmuld(result, val, val); | 4301 __ fmuld(result, val, val); |
4239 } else { | 4302 } else { |
4240 ASSERT((kind() == MathUnaryInstr::kSin) || | 4303 ASSERT((kind() == MathUnaryInstr::kSin) || |
4241 (kind() == MathUnaryInstr::kCos)); | 4304 (kind() == MathUnaryInstr::kCos)); |
4242 __ CallRuntime(TargetFunction(), InputCount()); | 4305 __ CallRuntime(TargetFunction(), InputCount()); |
4243 } | 4306 } |
4244 } | 4307 } |
4245 | 4308 |
4246 | 4309 |
| 4310 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary( |
| 4311 Isolate* isolate, bool opt) const { |
| 4312 const intptr_t kNumTemps = 0; |
| 4313 LocationSummary* summary = new(isolate) LocationSummary( |
| 4314 isolate, InputCount(), kNumTemps, LocationSummary::kCall); |
| 4315 summary->set_in(0, Location::RegisterLocation(R0)); |
| 4316 summary->set_in(1, Location::RegisterLocation(R1)); |
| 4317 summary->set_in(2, Location::RegisterLocation(R2)); |
| 4318 summary->set_in(3, Location::RegisterLocation(R3)); |
| 4319 summary->set_out(0, Location::RegisterLocation(R0)); |
| 4320 return summary; |
| 4321 } |
| 4322 |
| 4323 |
| 4324 void CaseInsensitiveCompareUC16Instr::EmitNativeCode( |
| 4325 FlowGraphCompiler* compiler) { |
| 4326 |
| 4327 // Call the function. |
| 4328 __ CallRuntime(TargetFunction(), TargetFunction().argument_count()); |
| 4329 } |
| 4330 |
| 4331 |
4247 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, | 4332 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, |
4248 bool opt) const { | 4333 bool opt) const { |
4249 if (result_cid() == kDoubleCid) { | 4334 if (result_cid() == kDoubleCid) { |
4250 const intptr_t kNumInputs = 2; | 4335 const intptr_t kNumInputs = 2; |
4251 const intptr_t kNumTemps = 0; | 4336 const intptr_t kNumTemps = 0; |
4252 LocationSummary* summary = new(isolate) LocationSummary( | 4337 LocationSummary* summary = new(isolate) LocationSummary( |
4253 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4338 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
4254 summary->set_in(0, Location::RequiresFpuRegister()); | 4339 summary->set_in(0, Location::RequiresFpuRegister()); |
4255 summary->set_in(1, Location::RequiresFpuRegister()); | 4340 summary->set_in(1, Location::RequiresFpuRegister()); |
4256 // Reuse the left register so that code can be made shorter. | 4341 // Reuse the left register so that code can be made shorter. |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5345 } | 5430 } |
5346 | 5431 |
5347 // We can fall through if the successor is the next block in the list. | 5432 // We can fall through if the successor is the next block in the list. |
5348 // Otherwise, we need a jump. | 5433 // Otherwise, we need a jump. |
5349 if (!compiler->CanFallThroughTo(successor())) { | 5434 if (!compiler->CanFallThroughTo(successor())) { |
5350 __ b(compiler->GetJumpLabel(successor())); | 5435 __ b(compiler->GetJumpLabel(successor())); |
5351 } | 5436 } |
5352 } | 5437 } |
5353 | 5438 |
5354 | 5439 |
| 5440 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Isolate* isolate, |
| 5441 bool opt) const { |
| 5442 const intptr_t kNumInputs = 1; |
| 5443 const intptr_t kNumTemps = 1; |
| 5444 |
| 5445 LocationSummary* locs = new(isolate) LocationSummary( |
| 5446 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5447 |
| 5448 locs->set_in(0, Location::RequiresRegister()); |
| 5449 locs->set_temp(0, Location::RequiresRegister()); |
| 5450 |
| 5451 return locs; |
| 5452 } |
| 5453 |
| 5454 |
| 5455 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5456 Register target_address_reg = locs()->temp_slot(0)->reg(); |
| 5457 |
| 5458 // Load from [current frame pointer] + kPcMarkerSlotFromFp. |
| 5459 __ ldr(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize)); |
| 5460 |
| 5461 // Add the offset. |
| 5462 Register offset_reg = locs()->in(0).reg(); |
| 5463 __ add(target_address_reg, |
| 5464 target_address_reg, |
| 5465 Operand(offset_reg, ASR, kSmiTagSize)); |
| 5466 |
| 5467 // Jump to the absolute address. |
| 5468 __ br(target_address_reg); |
| 5469 } |
| 5470 |
| 5471 |
5355 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, | 5472 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, |
5356 bool opt) const { | 5473 bool opt) const { |
5357 const intptr_t kNumInputs = 2; | 5474 const intptr_t kNumInputs = 2; |
5358 const intptr_t kNumTemps = 0; | 5475 const intptr_t kNumTemps = 0; |
5359 if (needs_number_check()) { | 5476 if (needs_number_check()) { |
5360 LocationSummary* locs = new(isolate) LocationSummary( | 5477 LocationSummary* locs = new(isolate) LocationSummary( |
5361 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); | 5478 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); |
5362 locs->set_in(0, Location::RegisterLocation(R0)); | 5479 locs->set_in(0, Location::RegisterLocation(R0)); |
5363 locs->set_in(1, Location::RegisterLocation(R1)); | 5480 locs->set_in(1, Location::RegisterLocation(R1)); |
5364 locs->set_out(0, Location::RegisterLocation(R0)); | 5481 locs->set_out(0, Location::RegisterLocation(R0)); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5481 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 5598 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
5482 #if defined(DEBUG) | 5599 #if defined(DEBUG) |
5483 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP); | 5600 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP); |
5484 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP); | 5601 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP); |
5485 #endif | 5602 #endif |
5486 } | 5603 } |
5487 | 5604 |
5488 } // namespace dart | 5605 } // namespace dart |
5489 | 5606 |
5490 #endif // defined TARGET_ARCH_ARM64 | 5607 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |