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

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

Issue 1867913004: Specialize instance calls when the call receiver is the method receiver and the method class has a … (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « runtime/vm/flow_graph_compiler_arm.cc ('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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "vm/ast_printer.h" 10 #include "vm/ast_printer.h"
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 #endif 1544 #endif
1545 1545
1546 1546
1547 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data, 1547 void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data,
1548 intptr_t argument_count, 1548 intptr_t argument_count,
1549 const Array& argument_names, 1549 const Array& argument_names,
1550 Label* failed, 1550 Label* failed,
1551 Label* match_found, 1551 Label* match_found,
1552 intptr_t deopt_id, 1552 intptr_t deopt_id,
1553 TokenPosition token_index, 1553 TokenPosition token_index,
1554 LocationSummary* locs) { 1554 LocationSummary* locs,
1555 bool complete) {
1555 ASSERT(is_optimizing()); 1556 ASSERT(is_optimizing());
1556 1557
1557 __ Comment("EmitTestAndCall"); 1558 __ Comment("EmitTestAndCall");
1558 const Array& arguments_descriptor = 1559 const Array& arguments_descriptor =
1559 Array::ZoneHandle(zone(), ArgumentsDescriptor::New(argument_count, 1560 Array::ZoneHandle(zone(), ArgumentsDescriptor::New(argument_count,
1560 argument_names)); 1561 argument_names));
1561 1562
1562 // Load receiver into R0. 1563 // Load receiver into R0.
1563 __ LoadFromOffset(R0, SP, (argument_count - 1) * kWordSize); 1564 __ LoadFromOffset(R0, SP, (argument_count - 1) * kWordSize);
1564 __ LoadObject(R4, arguments_descriptor); 1565 __ LoadObject(R4, arguments_descriptor);
1565 1566
1566 const bool kFirstCheckIsSmi = ic_data.GetReceiverClassIdAt(0) == kSmiCid; 1567 const bool kFirstCheckIsSmi = ic_data.GetReceiverClassIdAt(0) == kSmiCid;
1567 const intptr_t kNumChecks = ic_data.NumberOfChecks(); 1568 const intptr_t kNumChecks = ic_data.NumberOfChecks();
1568 1569
1569 ASSERT(!ic_data.IsNull() && (kNumChecks > 0)); 1570 ASSERT(!ic_data.IsNull() && (kNumChecks > 0));
1570 1571
1571 Label after_smi_test; 1572 Label after_smi_test;
1572 __ tsti(R0, Immediate(kSmiTagMask));
1573 if (kFirstCheckIsSmi) { 1573 if (kFirstCheckIsSmi) {
1574 __ tsti(R0, Immediate(kSmiTagMask));
1574 // Jump if receiver is not Smi. 1575 // Jump if receiver is not Smi.
1575 if (kNumChecks == 1) { 1576 if (kNumChecks == 1) {
1576 __ b(failed, NE); 1577 __ b(failed, NE);
1577 } else { 1578 } else {
1578 __ b(&after_smi_test, NE); 1579 __ b(&after_smi_test, NE);
1579 } 1580 }
1580 // Do not use the code from the function, but let the code be patched so 1581 // Do not use the code from the function, but let the code be patched so
1581 // that we can record the outgoing edges to other code. 1582 // that we can record the outgoing edges to other code.
1582 const Function& function = Function::ZoneHandle( 1583 const Function& function = Function::ZoneHandle(
1583 zone(), ic_data.GetTargetAt(0)); 1584 zone(), ic_data.GetTargetAt(0));
1584 GenerateStaticDartCall(deopt_id, 1585 GenerateStaticDartCall(deopt_id,
1585 token_index, 1586 token_index,
1586 *StubCode::CallStaticFunction_entry(), 1587 *StubCode::CallStaticFunction_entry(),
1587 RawPcDescriptors::kOther, 1588 RawPcDescriptors::kOther,
1588 locs, 1589 locs,
1589 function); 1590 function);
1590 __ Drop(argument_count); 1591 __ Drop(argument_count);
1591 if (kNumChecks > 1) { 1592 if (kNumChecks > 1) {
1592 __ b(match_found); 1593 __ b(match_found);
1593 } 1594 }
1594 } else { 1595 } else {
1595 // Receiver is Smi, but Smi is not a valid class therefore fail. 1596 // Receiver is Smi, but Smi is not a valid class therefore fail.
1596 // (Smi class must be first in the list). 1597 // (Smi class must be first in the list).
1597 __ b(failed, EQ); 1598 if (!complete) {
1599 __ tsti(R0, Immediate(kSmiTagMask));
1600 __ b(failed, EQ);
1601 }
1598 } 1602 }
1599 __ Bind(&after_smi_test); 1603 __ Bind(&after_smi_test);
1600 1604
1601 ASSERT(!ic_data.IsNull() && (kNumChecks > 0)); 1605 ASSERT(!ic_data.IsNull() && (kNumChecks > 0));
1602 GrowableArray<CidTarget> sorted(kNumChecks); 1606 GrowableArray<CidTarget> sorted(kNumChecks);
1603 SortICDataByCount(ic_data, &sorted, /* drop_smi = */ true); 1607 SortICDataByCount(ic_data, &sorted, /* drop_smi = */ true);
1604 1608
1605 // Value is not Smi, 1609 // Value is not Smi,
1606 const intptr_t kSortedLen = sorted.length(); 1610 const intptr_t kSortedLen = sorted.length();
1607 // If kSortedLen is 0 then only a Smi check was needed; the Smi check above 1611 // If kSortedLen is 0 then only a Smi check was needed; the Smi check above
1608 // will fail if there was only one check and receiver is not Smi. 1612 // will fail if there was only one check and receiver is not Smi.
1609 if (kSortedLen == 0) return; 1613 if (kSortedLen == 0) return;
1610 1614
1611 __ LoadClassId(R2, R0); 1615 __ LoadClassId(R2, R0);
1612 for (intptr_t i = 0; i < kSortedLen; i++) { 1616 for (intptr_t i = 0; i < kSortedLen; i++) {
1613 const bool kIsLastCheck = (i == (kSortedLen - 1)); 1617 const bool kIsLastCheck = (i == (kSortedLen - 1));
1614 ASSERT(sorted[i].cid != kSmiCid); 1618 ASSERT(sorted[i].cid != kSmiCid);
1615 Label next_test; 1619 Label next_test;
1616 __ CompareImmediate(R2, sorted[i].cid); 1620 if (!complete) {
1617 if (kIsLastCheck) { 1621 __ CompareImmediate(R2, sorted[i].cid);
1618 __ b(failed, NE); 1622 if (kIsLastCheck) {
1623 __ b(failed, NE);
1624 } else {
1625 __ b(&next_test, NE);
1626 }
1619 } else { 1627 } else {
1620 __ b(&next_test, NE); 1628 if (!kIsLastCheck) {
1629 __ CompareImmediate(R2, sorted[i].cid);
1630 __ b(&next_test, NE);
1631 }
1621 } 1632 }
1622 // Do not use the code from the function, but let the code be patched so 1633 // Do not use the code from the function, but let the code be patched so
1623 // that we can record the outgoing edges to other code. 1634 // that we can record the outgoing edges to other code.
1624 const Function& function = *sorted[i].target; 1635 const Function& function = *sorted[i].target;
1625 GenerateStaticDartCall(deopt_id, 1636 GenerateStaticDartCall(deopt_id,
1626 token_index, 1637 token_index,
1627 *StubCode::CallStaticFunction_entry(), 1638 *StubCode::CallStaticFunction_entry(),
1628 RawPcDescriptors::kOther, 1639 RawPcDescriptors::kOther,
1629 locs, 1640 locs,
1630 function); 1641 function);
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { 1925 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) {
1915 __ PopDouble(reg); 1926 __ PopDouble(reg);
1916 } 1927 }
1917 1928
1918 1929
1919 #undef __ 1930 #undef __
1920 1931
1921 } // namespace dart 1932 } // namespace dart
1922 1933
1923 #endif // defined TARGET_ARCH_ARM64 1934 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_arm.cc ('k') | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698