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

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

Issue 539153002: Port and integrate the irregexp engine from V8 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Do not break JSCRE build, pt 2. Created 6 years, 2 months 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 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 } 1354 }
1355 break; 1355 break;
1356 default: 1356 default:
1357 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); 1357 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid));
1358 __ ldr(result, element_address); 1358 __ ldr(result, element_address);
1359 break; 1359 break;
1360 } 1360 }
1361 } 1361 }
1362 1362
1363 1363
1364 Representation LoadCodeUnitsInstr::representation() const {
1365 switch (class_id()) {
1366 case kOneByteStringCid:
1367 case kExternalOneByteStringCid:
1368 case kTwoByteStringCid:
1369 case kExternalTwoByteStringCid:
1370 // TODO(jgruber): kUnboxedUint32 could be a better choice.
1371 return can_pack_into_smi() ? kTagged : kUnboxedMint;
1372 default:
1373 UNIMPLEMENTED();
1374 return kTagged;
1375 }
1376 }
1377
1378
1379 LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Isolate* isolate,
1380 bool opt) const {
1381 const intptr_t kNumInputs = 2;
1382 const intptr_t kNumTemps = 0;
1383 LocationSummary* summary = new(isolate) LocationSummary(
1384 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1385 summary->set_in(0, Location::RequiresRegister());
1386 summary->set_in(1, Location::RequiresRegister());
1387
1388 if (representation() == kUnboxedMint) {
1389 summary->set_out(0, Location::Pair(Location::RequiresRegister(),
1390 Location::RequiresRegister()));
1391 } else {
1392 ASSERT(representation() == kTagged);
1393 summary->set_out(0, Location::RequiresRegister());
1394 }
1395
1396 return summary;
1397 }
1398
1399
1400 void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1401 const Register array = locs()->in(0).reg();
1402 const Location index = locs()->in(1);
1403
1404 Address element_address = __ ElementAddressForRegIndex(
1405 true, IsExternal(), class_id(), index_scale(), array, index.reg());
1406 // Warning: element_address may use register IP as base.
1407
1408 if (representation() == kUnboxedMint) {
1409 ASSERT(locs()->out(0).IsPairLocation());
1410 PairLocation* result_pair = locs()->out(0).AsPairLocation();
1411 Register result1 = result_pair->At(0).reg();
1412 Register result2 = result_pair->At(1).reg();
1413 switch (class_id()) {
1414 case kOneByteStringCid:
1415 case kExternalOneByteStringCid:
1416 ASSERT(element_count() == 4);
1417 __ ldr(result1, element_address);
1418 __ eor(result2, result2, Operand(result2));
1419 break;
1420 case kTwoByteStringCid:
1421 case kExternalTwoByteStringCid:
1422 ASSERT(element_count() == 2);
1423 __ ldr(result1, element_address);
1424 __ eor(result2, result2, Operand(result2));
1425 break;
1426 default:
1427 UNREACHABLE();
1428 }
1429 } else {
1430 ASSERT(representation() == kTagged);
1431 Register result = locs()->out(0).reg();
1432 switch (class_id()) {
1433 case kOneByteStringCid:
1434 case kExternalOneByteStringCid:
1435 switch (element_count()) {
1436 case 1: __ ldrb(result, element_address); break;
1437 case 2: __ ldrh(result, element_address); break;
1438 default: UNREACHABLE();
1439 }
1440 __ SmiTag(result);
1441 break;
1442 case kTwoByteStringCid:
1443 case kExternalTwoByteStringCid:
1444 ASSERT(element_count() == 1);
1445 __ ldrh(result, element_address);
1446 __ SmiTag(result);
1447 break;
1448 default:
1449 UNREACHABLE();
1450 break;
1451 }
1452 }
1453 }
1454
1455
1364 Representation StoreIndexedInstr::RequiredInputRepresentation( 1456 Representation StoreIndexedInstr::RequiredInputRepresentation(
1365 intptr_t idx) const { 1457 intptr_t idx) const {
1366 // Array can be a Dart object or a pointer to external data. 1458 // Array can be a Dart object or a pointer to external data.
1367 if (idx == 0) return kNoRepresentation; // Flexible input representation. 1459 if (idx == 0) return kNoRepresentation; // Flexible input representation.
1368 if (idx == 1) return kTagged; // Index is a smi. 1460 if (idx == 1) return kTagged; // Index is a smi.
1369 ASSERT(idx == 2); 1461 ASSERT(idx == 2);
1370 switch (class_id_) { 1462 switch (class_id_) {
1371 case kArrayCid: 1463 case kArrayCid:
1372 case kOneByteStringCid: 1464 case kOneByteStringCid:
1373 case kTypedDataInt8ArrayCid: 1465 case kTypedDataInt8ArrayCid:
(...skipping 3714 matching lines...) Expand 10 before | Expand all | Expand 10 after
5088 __ vmovrrd(R0, R1, D0); 5180 __ vmovrrd(R0, R1, D0);
5089 __ vmovrrd(R2, R3, D1); 5181 __ vmovrrd(R2, R3, D1);
5090 __ CallRuntime(TargetFunction(), InputCount()); 5182 __ CallRuntime(TargetFunction(), InputCount());
5091 __ vmovdrr(D0, R0, R1); 5183 __ vmovdrr(D0, R0, R1);
5092 __ vmovdrr(D1, R2, R3); 5184 __ vmovdrr(D1, R2, R3);
5093 } 5185 }
5094 } 5186 }
5095 } 5187 }
5096 5188
5097 5189
5190 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary(
5191 Isolate* isolate, bool opt) const {
5192 const intptr_t kNumTemps = 0;
5193 LocationSummary* summary = new(isolate) LocationSummary(
5194 isolate, InputCount(), kNumTemps, LocationSummary::kCall);
5195 summary->set_in(0, Location::RegisterLocation(R0));
5196 summary->set_in(1, Location::RegisterLocation(R1));
5197 summary->set_in(2, Location::RegisterLocation(R2));
5198 summary->set_in(3, Location::RegisterLocation(R3));
5199 summary->set_out(0, Location::RegisterLocation(R0));
5200 return summary;
5201 }
5202
5203
5204 void CaseInsensitiveCompareUC16Instr::EmitNativeCode(
5205 FlowGraphCompiler* compiler) {
5206
5207 // Call the function.
5208 __ CallRuntime(TargetFunction(), TargetFunction().argument_count());
5209 }
5210
5211
5098 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, 5212 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate,
5099 bool opt) const { 5213 bool opt) const {
5100 if (result_cid() == kDoubleCid) { 5214 if (result_cid() == kDoubleCid) {
5101 const intptr_t kNumInputs = 2; 5215 const intptr_t kNumInputs = 2;
5102 const intptr_t kNumTemps = 1; 5216 const intptr_t kNumTemps = 1;
5103 LocationSummary* summary = new(isolate) LocationSummary( 5217 LocationSummary* summary = new(isolate) LocationSummary(
5104 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5218 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5105 summary->set_in(0, Location::RequiresFpuRegister()); 5219 summary->set_in(0, Location::RequiresFpuRegister());
5106 summary->set_in(1, Location::RequiresFpuRegister()); 5220 summary->set_in(1, Location::RequiresFpuRegister());
5107 // Reuse the left register so that code can be made shorter. 5221 // Reuse the left register so that code can be made shorter.
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after
6863 } 6977 }
6864 6978
6865 // We can fall through if the successor is the next block in the list. 6979 // We can fall through if the successor is the next block in the list.
6866 // Otherwise, we need a jump. 6980 // Otherwise, we need a jump.
6867 if (!compiler->CanFallThroughTo(successor())) { 6981 if (!compiler->CanFallThroughTo(successor())) {
6868 __ b(compiler->GetJumpLabel(successor())); 6982 __ b(compiler->GetJumpLabel(successor()));
6869 } 6983 }
6870 } 6984 }
6871 6985
6872 6986
6987 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Isolate* isolate,
6988 bool opt) const {
6989 const intptr_t kNumInputs = 1;
6990 const intptr_t kNumTemps = 1;
6991
6992 LocationSummary* summary = new(isolate) LocationSummary(
6993 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
6994
6995 summary->set_in(0, Location::RequiresRegister());
6996 summary->set_temp(0, Location::RequiresRegister());
6997
6998 return summary;
6999 }
7000
7001
7002 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
7003 Register target_address_reg = locs()->temp_slot(0)->reg();
7004
7005 // Load from [current frame pointer] + kPcMarkerSlotFromFp.
7006 __ ldr(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize));
7007
7008 // Add the offset.
7009 Register offset_reg = locs()->in(0).reg();
7010 __ add(target_address_reg,
7011 target_address_reg,
7012 Operand(offset_reg, ASR, kSmiTagSize));
7013
7014 // Jump to the absolute address.
7015 __ bx(target_address_reg);
7016 }
7017
7018
6873 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, 7019 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate,
6874 bool opt) const { 7020 bool opt) const {
6875 const intptr_t kNumInputs = 2; 7021 const intptr_t kNumInputs = 2;
6876 const intptr_t kNumTemps = 0; 7022 const intptr_t kNumTemps = 0;
6877 if (needs_number_check()) { 7023 if (needs_number_check()) {
6878 LocationSummary* locs = new(isolate) LocationSummary( 7024 LocationSummary* locs = new(isolate) LocationSummary(
6879 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 7025 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
6880 locs->set_in(0, Location::RegisterLocation(R0)); 7026 locs->set_in(0, Location::RegisterLocation(R0));
6881 locs->set_in(1, Location::RegisterLocation(R1)); 7027 locs->set_in(1, Location::RegisterLocation(R1));
6882 locs->set_out(0, Location::RegisterLocation(R0)); 7028 locs->set_out(0, Location::RegisterLocation(R0));
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
7005 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 7151 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
7006 #if defined(DEBUG) 7152 #if defined(DEBUG)
7007 __ LoadImmediate(R4, kInvalidObjectPointer); 7153 __ LoadImmediate(R4, kInvalidObjectPointer);
7008 __ LoadImmediate(R5, kInvalidObjectPointer); 7154 __ LoadImmediate(R5, kInvalidObjectPointer);
7009 #endif 7155 #endif
7010 } 7156 }
7011 7157
7012 } // namespace dart 7158 } // namespace dart
7013 7159
7014 #endif // defined TARGET_ARCH_ARM 7160 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698