| 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 LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Isolate* isolate, | |
| 1139 bool opt) const { | |
| 1140 const intptr_t kNumInputs = 2; | |
| 1141 const intptr_t kNumTemps = 0; | |
| 1142 LocationSummary* summary = new(isolate) LocationSummary( | |
| 1143 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); | |
| 1144 summary->set_in(0, Location::RequiresRegister()); | |
| 1145 summary->set_in(1, Location::RequiresRegister()); | |
| 1146 summary->set_out(0, Location::RequiresRegister()); | |
| 1147 return summary; | |
| 1148 } | |
| 1149 | |
| 1150 | |
| 1151 void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | |
| 1152 const Register array = locs()->in(0).reg(); | |
| 1153 const Location index = locs()->in(1); | |
| 1154 | |
| 1155 Address element_address = __ ElementAddressForRegIndex( | |
| 1156 true, IsExternal(), class_id(), index_scale(), array, index.reg()); | |
| 1157 // Warning: element_address may use register TMP as base. | |
| 1158 | |
| 1159 Register result = locs()->out(0).reg(); | |
| 1160 switch (class_id()) { | |
| 1161 case kOneByteStringCid: | |
| 1162 case kExternalOneByteStringCid: | |
| 1163 switch (element_count()) { | |
| 1164 case 1: __ ldr(result, element_address, kUnsignedByte); break; | |
| 1165 case 2: __ ldr(result, element_address, kUnsignedHalfword); break; | |
| 1166 case 4: __ ldr(result, element_address, kUnsignedWord); break; | |
| 1167 default: UNREACHABLE(); | |
| 1168 } | |
| 1169 __ SmiTag(result); | |
| 1170 break; | |
| 1171 case kTwoByteStringCid: | |
| 1172 case kExternalTwoByteStringCid: | |
| 1173 switch (element_count()) { | |
| 1174 case 1: __ ldr(result, element_address, kUnsignedHalfword); break; | |
| 1175 case 2: __ ldr(result, element_address, kUnsignedWord); break; | |
| 1176 default: UNREACHABLE(); | |
| 1177 } | |
| 1178 __ SmiTag(result); | |
| 1179 break; | |
| 1180 default: | |
| 1181 UNREACHABLE(); | |
| 1182 break; | |
| 1183 } | |
| 1184 } | |
| 1185 | |
| 1186 | |
| 1187 Representation StoreIndexedInstr::RequiredInputRepresentation( | 1138 Representation StoreIndexedInstr::RequiredInputRepresentation( |
| 1188 intptr_t idx) const { | 1139 intptr_t idx) const { |
| 1189 // Array can be a Dart object or a pointer to external data. | 1140 // Array can be a Dart object or a pointer to external data. |
| 1190 if (idx == 0) return kNoRepresentation; // Flexible input representation. | 1141 if (idx == 0) return kNoRepresentation; // Flexible input representation. |
| 1191 if (idx == 1) return kTagged; // Index is a smi. | 1142 if (idx == 1) return kTagged; // Index is a smi. |
| 1192 ASSERT(idx == 2); | 1143 ASSERT(idx == 2); |
| 1193 switch (class_id_) { | 1144 switch (class_id_) { |
| 1194 case kArrayCid: | 1145 case kArrayCid: |
| 1195 case kOneByteStringCid: | 1146 case kOneByteStringCid: |
| 1196 case kTypedDataInt8ArrayCid: | 1147 case kTypedDataInt8ArrayCid: |
| (...skipping 3166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4363 const VRegister result = locs()->out(0).fpu_reg(); | 4314 const VRegister result = locs()->out(0).fpu_reg(); |
| 4364 __ fmuld(result, val, val); | 4315 __ fmuld(result, val, val); |
| 4365 } else { | 4316 } else { |
| 4366 ASSERT((kind() == MathUnaryInstr::kSin) || | 4317 ASSERT((kind() == MathUnaryInstr::kSin) || |
| 4367 (kind() == MathUnaryInstr::kCos)); | 4318 (kind() == MathUnaryInstr::kCos)); |
| 4368 __ CallRuntime(TargetFunction(), InputCount()); | 4319 __ CallRuntime(TargetFunction(), InputCount()); |
| 4369 } | 4320 } |
| 4370 } | 4321 } |
| 4371 | 4322 |
| 4372 | 4323 |
| 4373 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary( | |
| 4374 Isolate* isolate, bool opt) const { | |
| 4375 const intptr_t kNumTemps = 0; | |
| 4376 LocationSummary* summary = new(isolate) LocationSummary( | |
| 4377 isolate, InputCount(), kNumTemps, LocationSummary::kCall); | |
| 4378 summary->set_in(0, Location::RegisterLocation(R0)); | |
| 4379 summary->set_in(1, Location::RegisterLocation(R1)); | |
| 4380 summary->set_in(2, Location::RegisterLocation(R2)); | |
| 4381 summary->set_in(3, Location::RegisterLocation(R3)); | |
| 4382 summary->set_out(0, Location::RegisterLocation(R0)); | |
| 4383 return summary; | |
| 4384 } | |
| 4385 | |
| 4386 | |
| 4387 void CaseInsensitiveCompareUC16Instr::EmitNativeCode( | |
| 4388 FlowGraphCompiler* compiler) { | |
| 4389 | |
| 4390 // Call the function. | |
| 4391 __ CallRuntime(TargetFunction(), TargetFunction().argument_count()); | |
| 4392 } | |
| 4393 | |
| 4394 | |
| 4395 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, | 4324 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, |
| 4396 bool opt) const { | 4325 bool opt) const { |
| 4397 if (result_cid() == kDoubleCid) { | 4326 if (result_cid() == kDoubleCid) { |
| 4398 const intptr_t kNumInputs = 2; | 4327 const intptr_t kNumInputs = 2; |
| 4399 const intptr_t kNumTemps = 0; | 4328 const intptr_t kNumTemps = 0; |
| 4400 LocationSummary* summary = new(isolate) LocationSummary( | 4329 LocationSummary* summary = new(isolate) LocationSummary( |
| 4401 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4330 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4402 summary->set_in(0, Location::RequiresFpuRegister()); | 4331 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4403 summary->set_in(1, Location::RequiresFpuRegister()); | 4332 summary->set_in(1, Location::RequiresFpuRegister()); |
| 4404 // Reuse the left register so that code can be made shorter. | 4333 // Reuse the left register so that code can be made shorter. |
| (...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5417 } | 5346 } |
| 5418 | 5347 |
| 5419 // We can fall through if the successor is the next block in the list. | 5348 // We can fall through if the successor is the next block in the list. |
| 5420 // Otherwise, we need a jump. | 5349 // Otherwise, we need a jump. |
| 5421 if (!compiler->CanFallThroughTo(successor())) { | 5350 if (!compiler->CanFallThroughTo(successor())) { |
| 5422 __ b(compiler->GetJumpLabel(successor())); | 5351 __ b(compiler->GetJumpLabel(successor())); |
| 5423 } | 5352 } |
| 5424 } | 5353 } |
| 5425 | 5354 |
| 5426 | 5355 |
| 5427 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Isolate* isolate, | |
| 5428 bool opt) const { | |
| 5429 const intptr_t kNumInputs = 1; | |
| 5430 const intptr_t kNumTemps = 1; | |
| 5431 | |
| 5432 LocationSummary* summary = new(isolate) LocationSummary( | |
| 5433 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); | |
| 5434 | |
| 5435 summary->set_in(0, Location::RequiresRegister()); | |
| 5436 summary->set_temp(0, Location::RequiresRegister()); | |
| 5437 | |
| 5438 return summary; | |
| 5439 } | |
| 5440 | |
| 5441 | |
| 5442 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | |
| 5443 Register target_address_reg = locs()->temp_slot(0)->reg(); | |
| 5444 | |
| 5445 // Load from [current frame pointer] + kPcMarkerSlotFromFp. | |
| 5446 __ ldr(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize)); | |
| 5447 | |
| 5448 // Add the offset. | |
| 5449 Register offset_reg = locs()->in(0).reg(); | |
| 5450 __ add(target_address_reg, | |
| 5451 target_address_reg, | |
| 5452 Operand(offset_reg, ASR, kSmiTagSize)); | |
| 5453 | |
| 5454 // Jump to the absolute address. | |
| 5455 __ br(target_address_reg); | |
| 5456 } | |
| 5457 | |
| 5458 | |
| 5459 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, | 5356 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, |
| 5460 bool opt) const { | 5357 bool opt) const { |
| 5461 const intptr_t kNumInputs = 2; | 5358 const intptr_t kNumInputs = 2; |
| 5462 const intptr_t kNumTemps = 0; | 5359 const intptr_t kNumTemps = 0; |
| 5463 if (needs_number_check()) { | 5360 if (needs_number_check()) { |
| 5464 LocationSummary* locs = new(isolate) LocationSummary( | 5361 LocationSummary* locs = new(isolate) LocationSummary( |
| 5465 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); | 5362 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); |
| 5466 locs->set_in(0, Location::RegisterLocation(R0)); | 5363 locs->set_in(0, Location::RegisterLocation(R0)); |
| 5467 locs->set_in(1, Location::RegisterLocation(R1)); | 5364 locs->set_in(1, Location::RegisterLocation(R1)); |
| 5468 locs->set_out(0, Location::RegisterLocation(R0)); | 5365 locs->set_out(0, Location::RegisterLocation(R0)); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5585 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 5482 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
| 5586 #if defined(DEBUG) | 5483 #if defined(DEBUG) |
| 5587 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP); | 5484 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP); |
| 5588 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP); | 5485 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP); |
| 5589 #endif | 5486 #endif |
| 5590 } | 5487 } |
| 5591 | 5488 |
| 5592 } // namespace dart | 5489 } // namespace dart |
| 5593 | 5490 |
| 5594 #endif // defined TARGET_ARCH_ARM64 | 5491 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |