| OLD | NEW |
| 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 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 __ LoadObject(R4, arguments_descriptor); | 1347 __ LoadObject(R4, arguments_descriptor); |
| 1348 __ AddImmediate(R0, Instructions::HeaderSize() - kHeapObjectTag); | 1348 __ AddImmediate(R0, Instructions::HeaderSize() - kHeapObjectTag); |
| 1349 __ blx(R0); | 1349 __ blx(R0); |
| 1350 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos); | 1350 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos); |
| 1351 RecordSafepoint(locs); | 1351 RecordSafepoint(locs); |
| 1352 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos); | 1352 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos); |
| 1353 __ Drop(argument_count); | 1353 __ Drop(argument_count); |
| 1354 } | 1354 } |
| 1355 | 1355 |
| 1356 | 1356 |
| 1357 void FlowGraphCompiler::EmitStaticCall(const Function& function, | 1357 void FlowGraphCompiler::EmitOptimizedStaticCall( |
| 1358 const Array& arguments_descriptor, | 1358 const Function& function, |
| 1359 intptr_t argument_count, | 1359 const Array& arguments_descriptor, |
| 1360 intptr_t deopt_id, | 1360 intptr_t argument_count, |
| 1361 intptr_t token_pos, | 1361 intptr_t deopt_id, |
| 1362 LocationSummary* locs) { | 1362 intptr_t token_pos, |
| 1363 LocationSummary* locs) { |
| 1363 __ LoadObject(R4, arguments_descriptor); | 1364 __ LoadObject(R4, arguments_descriptor); |
| 1364 // Do not use the code from the function, but let the code be patched so that | 1365 // Do not use the code from the function, but let the code be patched so that |
| 1365 // we can record the outgoing edges to other code. | 1366 // we can record the outgoing edges to other code. |
| 1366 GenerateDartCall(deopt_id, | 1367 GenerateDartCall(deopt_id, |
| 1367 token_pos, | 1368 token_pos, |
| 1368 &StubCode::CallStaticFunctionLabel(), | 1369 &StubCode::CallStaticFunctionLabel(), |
| 1369 PcDescriptors::kFuncCall, | 1370 PcDescriptors::kOptStaticCall, |
| 1370 locs); | 1371 locs); |
| 1371 AddStaticCallTarget(function); | 1372 AddStaticCallTarget(function); |
| 1372 __ Drop(argument_count); | 1373 __ Drop(argument_count); |
| 1373 } | 1374 } |
| 1374 | 1375 |
| 1375 | 1376 |
| 1376 void FlowGraphCompiler::EmitUnoptimizedStaticCall( | 1377 void FlowGraphCompiler::EmitUnoptimizedStaticCall( |
| 1377 const Function& target_function, | 1378 const Function& target_function, |
| 1378 const Array& arguments_descriptor, | 1379 const Array& arguments_descriptor, |
| 1379 intptr_t argument_count, | 1380 intptr_t argument_count, |
| 1380 intptr_t deopt_id, | 1381 intptr_t deopt_id, |
| 1381 intptr_t token_pos, | 1382 intptr_t token_pos, |
| 1382 LocationSummary* locs) { | 1383 LocationSummary* locs) { |
| 1383 const ICData& ic_data = ICData::ZoneHandle( | 1384 const ICData& ic_data = ICData::ZoneHandle( |
| 1384 ICData::New(parsed_function().function(), // Caller function. | 1385 ICData::New(parsed_function().function(), // Caller function. |
| 1385 String::Handle(target_function.name()), | 1386 String::Handle(target_function.name()), |
| 1386 arguments_descriptor, | 1387 arguments_descriptor, |
| 1387 deopt_id, | 1388 deopt_id, |
| 1388 0)); // No arguments checked. | 1389 0)); // No arguments checked. |
| 1389 ic_data.AddTarget(target_function); | 1390 ic_data.AddTarget(target_function); |
| 1390 __ LoadObject(R5, ic_data); | 1391 __ LoadObject(R5, ic_data); |
| 1391 GenerateDartCall(deopt_id, | 1392 GenerateDartCall(deopt_id, |
| 1392 token_pos, | 1393 token_pos, |
| 1393 &StubCode::UnoptimizedStaticCallLabel(), | 1394 &StubCode::UnoptimizedStaticCallLabel(), |
| 1394 PcDescriptors::kFuncCall, | 1395 PcDescriptors::kUnoptStaticCall, |
| 1395 locs); | 1396 locs); |
| 1396 __ Drop(argument_count); | 1397 __ Drop(argument_count); |
| 1397 } | 1398 } |
| 1398 | 1399 |
| 1399 | 1400 |
| 1400 void FlowGraphCompiler::EmitEqualityRegConstCompare(Register reg, | 1401 void FlowGraphCompiler::EmitEqualityRegConstCompare(Register reg, |
| 1401 const Object& obj, | 1402 const Object& obj, |
| 1402 bool needs_number_check, | 1403 bool needs_number_check, |
| 1403 intptr_t token_pos) { | 1404 intptr_t token_pos) { |
| 1404 if (needs_number_check && | 1405 if (needs_number_check && |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1518 | 1519 |
| 1519 | 1520 |
| 1520 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data, | 1521 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data, |
| 1521 Register class_id_reg, | 1522 Register class_id_reg, |
| 1522 intptr_t argument_count, | 1523 intptr_t argument_count, |
| 1523 const Array& argument_names, | 1524 const Array& argument_names, |
| 1524 Label* deopt, | 1525 Label* deopt, |
| 1525 intptr_t deopt_id, | 1526 intptr_t deopt_id, |
| 1526 intptr_t token_index, | 1527 intptr_t token_index, |
| 1527 LocationSummary* locs) { | 1528 LocationSummary* locs) { |
| 1529 ASSERT(is_optimizing()); |
| 1528 ASSERT(!ic_data.IsNull() && (ic_data.NumberOfChecks() > 0)); | 1530 ASSERT(!ic_data.IsNull() && (ic_data.NumberOfChecks() > 0)); |
| 1529 Label match_found; | 1531 Label match_found; |
| 1530 const intptr_t len = ic_data.NumberOfChecks(); | 1532 const intptr_t len = ic_data.NumberOfChecks(); |
| 1531 GrowableArray<CidTarget> sorted(len); | 1533 GrowableArray<CidTarget> sorted(len); |
| 1532 SortICDataByCount(ic_data, &sorted); | 1534 SortICDataByCount(ic_data, &sorted); |
| 1533 ASSERT(class_id_reg != R4); | 1535 ASSERT(class_id_reg != R4); |
| 1534 ASSERT(len > 0); // Why bother otherwise. | 1536 ASSERT(len > 0); // Why bother otherwise. |
| 1535 const Array& arguments_descriptor = | 1537 const Array& arguments_descriptor = |
| 1536 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, | 1538 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, |
| 1537 argument_names)); | 1539 argument_names)); |
| 1538 __ LoadObject(R4, arguments_descriptor); | 1540 __ LoadObject(R4, arguments_descriptor); |
| 1539 for (intptr_t i = 0; i < len; i++) { | 1541 for (intptr_t i = 0; i < len; i++) { |
| 1540 const bool is_last_check = (i == (len - 1)); | 1542 const bool is_last_check = (i == (len - 1)); |
| 1541 Label next_test; | 1543 Label next_test; |
| 1542 assembler()->CompareImmediate(class_id_reg, sorted[i].cid); | 1544 assembler()->CompareImmediate(class_id_reg, sorted[i].cid); |
| 1543 if (is_last_check) { | 1545 if (is_last_check) { |
| 1544 assembler()->b(deopt, NE); | 1546 assembler()->b(deopt, NE); |
| 1545 } else { | 1547 } else { |
| 1546 assembler()->b(&next_test, NE); | 1548 assembler()->b(&next_test, NE); |
| 1547 } | 1549 } |
| 1548 // Do not use the code from the function, but let the code be patched so | 1550 // Do not use the code from the function, but let the code be patched so |
| 1549 // that we can record the outgoing edges to other code. | 1551 // that we can record the outgoing edges to other code. |
| 1550 GenerateDartCall(deopt_id, | 1552 GenerateDartCall(deopt_id, |
| 1551 token_index, | 1553 token_index, |
| 1552 &StubCode::CallStaticFunctionLabel(), | 1554 &StubCode::CallStaticFunctionLabel(), |
| 1553 PcDescriptors::kFuncCall, | 1555 PcDescriptors::kOptStaticCall, |
| 1554 locs); | 1556 locs); |
| 1555 const Function& function = *sorted[i].target; | 1557 const Function& function = *sorted[i].target; |
| 1556 AddStaticCallTarget(function); | 1558 AddStaticCallTarget(function); |
| 1557 __ Drop(argument_count); | 1559 __ Drop(argument_count); |
| 1558 if (!is_last_check) { | 1560 if (!is_last_check) { |
| 1559 assembler()->b(&match_found); | 1561 assembler()->b(&match_found); |
| 1560 } | 1562 } |
| 1561 assembler()->Bind(&next_test); | 1563 assembler()->Bind(&next_test); |
| 1562 } | 1564 } |
| 1563 assembler()->Bind(&match_found); | 1565 assembler()->Bind(&match_found); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1812 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1814 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
| 1813 __ vldrd(reg, Address(SP, kDoubleSize, Address::PostIndex)); | 1815 __ vldrd(reg, Address(SP, kDoubleSize, Address::PostIndex)); |
| 1814 } | 1816 } |
| 1815 | 1817 |
| 1816 | 1818 |
| 1817 #undef __ | 1819 #undef __ |
| 1818 | 1820 |
| 1819 } // namespace dart | 1821 } // namespace dart |
| 1820 | 1822 |
| 1821 #endif // defined TARGET_ARCH_ARM | 1823 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |