Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(464)

Side by Side Diff: runtime/vm/intermediate_language_arm.cc

Issue 683433003: Integrate the Irregexp Regular Expression Engine. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: more comments Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/intermediate_language_arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 __ SmiTag(result); 1321 __ SmiTag(result);
1322 break; 1322 break;
1323 default: 1323 default:
1324 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); 1324 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid));
1325 __ ldr(result, element_address); 1325 __ ldr(result, element_address);
1326 break; 1326 break;
1327 } 1327 }
1328 } 1328 }
1329 1329
1330 1330
1331 Representation LoadCodeUnitsInstr::representation() const {
1332 switch (class_id()) {
1333 case kOneByteStringCid:
1334 case kExternalOneByteStringCid:
1335 case kTwoByteStringCid:
1336 case kExternalTwoByteStringCid:
1337 // TODO(zerny): kUnboxedUint32 could be a better choice.
1338 return can_pack_into_smi() ? kTagged : kUnboxedMint;
1339 default:
1340 UNIMPLEMENTED();
1341 return kTagged;
1342 }
1343 }
1344
1345
1346 LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Isolate* isolate,
1347 bool opt) const {
1348 const intptr_t kNumInputs = 2;
1349 const intptr_t kNumTemps = 0;
1350 LocationSummary* summary = new(isolate) LocationSummary(
1351 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1352 summary->set_in(0, Location::RequiresRegister());
1353 summary->set_in(1, Location::RequiresRegister());
1354
1355 if (representation() == kUnboxedMint) {
1356 summary->set_out(0, Location::Pair(Location::RequiresRegister(),
1357 Location::RequiresRegister()));
1358 } else {
1359 ASSERT(representation() == kTagged);
1360 summary->set_out(0, Location::RequiresRegister());
1361 }
1362
1363 return summary;
1364 }
1365
1366
1367 void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1368 const Register array = locs()->in(0).reg();
1369 const Location index = locs()->in(1);
1370
1371 Address element_address = __ ElementAddressForRegIndex(
1372 true, IsExternal(), class_id(), index_scale(), array, index.reg());
1373 // Warning: element_address may use register IP as base.
1374
1375 if (representation() == kUnboxedMint) {
1376 ASSERT(locs()->out(0).IsPairLocation());
1377 PairLocation* result_pair = locs()->out(0).AsPairLocation();
1378 Register result1 = result_pair->At(0).reg();
1379 Register result2 = result_pair->At(1).reg();
1380 switch (class_id()) {
1381 case kOneByteStringCid:
1382 case kExternalOneByteStringCid:
1383 ASSERT(element_count() == 4);
1384 __ ldr(result1, element_address);
1385 __ eor(result2, result2, Operand(result2));
1386 break;
1387 case kTwoByteStringCid:
1388 case kExternalTwoByteStringCid:
1389 ASSERT(element_count() == 2);
1390 __ ldr(result1, element_address);
1391 __ eor(result2, result2, Operand(result2));
1392 break;
1393 default:
1394 UNREACHABLE();
1395 }
1396 } else {
1397 ASSERT(representation() == kTagged);
1398 Register result = locs()->out(0).reg();
1399 switch (class_id()) {
1400 case kOneByteStringCid:
1401 case kExternalOneByteStringCid:
1402 switch (element_count()) {
1403 case 1: __ ldrb(result, element_address); break;
1404 case 2: __ ldrh(result, element_address); break;
1405 default: UNREACHABLE();
1406 }
1407 __ SmiTag(result);
1408 break;
1409 case kTwoByteStringCid:
1410 case kExternalTwoByteStringCid:
1411 ASSERT(element_count() == 1);
1412 __ ldrh(result, element_address);
1413 __ SmiTag(result);
1414 break;
1415 default:
1416 UNREACHABLE();
1417 break;
1418 }
1419 }
1420 }
1421
1422
1331 Representation StoreIndexedInstr::RequiredInputRepresentation( 1423 Representation StoreIndexedInstr::RequiredInputRepresentation(
1332 intptr_t idx) const { 1424 intptr_t idx) const {
1333 // Array can be a Dart object or a pointer to external data. 1425 // Array can be a Dart object or a pointer to external data.
1334 if (idx == 0) return kNoRepresentation; // Flexible input representation. 1426 if (idx == 0) return kNoRepresentation; // Flexible input representation.
1335 if (idx == 1) return kTagged; // Index is a smi. 1427 if (idx == 1) return kTagged; // Index is a smi.
1336 ASSERT(idx == 2); 1428 ASSERT(idx == 2);
1337 switch (class_id_) { 1429 switch (class_id_) {
1338 case kArrayCid: 1430 case kArrayCid:
1339 case kOneByteStringCid: 1431 case kOneByteStringCid:
1340 case kTypedDataInt8ArrayCid: 1432 case kTypedDataInt8ArrayCid:
(...skipping 3792 matching lines...) Expand 10 before | Expand all | Expand 10 after
5133 __ vmovrrd(R0, R1, D0); 5225 __ vmovrrd(R0, R1, D0);
5134 __ vmovrrd(R2, R3, D1); 5226 __ vmovrrd(R2, R3, D1);
5135 __ CallRuntime(TargetFunction(), InputCount()); 5227 __ CallRuntime(TargetFunction(), InputCount());
5136 __ vmovdrr(D0, R0, R1); 5228 __ vmovdrr(D0, R0, R1);
5137 __ vmovdrr(D1, R2, R3); 5229 __ vmovdrr(D1, R2, R3);
5138 } 5230 }
5139 } 5231 }
5140 } 5232 }
5141 5233
5142 5234
5235 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary(
5236 Isolate* isolate, bool opt) const {
5237 const intptr_t kNumTemps = 0;
5238 LocationSummary* summary = new(isolate) LocationSummary(
5239 isolate, InputCount(), kNumTemps, LocationSummary::kCall);
5240 summary->set_in(0, Location::RegisterLocation(R0));
5241 summary->set_in(1, Location::RegisterLocation(R1));
5242 summary->set_in(2, Location::RegisterLocation(R2));
5243 summary->set_in(3, Location::RegisterLocation(R3));
5244 summary->set_out(0, Location::RegisterLocation(R0));
5245 return summary;
5246 }
5247
5248
5249 void CaseInsensitiveCompareUC16Instr::EmitNativeCode(
5250 FlowGraphCompiler* compiler) {
5251
5252 // Call the function.
5253 __ CallRuntime(TargetFunction(), TargetFunction().argument_count());
5254 }
5255
5256
5143 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, 5257 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate,
5144 bool opt) const { 5258 bool opt) const {
5145 if (result_cid() == kDoubleCid) { 5259 if (result_cid() == kDoubleCid) {
5146 const intptr_t kNumInputs = 2; 5260 const intptr_t kNumInputs = 2;
5147 const intptr_t kNumTemps = 1; 5261 const intptr_t kNumTemps = 1;
5148 LocationSummary* summary = new(isolate) LocationSummary( 5262 LocationSummary* summary = new(isolate) LocationSummary(
5149 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5263 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5150 summary->set_in(0, Location::RequiresFpuRegister()); 5264 summary->set_in(0, Location::RequiresFpuRegister());
5151 summary->set_in(1, Location::RequiresFpuRegister()); 5265 summary->set_in(1, Location::RequiresFpuRegister());
5152 // Reuse the left register so that code can be made shorter. 5266 // Reuse the left register so that code can be made shorter.
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after
6608 } 6722 }
6609 6723
6610 // We can fall through if the successor is the next block in the list. 6724 // We can fall through if the successor is the next block in the list.
6611 // Otherwise, we need a jump. 6725 // Otherwise, we need a jump.
6612 if (!compiler->CanFallThroughTo(successor())) { 6726 if (!compiler->CanFallThroughTo(successor())) {
6613 __ b(compiler->GetJumpLabel(successor())); 6727 __ b(compiler->GetJumpLabel(successor()));
6614 } 6728 }
6615 } 6729 }
6616 6730
6617 6731
6732 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Isolate* isolate,
6733 bool opt) const {
6734 const intptr_t kNumInputs = 1;
6735 const intptr_t kNumTemps = 1;
6736
6737 LocationSummary* summary = new(isolate) LocationSummary(
6738 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
6739
6740 summary->set_in(0, Location::RequiresRegister());
6741 summary->set_temp(0, Location::RequiresRegister());
6742
6743 return summary;
6744 }
6745
6746
6747 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6748 Register target_address_reg = locs()->temp_slot(0)->reg();
6749
6750 // Load from [current frame pointer] + kPcMarkerSlotFromFp.
6751 __ ldr(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize));
6752
6753 // Add the offset.
6754 Register offset_reg = locs()->in(0).reg();
6755 __ add(target_address_reg,
6756 target_address_reg,
6757 Operand(offset_reg, ASR, kSmiTagSize));
6758
6759 // Jump to the absolute address.
6760 __ bx(target_address_reg);
6761 }
6762
6763
6618 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, 6764 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate,
6619 bool opt) const { 6765 bool opt) const {
6620 const intptr_t kNumInputs = 2; 6766 const intptr_t kNumInputs = 2;
6621 const intptr_t kNumTemps = 0; 6767 const intptr_t kNumTemps = 0;
6622 if (needs_number_check()) { 6768 if (needs_number_check()) {
6623 LocationSummary* locs = new(isolate) LocationSummary( 6769 LocationSummary* locs = new(isolate) LocationSummary(
6624 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 6770 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
6625 locs->set_in(0, Location::RegisterLocation(R0)); 6771 locs->set_in(0, Location::RegisterLocation(R0));
6626 locs->set_in(1, Location::RegisterLocation(R1)); 6772 locs->set_in(1, Location::RegisterLocation(R1));
6627 locs->set_out(0, Location::RegisterLocation(R0)); 6773 locs->set_out(0, Location::RegisterLocation(R0));
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
6750 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 6896 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
6751 #if defined(DEBUG) 6897 #if defined(DEBUG)
6752 __ LoadImmediate(R4, kInvalidObjectPointer); 6898 __ LoadImmediate(R4, kInvalidObjectPointer);
6753 __ LoadImmediate(R5, kInvalidObjectPointer); 6899 __ LoadImmediate(R5, kInvalidObjectPointer);
6754 #endif 6900 #endif
6755 } 6901 }
6756 6902
6757 } // namespace dart 6903 } // namespace dart
6758 6904
6759 #endif // defined TARGET_ARCH_ARM 6905 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/intermediate_language_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698