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

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

Issue 1343373003: Revert "VM: New calling convention for generated code." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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/assembler_arm64.cc ('k') | runtime/vm/assembler_ia32.h » ('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" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/os.h" 10 #include "vm/os.h"
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 __ ret(); 1615 __ ret();
1616 } 1616 }
1617 1617
1618 1618
1619 ASSEMBLER_TEST_RUN(LoadImmediateMedNeg4, test) { 1619 ASSEMBLER_TEST_RUN(LoadImmediateMedNeg4, test) {
1620 typedef int64_t (*Int64Return)() DART_UNUSED; 1620 typedef int64_t (*Int64Return)() DART_UNUSED;
1621 EXPECT_EQ(-0x12341234, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); 1621 EXPECT_EQ(-0x12341234, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
1622 } 1622 }
1623 1623
1624 1624
1625 static void EnterTestFrame(Assembler* assembler) {
1626 __ EnterFrame(0);
1627 __ Push(CODE_REG);
1628 __ TagAndPushPP();
1629 __ ldr(CODE_REG, Address(R0, VMHandles::kOffsetOfRawPtrInHandle));
1630 __ LoadPoolPointer(PP);
1631 }
1632
1633
1634 static void LeaveTestFrame(Assembler* assembler) {
1635 __ PopAndUntagPP();
1636 __ Pop(CODE_REG);
1637 __ LeaveFrame();
1638 }
1639
1640
1641
1642
1643 // Loading immediate values with the object pool. 1625 // Loading immediate values with the object pool.
1644 ASSEMBLER_TEST_GENERATE(LoadImmediatePPSmall, assembler) { 1626 ASSEMBLER_TEST_GENERATE(LoadImmediatePPSmall, assembler) {
1645 __ SetupDartSP(kTestStackSpace); 1627 __ SetupDartSP(kTestStackSpace);
1646 EnterTestFrame(assembler); 1628 __ EnterStubFrame();
1647 __ LoadImmediate(R0, 42); 1629 __ LoadImmediate(R0, 42);
1648 LeaveTestFrame(assembler); 1630 __ LeaveStubFrame();
1649 __ mov(CSP, SP); 1631 __ mov(CSP, SP);
1650 __ ret(); 1632 __ ret();
1651 } 1633 }
1652 1634
1653 1635
1654 ASSEMBLER_TEST_RUN(LoadImmediatePPSmall, test) { 1636 ASSEMBLER_TEST_RUN(LoadImmediatePPSmall, test) {
1655 EXPECT_EQ(42, test->InvokeWithCode<int64_t>()); 1637 EXPECT_EQ(42, test->Invoke<int64_t>());
1656 } 1638 }
1657 1639
1658 1640
1659 ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed, assembler) { 1641 ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed, assembler) {
1660 __ SetupDartSP(kTestStackSpace); 1642 __ SetupDartSP(kTestStackSpace);
1661 EnterTestFrame(assembler); 1643 __ EnterStubFrame();
1662 __ LoadImmediate(R0, 0xf1234123); 1644 __ LoadImmediate(R0, 0xf1234123);
1663 LeaveTestFrame(assembler); 1645 __ LeaveStubFrame();
1664 __ mov(CSP, SP); 1646 __ mov(CSP, SP);
1665 __ ret(); 1647 __ ret();
1666 } 1648 }
1667 1649
1668 1650
1669 ASSEMBLER_TEST_RUN(LoadImmediatePPMed, test) { 1651 ASSEMBLER_TEST_RUN(LoadImmediatePPMed, test) {
1670 EXPECT_EQ(0xf1234123, test->InvokeWithCode<int64_t>()); 1652 EXPECT_EQ(0xf1234123, test->Invoke<int64_t>());
1671 } 1653 }
1672 1654
1673 1655
1674 ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed2, assembler) { 1656 ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed2, assembler) {
1675 __ SetupDartSP(kTestStackSpace); 1657 __ SetupDartSP(kTestStackSpace);
1676 EnterTestFrame(assembler); 1658 __ EnterStubFrame();
1677 __ LoadImmediate(R0, 0x4321f1234124); 1659 __ LoadImmediate(R0, 0x4321f1234124);
1678 LeaveTestFrame(assembler); 1660 __ LeaveStubFrame();
1679 __ mov(CSP, SP); 1661 __ mov(CSP, SP);
1680 __ ret(); 1662 __ ret();
1681 } 1663 }
1682 1664
1683 1665
1684 ASSEMBLER_TEST_RUN(LoadImmediatePPMed2, test) { 1666 ASSEMBLER_TEST_RUN(LoadImmediatePPMed2, test) {
1685 EXPECT_EQ(0x4321f1234124, test->InvokeWithCode<int64_t>()); 1667 EXPECT_EQ(0x4321f1234124, test->Invoke<int64_t>());
1686 } 1668 }
1687 1669
1688 1670
1689 ASSEMBLER_TEST_GENERATE(LoadImmediatePPLarge, assembler) { 1671 ASSEMBLER_TEST_GENERATE(LoadImmediatePPLarge, assembler) {
1690 __ SetupDartSP(kTestStackSpace); 1672 __ SetupDartSP(kTestStackSpace);
1691 EnterTestFrame(assembler); 1673 __ EnterStubFrame();
1692 __ LoadImmediate(R0, 0x9287436598237465); 1674 __ LoadImmediate(R0, 0x9287436598237465);
1693 LeaveTestFrame(assembler); 1675 __ LeaveStubFrame();
1694 __ mov(CSP, SP); 1676 __ mov(CSP, SP);
1695 __ ret(); 1677 __ ret();
1696 } 1678 }
1697 1679
1698 1680
1699 ASSEMBLER_TEST_RUN(LoadImmediatePPLarge, test) { 1681 ASSEMBLER_TEST_RUN(LoadImmediatePPLarge, test) {
1700 EXPECT_EQ(static_cast<int64_t>(0x9287436598237465), 1682 EXPECT_EQ(static_cast<int64_t>(0x9287436598237465), test->Invoke<int64_t>());
1701 test->InvokeWithCode<int64_t>());
1702 } 1683 }
1703 1684
1704 1685
1705 #define ASSEMBLER_TEST_RUN_WITH_THREAD(result_type, var_name) \ 1686 #define ASSEMBLER_TEST_RUN_WITH_THREAD(result_type, var_name) \
1706 Thread* thread = Thread::Current(); \ 1687 Thread* thread = Thread::Current(); \
1707 result_type var_name = test->InvokeWithCode<result_type>(thread); 1688 result_type var_name = test->Invoke<result_type>(thread);
1708 1689
1709 1690
1710 // LoadObject null. 1691 // LoadObject null.
1711 ASSEMBLER_TEST_GENERATE(LoadObjectNull, assembler) { 1692 ASSEMBLER_TEST_GENERATE(LoadObjectNull, assembler) {
1712 __ SetupDartSP(kTestStackSpace); 1693 __ SetupDartSP(kTestStackSpace);
1713 EnterTestFrame(assembler); 1694 __ EnterStubFrame();
1714 __ Push(THR); 1695 __ Push(THR);
1715 __ mov(THR, R1); 1696 __ mov(THR, R0);
1716 __ LoadObject(R0, Object::null_object()); 1697 __ LoadObject(R0, Object::null_object());
1717 __ Pop(THR); 1698 __ Pop(THR);
1718 LeaveTestFrame(assembler); 1699 __ LeaveStubFrame();
1719 __ mov(CSP, SP); 1700 __ mov(CSP, SP);
1720 __ ret(); 1701 __ ret();
1721 } 1702 }
1722 1703
1723 1704
1724 ASSEMBLER_TEST_RUN(LoadObjectNull, test) { 1705 ASSEMBLER_TEST_RUN(LoadObjectNull, test) {
1725 ASSEMBLER_TEST_RUN_WITH_THREAD(RawObject*, result); 1706 ASSEMBLER_TEST_RUN_WITH_THREAD(RawObject*, result);
1726 EXPECT_EQ(Object::null(), result); 1707 EXPECT_EQ(Object::null(), result);
1727 } 1708 }
1728 1709
1729 1710
1730 ASSEMBLER_TEST_GENERATE(LoadObjectTrue, assembler) { 1711 ASSEMBLER_TEST_GENERATE(LoadObjectTrue, assembler) {
1731 __ SetupDartSP(kTestStackSpace); 1712 __ SetupDartSP(kTestStackSpace);
1732 EnterTestFrame(assembler); 1713 __ EnterStubFrame();
1733 __ Push(THR); 1714 __ Push(THR);
1734 __ mov(THR, R1); 1715 __ mov(THR, R0);
1735 __ LoadObject(R0, Bool::True()); 1716 __ LoadObject(R0, Bool::True());
1736 __ Pop(THR); 1717 __ Pop(THR);
1737 LeaveTestFrame(assembler); 1718 __ LeaveDartFrame();
1738 __ mov(CSP, SP); 1719 __ mov(CSP, SP);
1739 __ ret(); 1720 __ ret();
1740 } 1721 }
1741 1722
1742 1723
1743 ASSEMBLER_TEST_RUN(LoadObjectTrue, test) { 1724 ASSEMBLER_TEST_RUN(LoadObjectTrue, test) {
1744 ASSEMBLER_TEST_RUN_WITH_THREAD(RawObject*, result); 1725 ASSEMBLER_TEST_RUN_WITH_THREAD(RawObject*, result);
1745 EXPECT_EQ(Bool::True().raw(), result); 1726 EXPECT_EQ(Bool::True().raw(), result);
1746 } 1727 }
1747 1728
1748 1729
1749 ASSEMBLER_TEST_GENERATE(LoadObjectFalse, assembler) { 1730 ASSEMBLER_TEST_GENERATE(LoadObjectFalse, assembler) {
1750 __ SetupDartSP(kTestStackSpace); 1731 __ SetupDartSP(kTestStackSpace);
1751 EnterTestFrame(assembler); 1732 __ EnterStubFrame();
1752 __ Push(THR); 1733 __ Push(THR);
1753 __ mov(THR, R1); 1734 __ mov(THR, R0);
1754 __ LoadObject(R0, Bool::False()); 1735 __ LoadObject(R0, Bool::False());
1755 __ Pop(THR); 1736 __ Pop(THR);
1756 LeaveTestFrame(assembler); 1737 __ LeaveStubFrame();
1757 __ mov(CSP, SP); 1738 __ mov(CSP, SP);
1758 __ ret(); 1739 __ ret();
1759 } 1740 }
1760 1741
1761 1742
1762 ASSEMBLER_TEST_RUN(LoadObjectFalse, test) { 1743 ASSEMBLER_TEST_RUN(LoadObjectFalse, test) {
1763 ASSEMBLER_TEST_RUN_WITH_THREAD(RawObject*, result); 1744 ASSEMBLER_TEST_RUN_WITH_THREAD(RawObject*, result);
1764 EXPECT_EQ(Bool::False().raw(), result); 1745 EXPECT_EQ(Bool::False().raw(), result);
1765 } 1746 }
1766 1747
(...skipping 1798 matching lines...) Expand 10 before | Expand all | Expand 10 after
3565 } 3546 }
3566 3547
3567 3548
3568 // Called from assembler_test.cc. 3549 // Called from assembler_test.cc.
3569 // LR: return address. 3550 // LR: return address.
3570 // R0: value. 3551 // R0: value.
3571 // R1: growable array. 3552 // R1: growable array.
3572 // R2: current thread. 3553 // R2: current thread.
3573 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { 3554 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) {
3574 __ SetupDartSP(kTestStackSpace); 3555 __ SetupDartSP(kTestStackSpace);
3575 __ Push(CODE_REG);
3576 __ Push(THR); 3556 __ Push(THR);
3577 __ Push(LR); 3557 __ Push(LR);
3578 __ mov(THR, R2); 3558 __ mov(THR, R2);
3579 __ StoreIntoObject(R1, 3559 __ StoreIntoObject(R1,
3580 FieldAddress(R1, GrowableObjectArray::data_offset()), 3560 FieldAddress(R1, GrowableObjectArray::data_offset()),
3581 R0); 3561 R0);
3582 __ Pop(LR); 3562 __ Pop(LR);
3583 __ Pop(THR); 3563 __ Pop(THR);
3584 __ Pop(CODE_REG);
3585 __ mov(CSP, SP); 3564 __ mov(CSP, SP);
3586 __ ret(); 3565 __ ret();
3587 } 3566 }
3588 3567
3589 3568
3590 ASSEMBLER_TEST_GENERATE(ComputeRange, assembler) { 3569 ASSEMBLER_TEST_GENERATE(ComputeRange, assembler) {
3591 __ SetupDartSP(kTestStackSpace); 3570 __ SetupDartSP(kTestStackSpace);
3592 EnterTestFrame(assembler); 3571 __ EnterStubFrame();
3593 Label miss, done; 3572 Label miss, done;
3573 __ mov(R1, R0);
3594 __ ComputeRange(R0, R1, R2, &miss); 3574 __ ComputeRange(R0, R1, R2, &miss);
3595 __ b(&done); 3575 __ b(&done);
3596 3576
3597 __ Bind(&miss); 3577 __ Bind(&miss);
3598 __ LoadImmediate(R0, -1); 3578 __ LoadImmediate(R0, -1);
3599 3579
3600 __ Bind(&done); 3580 __ Bind(&done);
3601 LeaveTestFrame(assembler); 3581 __ LeaveStubFrame();
3602 __ mov(CSP, SP); 3582 __ mov(CSP, SP);
3603 __ ret(); 3583 __ ret();
3604 } 3584 }
3605 3585
3606 3586
3607 ASSEMBLER_TEST_RUN(ComputeRange, test) { 3587 ASSEMBLER_TEST_RUN(ComputeRange, test) {
3608 #define RANGE_OF(arg_type, v) test->InvokeWithCode<intptr_t, arg_type>(v) 3588 #define RANGE_OF(arg_type, v) test->Invoke<intptr_t, arg_type>(v)
3609 3589
3610 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(RawSmi*, Smi::New(0))); 3590 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(RawSmi*, Smi::New(0)));
3611 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(RawSmi*, Smi::New(1))); 3591 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(RawSmi*, Smi::New(1)));
3612 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(RawSmi*, Smi::New(kMaxInt32))); 3592 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(RawSmi*, Smi::New(kMaxInt32)));
3613 EXPECT_EQ(ICData::kInt32RangeBit | ICData::kSignedRangeBit, 3593 EXPECT_EQ(ICData::kInt32RangeBit | ICData::kSignedRangeBit,
3614 RANGE_OF(RawSmi*, Smi::New(-1))); 3594 RANGE_OF(RawSmi*, Smi::New(-1)));
3615 EXPECT_EQ(ICData::kInt32RangeBit | ICData::kSignedRangeBit, 3595 EXPECT_EQ(ICData::kInt32RangeBit | ICData::kSignedRangeBit,
3616 RANGE_OF(RawSmi*, Smi::New(kMinInt32))); 3596 RANGE_OF(RawSmi*, Smi::New(kMinInt32)));
3617 3597
3618 EXPECT_EQ(ICData::kUint32RangeBit, 3598 EXPECT_EQ(ICData::kUint32RangeBit,
(...skipping 24 matching lines...) Expand all
3643 3623
3644 EXPECT_EQ(-1, RANGE_OF(RawBool*, Bool::True().raw())); 3624 EXPECT_EQ(-1, RANGE_OF(RawBool*, Bool::True().raw()));
3645 3625
3646 #undef RANGE_OF 3626 #undef RANGE_OF
3647 } 3627 }
3648 3628
3649 3629
3650 } // namespace dart 3630 } // namespace dart
3651 3631
3652 #endif // defined(TARGET_ARCH_ARM64) 3632 #endif // defined(TARGET_ARCH_ARM64)
OLDNEW
« no previous file with comments | « runtime/vm/assembler_arm64.cc ('k') | runtime/vm/assembler_ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698