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 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 __ SmiTag(result); | 1128 __ SmiTag(result); |
1129 break; | 1129 break; |
1130 default: | 1130 default: |
1131 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); | 1131 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); |
1132 __ ldr(result, element_address); | 1132 __ ldr(result, element_address); |
1133 break; | 1133 break; |
1134 } | 1134 } |
1135 } | 1135 } |
1136 | 1136 |
1137 | 1137 |
| 1138 Representation LoadCodeUnitsInstr::representation() const { |
| 1139 switch (class_id()) { |
| 1140 case kOneByteStringCid: |
| 1141 case kTwoByteStringCid: |
| 1142 case kExternalOneByteStringCid: |
| 1143 case kExternalTwoByteStringCid: |
| 1144 return kTagged; |
| 1145 default: |
| 1146 UNIMPLEMENTED(); |
| 1147 return kTagged; |
| 1148 } |
| 1149 } |
| 1150 |
| 1151 |
| 1152 LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Isolate* isolate, |
| 1153 bool opt) const { |
| 1154 const intptr_t kNumInputs = 2; |
| 1155 const intptr_t kNumTemps = 0; |
| 1156 LocationSummary* summary = new(isolate) LocationSummary( |
| 1157 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1158 summary->set_in(0, Location::RequiresRegister()); |
| 1159 summary->set_in(1, Location::RequiresRegister()); |
| 1160 summary->set_out(0, Location::RequiresRegister()); |
| 1161 return summary; |
| 1162 } |
| 1163 |
| 1164 |
| 1165 void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1166 const Register array = locs()->in(0).reg(); |
| 1167 const Location index = locs()->in(1); |
| 1168 |
| 1169 Address element_address = __ ElementAddressForRegIndex( |
| 1170 true, IsExternal(), class_id(), index_scale(), array, index.reg()); |
| 1171 // Warning: element_address may use register TMP as base. |
| 1172 |
| 1173 Register result = locs()->out(0).reg(); |
| 1174 switch (class_id()) { |
| 1175 case kOneByteStringCid: |
| 1176 case kExternalOneByteStringCid: |
| 1177 switch (element_count()) { |
| 1178 case 1: __ ldr(result, element_address, kUnsignedByte); break; |
| 1179 case 2: __ ldr(result, element_address, kUnsignedHalfword); break; |
| 1180 case 4: __ ldr(result, element_address, kUnsignedWord); break; |
| 1181 default: UNREACHABLE(); |
| 1182 } |
| 1183 __ SmiTag(result); |
| 1184 break; |
| 1185 case kTwoByteStringCid: |
| 1186 case kExternalTwoByteStringCid: |
| 1187 switch (element_count()) { |
| 1188 case 1: __ ldr(result, element_address, kUnsignedHalfword); break; |
| 1189 case 2: __ ldr(result, element_address, kUnsignedWord); break; |
| 1190 default: UNREACHABLE(); |
| 1191 } |
| 1192 __ SmiTag(result); |
| 1193 break; |
| 1194 default: |
| 1195 UNREACHABLE(); |
| 1196 break; |
| 1197 } |
| 1198 } |
| 1199 |
| 1200 |
1138 Representation StoreIndexedInstr::RequiredInputRepresentation( | 1201 Representation StoreIndexedInstr::RequiredInputRepresentation( |
1139 intptr_t idx) const { | 1202 intptr_t idx) const { |
1140 // Array can be a Dart object or a pointer to external data. | 1203 // Array can be a Dart object or a pointer to external data. |
1141 if (idx == 0) return kNoRepresentation; // Flexible input representation. | 1204 if (idx == 0) return kNoRepresentation; // Flexible input representation. |
1142 if (idx == 1) return kTagged; // Index is a smi. | 1205 if (idx == 1) return kTagged; // Index is a smi. |
1143 ASSERT(idx == 2); | 1206 ASSERT(idx == 2); |
1144 switch (class_id_) { | 1207 switch (class_id_) { |
1145 case kArrayCid: | 1208 case kArrayCid: |
1146 case kOneByteStringCid: | 1209 case kOneByteStringCid: |
1147 case kTypedDataInt8ArrayCid: | 1210 case kTypedDataInt8ArrayCid: |
(...skipping 3166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4314 const VRegister result = locs()->out(0).fpu_reg(); | 4377 const VRegister result = locs()->out(0).fpu_reg(); |
4315 __ fmuld(result, val, val); | 4378 __ fmuld(result, val, val); |
4316 } else { | 4379 } else { |
4317 ASSERT((kind() == MathUnaryInstr::kSin) || | 4380 ASSERT((kind() == MathUnaryInstr::kSin) || |
4318 (kind() == MathUnaryInstr::kCos)); | 4381 (kind() == MathUnaryInstr::kCos)); |
4319 __ CallRuntime(TargetFunction(), InputCount()); | 4382 __ CallRuntime(TargetFunction(), InputCount()); |
4320 } | 4383 } |
4321 } | 4384 } |
4322 | 4385 |
4323 | 4386 |
| 4387 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary( |
| 4388 Isolate* isolate, bool opt) const { |
| 4389 const intptr_t kNumTemps = 0; |
| 4390 LocationSummary* summary = new(isolate) LocationSummary( |
| 4391 isolate, InputCount(), kNumTemps, LocationSummary::kCall); |
| 4392 summary->set_in(0, Location::RegisterLocation(R0)); |
| 4393 summary->set_in(1, Location::RegisterLocation(R1)); |
| 4394 summary->set_in(2, Location::RegisterLocation(R2)); |
| 4395 summary->set_in(3, Location::RegisterLocation(R3)); |
| 4396 summary->set_out(0, Location::RegisterLocation(R0)); |
| 4397 return summary; |
| 4398 } |
| 4399 |
| 4400 |
| 4401 void CaseInsensitiveCompareUC16Instr::EmitNativeCode( |
| 4402 FlowGraphCompiler* compiler) { |
| 4403 |
| 4404 // Call the function. |
| 4405 __ CallRuntime(TargetFunction(), TargetFunction().argument_count()); |
| 4406 } |
| 4407 |
| 4408 |
4324 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, | 4409 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, |
4325 bool opt) const { | 4410 bool opt) const { |
4326 if (result_cid() == kDoubleCid) { | 4411 if (result_cid() == kDoubleCid) { |
4327 const intptr_t kNumInputs = 2; | 4412 const intptr_t kNumInputs = 2; |
4328 const intptr_t kNumTemps = 0; | 4413 const intptr_t kNumTemps = 0; |
4329 LocationSummary* summary = new(isolate) LocationSummary( | 4414 LocationSummary* summary = new(isolate) LocationSummary( |
4330 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4415 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
4331 summary->set_in(0, Location::RequiresFpuRegister()); | 4416 summary->set_in(0, Location::RequiresFpuRegister()); |
4332 summary->set_in(1, Location::RequiresFpuRegister()); | 4417 summary->set_in(1, Location::RequiresFpuRegister()); |
4333 // Reuse the left register so that code can be made shorter. | 4418 // Reuse the left register so that code can be made shorter. |
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5346 } | 5431 } |
5347 | 5432 |
5348 // We can fall through if the successor is the next block in the list. | 5433 // We can fall through if the successor is the next block in the list. |
5349 // Otherwise, we need a jump. | 5434 // Otherwise, we need a jump. |
5350 if (!compiler->CanFallThroughTo(successor())) { | 5435 if (!compiler->CanFallThroughTo(successor())) { |
5351 __ b(compiler->GetJumpLabel(successor())); | 5436 __ b(compiler->GetJumpLabel(successor())); |
5352 } | 5437 } |
5353 } | 5438 } |
5354 | 5439 |
5355 | 5440 |
| 5441 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Isolate* isolate, |
| 5442 bool opt) const { |
| 5443 const intptr_t kNumInputs = 1; |
| 5444 const intptr_t kNumTemps = 1; |
| 5445 |
| 5446 LocationSummary* summary = new(isolate) LocationSummary( |
| 5447 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5448 |
| 5449 summary->set_in(0, Location::RequiresRegister()); |
| 5450 summary->set_temp(0, Location::RequiresRegister()); |
| 5451 |
| 5452 return summary; |
| 5453 } |
| 5454 |
| 5455 |
| 5456 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5457 Register target_address_reg = locs()->temp_slot(0)->reg(); |
| 5458 |
| 5459 // Load from [current frame pointer] + kPcMarkerSlotFromFp. |
| 5460 __ ldr(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize)); |
| 5461 |
| 5462 // Add the offset. |
| 5463 Register offset_reg = locs()->in(0).reg(); |
| 5464 __ add(target_address_reg, |
| 5465 target_address_reg, |
| 5466 Operand(offset_reg, ASR, kSmiTagSize)); |
| 5467 |
| 5468 // Jump to the absolute address. |
| 5469 __ br(target_address_reg); |
| 5470 } |
| 5471 |
| 5472 |
5356 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, | 5473 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, |
5357 bool opt) const { | 5474 bool opt) const { |
5358 const intptr_t kNumInputs = 2; | 5475 const intptr_t kNumInputs = 2; |
5359 const intptr_t kNumTemps = 0; | 5476 const intptr_t kNumTemps = 0; |
5360 if (needs_number_check()) { | 5477 if (needs_number_check()) { |
5361 LocationSummary* locs = new(isolate) LocationSummary( | 5478 LocationSummary* locs = new(isolate) LocationSummary( |
5362 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); | 5479 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); |
5363 locs->set_in(0, Location::RegisterLocation(R0)); | 5480 locs->set_in(0, Location::RegisterLocation(R0)); |
5364 locs->set_in(1, Location::RegisterLocation(R1)); | 5481 locs->set_in(1, Location::RegisterLocation(R1)); |
5365 locs->set_out(0, Location::RegisterLocation(R0)); | 5482 locs->set_out(0, Location::RegisterLocation(R0)); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5482 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 5599 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
5483 #if defined(DEBUG) | 5600 #if defined(DEBUG) |
5484 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP); | 5601 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP); |
5485 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP); | 5602 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP); |
5486 #endif | 5603 #endif |
5487 } | 5604 } |
5488 | 5605 |
5489 } // namespace dart | 5606 } // namespace dart |
5490 | 5607 |
5491 #endif // defined TARGET_ARCH_ARM64 | 5608 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |