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

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

Issue 15692005: Fix a bug in optimized ARM code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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
« no previous file with comments | « runtime/vm/deopt_instructions.cc ('k') | runtime/vm/intermediate_language_arm.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/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 } 1283 }
1284 1284
1285 1285
1286 void FlowGraphCompiler::EmitMegamorphicInstanceCall( 1286 void FlowGraphCompiler::EmitMegamorphicInstanceCall(
1287 const ICData& ic_data, 1287 const ICData& ic_data,
1288 const Array& arguments_descriptor, 1288 const Array& arguments_descriptor,
1289 intptr_t argument_count, 1289 intptr_t argument_count,
1290 intptr_t deopt_id, 1290 intptr_t deopt_id,
1291 intptr_t token_pos, 1291 intptr_t token_pos,
1292 LocationSummary* locs) { 1292 LocationSummary* locs) {
1293 UNIMPLEMENTED(); 1293 MegamorphicCacheTable* table = Isolate::Current()->megamorphic_cache_table();
1294 const String& name = String::Handle(ic_data.target_name());
1295 const MegamorphicCache& cache =
1296 MegamorphicCache::ZoneHandle(table->Lookup(name, arguments_descriptor));
1297 Label not_smi, load_cache;
1298 __ LoadFromOffset(kLoadWord, R0, SP, (argument_count - 1) * kWordSize);
1299 __ tst(R0, ShifterOperand(kSmiTagMask));
1300 __ b(&not_smi, NE);
1301 __ mov(R0, ShifterOperand(Smi::RawValue(kSmiCid)));
1302 __ b(&load_cache);
1303
1304 __ Bind(&not_smi);
1305 __ LoadClassId(R0, R0);
1306 __ SmiTag(R0);
1307
1308 // R0: class ID of the receiver (smi).
1309 __ Bind(&load_cache);
1310 __ LoadObject(R1, cache);
1311 __ ldr(R2, FieldAddress(R1, MegamorphicCache::buckets_offset()));
1312 __ ldr(R1, FieldAddress(R1, MegamorphicCache::mask_offset()));
1313 // R2: cache buckets array.
1314 // R1: mask.
1315 __ mov(R3, ShifterOperand(R0));
1316
1317 Label loop, update, call_target_function;
1318 __ b(&loop);
1319
1320 __ Bind(&update);
1321 __ add(R3, R3, ShifterOperand(Smi::RawValue(1)));
1322 __ Bind(&loop);
1323 __ and_(R3, R3, ShifterOperand(R1));
1324 const intptr_t base = Array::data_offset();
1325 // R3 is smi tagged, but table entries are two words, so LSL 2.
1326 __ add(IP, R2, ShifterOperand(R3, LSL, 2));
1327 __ ldr(R4, FieldAddress(IP, base));
1328
1329 ASSERT(kIllegalCid == 0);
1330 __ tst(R4, ShifterOperand(R4));
1331 __ b(&call_target_function, EQ);
1332 __ cmp(R4, ShifterOperand(R0));
1333 __ b(&update, NE);
1334
1335 __ Bind(&call_target_function);
1336 // Call the target found in the cache. For a class id match, this is a
1337 // proper target for the given name and arguments descriptor. If the
1338 // illegal class id was found, the target is a cache miss handler that can
1339 // be invoked as a normal Dart function.
1340 __ add(IP, R2, ShifterOperand(R3, LSL, 2));
1341 __ ldr(R0, FieldAddress(IP, base + kWordSize));
1342 __ ldr(R0, FieldAddress(R0, Function::code_offset()));
1343 __ ldr(R0, FieldAddress(R0, Code::instructions_offset()));
1344 __ LoadObject(R5, ic_data);
1345 __ LoadObject(R4, arguments_descriptor);
1346 __ AddImmediate(R0, Instructions::HeaderSize() - kHeapObjectTag);
1347 __ blx(R0);
1348 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos);
1349 RecordSafepoint(locs);
1350 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos);
1351 __ Drop(argument_count);
zra 2013/05/24 17:11:41 Since the arguments are already pushed on the stac
regis 2013/05/24 18:52:09 Is that unexpected? The same is done for other cal
1294 } 1352 }
1295 1353
1296 1354
1297 void FlowGraphCompiler::EmitStaticCall(const Function& function, 1355 void FlowGraphCompiler::EmitStaticCall(const Function& function,
1298 const Array& arguments_descriptor, 1356 const Array& arguments_descriptor,
1299 intptr_t argument_count, 1357 intptr_t argument_count,
1300 intptr_t deopt_id, 1358 intptr_t deopt_id,
1301 intptr_t token_pos, 1359 intptr_t token_pos,
1302 LocationSummary* locs) { 1360 LocationSummary* locs) {
1303 __ LoadObject(R4, arguments_descriptor); 1361 __ LoadObject(R4, arguments_descriptor);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 1499
1442 1500
1443 void FlowGraphCompiler::EmitDoubleCompareBool(Condition true_condition, 1501 void FlowGraphCompiler::EmitDoubleCompareBool(Condition true_condition,
1444 FpuRegister left, 1502 FpuRegister left,
1445 FpuRegister right, 1503 FpuRegister right,
1446 Register result) { 1504 Register result) {
1447 UNIMPLEMENTED(); 1505 UNIMPLEMENTED();
1448 } 1506 }
1449 1507
1450 1508
1451 Condition FlowGraphCompiler::FlipCondition(Condition condition) { 1509 Condition FlowGraphCompiler::FlipCondition(Condition condition) {
zra 2013/05/24 17:11:41 It looks like this is only used in intermediate_la
regis 2013/05/24 18:52:09 Done. There are other static functions transformin
1452 UNIMPLEMENTED(); 1510 switch (condition) {
1453 return condition; 1511 case EQ: return EQ;
1512 case NE: return NE;
1513 case LT: return GT;
1514 case LE: return GE;
1515 case GT: return LT;
1516 case GE: return LE;
1517 case CC: return HI;
1518 case LS: return CS;
1519 case HI: return CC;
1520 case CS: return LS;
1521 default:
1522 UNIMPLEMENTED();
1523 return EQ;
1524 }
1454 } 1525 }
1455 1526
1456 1527
1457 bool FlowGraphCompiler::EvaluateCondition(Condition condition, 1528 bool FlowGraphCompiler::EvaluateCondition(Condition condition,
zra 2013/05/24 17:11:41 I couldn't find where this function is called. It
regis 2013/05/24 18:52:09 Done.
1458 intptr_t left, 1529 intptr_t left,
1459 intptr_t right) { 1530 intptr_t right) {
1460 UNIMPLEMENTED(); 1531 const uintptr_t unsigned_left = static_cast<uintptr_t>(left);
1461 return false; 1532 const uintptr_t unsigned_right = static_cast<uintptr_t>(right);
1533 switch (condition) {
1534 case EQ: return left == right;
1535 case NE: return left != right;
1536 case LT: return left < right;
1537 case LE: return left <= right;
1538 case GT: return left > right;
1539 case GE: return left >= right;
1540 case CC: return unsigned_left < unsigned_right;
1541 case LS: return unsigned_left <= unsigned_right;
1542 case HI: return unsigned_left > unsigned_right;
1543 case CS: return unsigned_left >= unsigned_right;
1544 default:
1545 UNIMPLEMENTED();
1546 return false;
1547 }
1462 } 1548 }
1463 1549
1464 1550
1465 FieldAddress FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid, 1551 FieldAddress FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid,
1466 intptr_t index_scale, 1552 intptr_t index_scale,
1467 Register array, 1553 Register array,
1468 intptr_t index) { 1554 intptr_t index) {
1469 UNIMPLEMENTED(); 1555 UNIMPLEMENTED();
1470 return FieldAddress(array, index); 1556 return FieldAddress(array, index);
1471 } 1557 }
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1680 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { 1766 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) {
1681 __ vldrd(reg, Address(SP, kDoubleSize, Address::PostIndex)); 1767 __ vldrd(reg, Address(SP, kDoubleSize, Address::PostIndex));
1682 } 1768 }
1683 1769
1684 1770
1685 #undef __ 1771 #undef __
1686 1772
1687 } // namespace dart 1773 } // namespace dart
1688 1774
1689 #endif // defined TARGET_ARCH_ARM 1775 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/deopt_instructions.cc ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698