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

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: rebase Created 6 years, 1 month 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
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 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 __ SmiTag(result); 1333 __ SmiTag(result);
1334 break; 1334 break;
1335 default: 1335 default:
1336 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); 1336 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid));
1337 __ ldr(result, element_address); 1337 __ ldr(result, element_address);
1338 break; 1338 break;
1339 } 1339 }
1340 } 1340 }
1341 1341
1342 1342
1343 Representation LoadCodeUnitsInstr::representation() const {
1344 switch (class_id()) {
1345 case kOneByteStringCid:
1346 case kExternalOneByteStringCid:
1347 case kTwoByteStringCid:
1348 case kExternalTwoByteStringCid:
1349 // TODO(jgruber): kUnboxedUint32 could be a better choice.
1350 return can_pack_into_smi() ? kTagged : kUnboxedMint;
1351 default:
1352 UNIMPLEMENTED();
1353 return kTagged;
1354 }
1355 }
1356
1357
1358 LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Isolate* isolate,
1359 bool opt) const {
1360 const intptr_t kNumInputs = 2;
1361 const intptr_t kNumTemps = 0;
1362 LocationSummary* summary = new(isolate) LocationSummary(
1363 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1364 summary->set_in(0, Location::RequiresRegister());
1365 summary->set_in(1, Location::RequiresRegister());
1366
1367 if (representation() == kUnboxedMint) {
1368 summary->set_out(0, Location::Pair(Location::RequiresRegister(),
1369 Location::RequiresRegister()));
1370 } else {
1371 ASSERT(representation() == kTagged);
1372 summary->set_out(0, Location::RequiresRegister());
1373 }
1374
1375 return summary;
1376 }
1377
1378
1379 void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1380 const Register array = locs()->in(0).reg();
1381 const Location index = locs()->in(1);
1382
1383 Address element_address = __ ElementAddressForRegIndex(
1384 true, IsExternal(), class_id(), index_scale(), array, index.reg());
1385 // Warning: element_address may use register IP as base.
1386
1387 if (representation() == kUnboxedMint) {
1388 ASSERT(locs()->out(0).IsPairLocation());
1389 PairLocation* result_pair = locs()->out(0).AsPairLocation();
1390 Register result1 = result_pair->At(0).reg();
1391 Register result2 = result_pair->At(1).reg();
1392 switch (class_id()) {
1393 case kOneByteStringCid:
1394 case kExternalOneByteStringCid:
1395 ASSERT(element_count() == 4);
1396 __ ldr(result1, element_address);
1397 __ eor(result2, result2, Operand(result2));
1398 break;
1399 case kTwoByteStringCid:
1400 case kExternalTwoByteStringCid:
1401 ASSERT(element_count() == 2);
1402 __ ldr(result1, element_address);
1403 __ eor(result2, result2, Operand(result2));
1404 break;
1405 default:
1406 UNREACHABLE();
1407 }
1408 } else {
1409 ASSERT(representation() == kTagged);
1410 Register result = locs()->out(0).reg();
1411 switch (class_id()) {
1412 case kOneByteStringCid:
1413 case kExternalOneByteStringCid:
1414 switch (element_count()) {
1415 case 1: __ ldrb(result, element_address); break;
1416 case 2: __ ldrh(result, element_address); break;
1417 default: UNREACHABLE();
1418 }
1419 __ SmiTag(result);
1420 break;
1421 case kTwoByteStringCid:
1422 case kExternalTwoByteStringCid:
1423 ASSERT(element_count() == 1);
1424 __ ldrh(result, element_address);
1425 __ SmiTag(result);
1426 break;
1427 default:
1428 UNREACHABLE();
1429 break;
1430 }
1431 }
1432 }
1433
1434
1343 Representation StoreIndexedInstr::RequiredInputRepresentation( 1435 Representation StoreIndexedInstr::RequiredInputRepresentation(
1344 intptr_t idx) const { 1436 intptr_t idx) const {
1345 // Array can be a Dart object or a pointer to external data. 1437 // Array can be a Dart object or a pointer to external data.
1346 if (idx == 0) return kNoRepresentation; // Flexible input representation. 1438 if (idx == 0) return kNoRepresentation; // Flexible input representation.
1347 if (idx == 1) return kTagged; // Index is a smi. 1439 if (idx == 1) return kTagged; // Index is a smi.
1348 ASSERT(idx == 2); 1440 ASSERT(idx == 2);
1349 switch (class_id_) { 1441 switch (class_id_) {
1350 case kArrayCid: 1442 case kArrayCid:
1351 case kOneByteStringCid: 1443 case kOneByteStringCid:
1352 case kTypedDataInt8ArrayCid: 1444 case kTypedDataInt8ArrayCid:
(...skipping 3728 matching lines...) Expand 10 before | Expand all | Expand 10 after
5081 __ vmovrrd(R0, R1, D0); 5173 __ vmovrrd(R0, R1, D0);
5082 __ vmovrrd(R2, R3, D1); 5174 __ vmovrrd(R2, R3, D1);
5083 __ CallRuntime(TargetFunction(), InputCount()); 5175 __ CallRuntime(TargetFunction(), InputCount());
5084 __ vmovdrr(D0, R0, R1); 5176 __ vmovdrr(D0, R0, R1);
5085 __ vmovdrr(D1, R2, R3); 5177 __ vmovdrr(D1, R2, R3);
5086 } 5178 }
5087 } 5179 }
5088 } 5180 }
5089 5181
5090 5182
5183 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary(
5184 Isolate* isolate, bool opt) const {
5185 const intptr_t kNumTemps = 0;
5186 LocationSummary* summary = new(isolate) LocationSummary(
5187 isolate, InputCount(), kNumTemps, LocationSummary::kCall);
5188 summary->set_in(0, Location::RegisterLocation(R0));
5189 summary->set_in(1, Location::RegisterLocation(R1));
5190 summary->set_in(2, Location::RegisterLocation(R2));
5191 summary->set_in(3, Location::RegisterLocation(R3));
5192 summary->set_out(0, Location::RegisterLocation(R0));
5193 return summary;
5194 }
5195
5196
5197 void CaseInsensitiveCompareUC16Instr::EmitNativeCode(
5198 FlowGraphCompiler* compiler) {
5199
5200 // Call the function.
5201 __ CallRuntime(TargetFunction(), TargetFunction().argument_count());
5202 }
5203
5204
5091 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, 5205 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate,
5092 bool opt) const { 5206 bool opt) const {
5093 if (result_cid() == kDoubleCid) { 5207 if (result_cid() == kDoubleCid) {
5094 const intptr_t kNumInputs = 2; 5208 const intptr_t kNumInputs = 2;
5095 const intptr_t kNumTemps = 1; 5209 const intptr_t kNumTemps = 1;
5096 LocationSummary* summary = new(isolate) LocationSummary( 5210 LocationSummary* summary = new(isolate) LocationSummary(
5097 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5211 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5098 summary->set_in(0, Location::RequiresFpuRegister()); 5212 summary->set_in(0, Location::RequiresFpuRegister());
5099 summary->set_in(1, Location::RequiresFpuRegister()); 5213 summary->set_in(1, Location::RequiresFpuRegister());
5100 // Reuse the left register so that code can be made shorter. 5214 // Reuse the left register so that code can be made shorter.
(...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after
6845 } 6959 }
6846 6960
6847 // We can fall through if the successor is the next block in the list. 6961 // We can fall through if the successor is the next block in the list.
6848 // Otherwise, we need a jump. 6962 // Otherwise, we need a jump.
6849 if (!compiler->CanFallThroughTo(successor())) { 6963 if (!compiler->CanFallThroughTo(successor())) {
6850 __ b(compiler->GetJumpLabel(successor())); 6964 __ b(compiler->GetJumpLabel(successor()));
6851 } 6965 }
6852 } 6966 }
6853 6967
6854 6968
6969 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Isolate* isolate,
6970 bool opt) const {
6971 const intptr_t kNumInputs = 1;
6972 const intptr_t kNumTemps = 1;
6973
6974 LocationSummary* summary = new(isolate) LocationSummary(
6975 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
6976
6977 summary->set_in(0, Location::RequiresRegister());
6978 summary->set_temp(0, Location::RequiresRegister());
6979
6980 return summary;
6981 }
6982
6983
6984 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6985 Register target_address_reg = locs()->temp_slot(0)->reg();
6986
6987 // Load from [current frame pointer] + kPcMarkerSlotFromFp.
6988 __ ldr(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize));
6989
6990 // Add the offset.
6991 Register offset_reg = locs()->in(0).reg();
6992 __ add(target_address_reg,
6993 target_address_reg,
6994 Operand(offset_reg, ASR, kSmiTagSize));
6995
6996 // Jump to the absolute address.
6997 __ bx(target_address_reg);
6998 }
6999
7000
6855 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, 7001 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate,
6856 bool opt) const { 7002 bool opt) const {
6857 const intptr_t kNumInputs = 2; 7003 const intptr_t kNumInputs = 2;
6858 const intptr_t kNumTemps = 0; 7004 const intptr_t kNumTemps = 0;
6859 if (needs_number_check()) { 7005 if (needs_number_check()) {
6860 LocationSummary* locs = new(isolate) LocationSummary( 7006 LocationSummary* locs = new(isolate) LocationSummary(
6861 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 7007 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
6862 locs->set_in(0, Location::RegisterLocation(R0)); 7008 locs->set_in(0, Location::RegisterLocation(R0));
6863 locs->set_in(1, Location::RegisterLocation(R1)); 7009 locs->set_in(1, Location::RegisterLocation(R1));
6864 locs->set_out(0, Location::RegisterLocation(R0)); 7010 locs->set_out(0, Location::RegisterLocation(R0));
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
6987 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 7133 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
6988 #if defined(DEBUG) 7134 #if defined(DEBUG)
6989 __ LoadImmediate(R4, kInvalidObjectPointer); 7135 __ LoadImmediate(R4, kInvalidObjectPointer);
6990 __ LoadImmediate(R5, kInvalidObjectPointer); 7136 __ LoadImmediate(R5, kInvalidObjectPointer);
6991 #endif 7137 #endif
6992 } 7138 }
6993 7139
6994 } // namespace dart 7140 } // namespace dart
6995 7141
6996 #endif // defined TARGET_ARCH_ARM 7142 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698