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

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/flow_graph_compiler.h ('k') | runtime/vm/flow_graph_compiler_ia32.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);
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 1507
1450 1508
1451 void FlowGraphCompiler::EmitDoubleCompareBool(Condition true_condition, 1509 void FlowGraphCompiler::EmitDoubleCompareBool(Condition true_condition,
1452 FpuRegister left, 1510 FpuRegister left,
1453 FpuRegister right, 1511 FpuRegister right,
1454 Register result) { 1512 Register result) {
1455 UNIMPLEMENTED(); 1513 UNIMPLEMENTED();
1456 } 1514 }
1457 1515
1458 1516
1459 Condition FlowGraphCompiler::FlipCondition(Condition condition) {
1460 UNIMPLEMENTED();
1461 return condition;
1462 }
1463
1464
1465 bool FlowGraphCompiler::EvaluateCondition(Condition condition,
1466 intptr_t left,
1467 intptr_t right) {
1468 UNIMPLEMENTED();
1469 return false;
1470 }
1471
1472
1473 FieldAddress FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid, 1517 FieldAddress FlowGraphCompiler::ElementAddressForIntIndex(intptr_t cid,
1474 intptr_t index_scale, 1518 intptr_t index_scale,
1475 Register array, 1519 Register array,
1476 intptr_t index) { 1520 intptr_t index) {
1477 UNIMPLEMENTED(); 1521 UNIMPLEMENTED();
1478 return FieldAddress(array, index); 1522 return FieldAddress(array, index);
1479 } 1523 }
1480 1524
1481 1525
1482 FieldAddress FlowGraphCompiler::ElementAddressForRegIndex(intptr_t cid, 1526 FieldAddress FlowGraphCompiler::ElementAddressForRegIndex(intptr_t cid,
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { 1732 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) {
1689 __ vldrd(reg, Address(SP, kDoubleSize, Address::PostIndex)); 1733 __ vldrd(reg, Address(SP, kDoubleSize, Address::PostIndex));
1690 } 1734 }
1691 1735
1692 1736
1693 #undef __ 1737 #undef __
1694 1738
1695 } // namespace dart 1739 } // namespace dart
1696 1740
1697 #endif // defined TARGET_ARCH_ARM 1741 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698