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

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, enable tests, remove *CodeUnitsAt 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 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 3728 matching lines...) Expand 10 before | Expand all | Expand 10 after
5069 __ vmovrrd(R0, R1, D0); 5161 __ vmovrrd(R0, R1, D0);
5070 __ vmovrrd(R2, R3, D1); 5162 __ vmovrrd(R2, R3, D1);
5071 __ CallRuntime(TargetFunction(), InputCount()); 5163 __ CallRuntime(TargetFunction(), InputCount());
5072 __ vmovdrr(D0, R0, R1); 5164 __ vmovdrr(D0, R0, R1);
5073 __ vmovdrr(D1, R2, R3); 5165 __ vmovdrr(D1, R2, R3);
5074 } 5166 }
5075 } 5167 }
5076 } 5168 }
5077 5169
5078 5170
5171 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary(
5172 Isolate* isolate, bool opt) const {
5173 const intptr_t kNumTemps = 0;
5174 LocationSummary* summary = new(isolate) LocationSummary(
5175 isolate, InputCount(), kNumTemps, LocationSummary::kCall);
5176 summary->set_in(0, Location::RegisterLocation(R0));
5177 summary->set_in(1, Location::RegisterLocation(R1));
5178 summary->set_in(2, Location::RegisterLocation(R2));
5179 summary->set_in(3, Location::RegisterLocation(R3));
5180 summary->set_out(0, Location::RegisterLocation(R0));
5181 return summary;
5182 }
5183
5184
5185 void CaseInsensitiveCompareUC16Instr::EmitNativeCode(
5186 FlowGraphCompiler* compiler) {
5187
5188 // Call the function.
5189 __ CallRuntime(TargetFunction(), TargetFunction().argument_count());
5190 }
5191
5192
5079 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, 5193 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate,
5080 bool opt) const { 5194 bool opt) const {
5081 if (result_cid() == kDoubleCid) { 5195 if (result_cid() == kDoubleCid) {
5082 const intptr_t kNumInputs = 2; 5196 const intptr_t kNumInputs = 2;
5083 const intptr_t kNumTemps = 1; 5197 const intptr_t kNumTemps = 1;
5084 LocationSummary* summary = new(isolate) LocationSummary( 5198 LocationSummary* summary = new(isolate) LocationSummary(
5085 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 5199 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5086 summary->set_in(0, Location::RequiresFpuRegister()); 5200 summary->set_in(0, Location::RequiresFpuRegister());
5087 summary->set_in(1, Location::RequiresFpuRegister()); 5201 summary->set_in(1, Location::RequiresFpuRegister());
5088 // Reuse the left register so that code can be made shorter. 5202 // Reuse the left register so that code can be made shorter.
(...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after
6833 } 6947 }
6834 6948
6835 // We can fall through if the successor is the next block in the list. 6949 // We can fall through if the successor is the next block in the list.
6836 // Otherwise, we need a jump. 6950 // Otherwise, we need a jump.
6837 if (!compiler->CanFallThroughTo(successor())) { 6951 if (!compiler->CanFallThroughTo(successor())) {
6838 __ b(compiler->GetJumpLabel(successor())); 6952 __ b(compiler->GetJumpLabel(successor()));
6839 } 6953 }
6840 } 6954 }
6841 6955
6842 6956
6957 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Isolate* isolate,
6958 bool opt) const {
6959 const intptr_t kNumInputs = 1;
6960 const intptr_t kNumTemps = 1;
6961
6962 LocationSummary* summary = new(isolate) LocationSummary(
6963 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
6964
6965 summary->set_in(0, Location::RequiresRegister());
6966 summary->set_temp(0, Location::RequiresRegister());
6967
6968 return summary;
6969 }
6970
6971
6972 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6973 Register target_address_reg = locs()->temp_slot(0)->reg();
6974
6975 // Load from [current frame pointer] + kPcMarkerSlotFromFp.
6976 __ ldr(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize));
6977
6978 // Add the offset.
6979 Register offset_reg = locs()->in(0).reg();
6980 __ add(target_address_reg,
6981 target_address_reg,
6982 Operand(offset_reg, ASR, kSmiTagSize));
6983
6984 // Jump to the absolute address.
6985 __ bx(target_address_reg);
6986 }
6987
6988
6843 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, 6989 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate,
6844 bool opt) const { 6990 bool opt) const {
6845 const intptr_t kNumInputs = 2; 6991 const intptr_t kNumInputs = 2;
6846 const intptr_t kNumTemps = 0; 6992 const intptr_t kNumTemps = 0;
6847 if (needs_number_check()) { 6993 if (needs_number_check()) {
6848 LocationSummary* locs = new(isolate) LocationSummary( 6994 LocationSummary* locs = new(isolate) LocationSummary(
6849 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 6995 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
6850 locs->set_in(0, Location::RegisterLocation(R0)); 6996 locs->set_in(0, Location::RegisterLocation(R0));
6851 locs->set_in(1, Location::RegisterLocation(R1)); 6997 locs->set_in(1, Location::RegisterLocation(R1));
6852 locs->set_out(0, Location::RegisterLocation(R0)); 6998 locs->set_out(0, Location::RegisterLocation(R0));
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
6975 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 7121 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
6976 #if defined(DEBUG) 7122 #if defined(DEBUG)
6977 __ LoadImmediate(R4, kInvalidObjectPointer); 7123 __ LoadImmediate(R4, kInvalidObjectPointer);
6978 __ LoadImmediate(R5, kInvalidObjectPointer); 7124 __ LoadImmediate(R5, kInvalidObjectPointer);
6979 #endif 7125 #endif
6980 } 7126 }
6981 7127
6982 } // namespace dart 7128 } // namespace dart
6983 7129
6984 #endif // defined TARGET_ARCH_ARM 7130 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698