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

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

Issue 1494323002: Revert "Precompilation/x64: Load float vector constants via Thread." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 | « no previous file | runtime/vm/assembler_x64.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" 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 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) { 1625 static void EnterTestFrame(Assembler* assembler) {
1626 __ EnterFrame(0); 1626 __ EnterFrame(0);
1627 __ Push(CODE_REG); 1627 __ Push(CODE_REG);
1628 __ Push(THR);
1629 __ TagAndPushPP(); 1628 __ TagAndPushPP();
1630 __ ldr(CODE_REG, Address(R0, VMHandles::kOffsetOfRawPtrInHandle)); 1629 __ ldr(CODE_REG, Address(R0, VMHandles::kOffsetOfRawPtrInHandle));
1631 __ mov(THR, R1);
1632 __ LoadPoolPointer(PP); 1630 __ LoadPoolPointer(PP);
1633 } 1631 }
1634 1632
1635 1633
1636 static void LeaveTestFrame(Assembler* assembler) { 1634 static void LeaveTestFrame(Assembler* assembler) {
1637 __ PopAndUntagPP(); 1635 __ PopAndUntagPP();
1638 __ Pop(THR);
1639 __ Pop(CODE_REG); 1636 __ Pop(CODE_REG);
1640 __ LeaveFrame(); 1637 __ LeaveFrame();
1641 } 1638 }
1642 1639
1643 1640
1644 1641
1645 1642
1646 // Loading immediate values with the object pool. 1643 // Loading immediate values with the object pool.
1647 ASSEMBLER_TEST_GENERATE(LoadImmediatePPSmall, assembler) { 1644 ASSEMBLER_TEST_GENERATE(LoadImmediatePPSmall, assembler) {
1648 __ SetupDartSP(kTestStackSpace); 1645 __ SetupDartSP(kTestStackSpace);
1649 EnterTestFrame(assembler); 1646 EnterTestFrame(assembler);
1650 __ LoadImmediate(R0, 42); 1647 __ LoadImmediate(R0, 42);
1651 LeaveTestFrame(assembler); 1648 LeaveTestFrame(assembler);
1652 __ mov(CSP, SP); 1649 __ mov(CSP, SP);
1653 __ ret(); 1650 __ ret();
1654 } 1651 }
1655 1652
1656 1653
1657 ASSEMBLER_TEST_RUN(LoadImmediatePPSmall, test) { 1654 ASSEMBLER_TEST_RUN(LoadImmediatePPSmall, test) {
1658 EXPECT_EQ(42, test->InvokeWithCodeAndThread<int64_t>()); 1655 EXPECT_EQ(42, test->InvokeWithCode<int64_t>());
1659 } 1656 }
1660 1657
1661 1658
1662 ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed, assembler) { 1659 ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed, assembler) {
1663 __ SetupDartSP(kTestStackSpace); 1660 __ SetupDartSP(kTestStackSpace);
1664 EnterTestFrame(assembler); 1661 EnterTestFrame(assembler);
1665 __ LoadImmediate(R0, 0xf1234123); 1662 __ LoadImmediate(R0, 0xf1234123);
1666 LeaveTestFrame(assembler); 1663 LeaveTestFrame(assembler);
1667 __ mov(CSP, SP); 1664 __ mov(CSP, SP);
1668 __ ret(); 1665 __ ret();
1669 } 1666 }
1670 1667
1671 1668
1672 ASSEMBLER_TEST_RUN(LoadImmediatePPMed, test) { 1669 ASSEMBLER_TEST_RUN(LoadImmediatePPMed, test) {
1673 EXPECT_EQ(0xf1234123, test->InvokeWithCodeAndThread<int64_t>()); 1670 EXPECT_EQ(0xf1234123, test->InvokeWithCode<int64_t>());
1674 } 1671 }
1675 1672
1676 1673
1677 ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed2, assembler) { 1674 ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed2, assembler) {
1678 __ SetupDartSP(kTestStackSpace); 1675 __ SetupDartSP(kTestStackSpace);
1679 EnterTestFrame(assembler); 1676 EnterTestFrame(assembler);
1680 __ LoadImmediate(R0, 0x4321f1234124); 1677 __ LoadImmediate(R0, 0x4321f1234124);
1681 LeaveTestFrame(assembler); 1678 LeaveTestFrame(assembler);
1682 __ mov(CSP, SP); 1679 __ mov(CSP, SP);
1683 __ ret(); 1680 __ ret();
1684 } 1681 }
1685 1682
1686 1683
1687 ASSEMBLER_TEST_RUN(LoadImmediatePPMed2, test) { 1684 ASSEMBLER_TEST_RUN(LoadImmediatePPMed2, test) {
1688 EXPECT_EQ(0x4321f1234124, test->InvokeWithCodeAndThread<int64_t>()); 1685 EXPECT_EQ(0x4321f1234124, test->InvokeWithCode<int64_t>());
1689 } 1686 }
1690 1687
1691 1688
1692 ASSEMBLER_TEST_GENERATE(LoadImmediatePPLarge, assembler) { 1689 ASSEMBLER_TEST_GENERATE(LoadImmediatePPLarge, assembler) {
1693 __ SetupDartSP(kTestStackSpace); 1690 __ SetupDartSP(kTestStackSpace);
1694 EnterTestFrame(assembler); 1691 EnterTestFrame(assembler);
1695 __ LoadImmediate(R0, 0x9287436598237465); 1692 __ LoadImmediate(R0, 0x9287436598237465);
1696 LeaveTestFrame(assembler); 1693 LeaveTestFrame(assembler);
1697 __ mov(CSP, SP); 1694 __ mov(CSP, SP);
1698 __ ret(); 1695 __ ret();
1699 } 1696 }
1700 1697
1701 1698
1702 ASSEMBLER_TEST_RUN(LoadImmediatePPLarge, test) { 1699 ASSEMBLER_TEST_RUN(LoadImmediatePPLarge, test) {
1703 EXPECT_EQ(static_cast<int64_t>(0x9287436598237465), 1700 EXPECT_EQ(static_cast<int64_t>(0x9287436598237465),
1704 test->InvokeWithCodeAndThread<int64_t>()); 1701 test->InvokeWithCode<int64_t>());
1705 } 1702 }
1706 1703
1707 1704
1705 #define ASSEMBLER_TEST_RUN_WITH_THREAD(result_type, var_name) \
1706 Thread* thread = Thread::Current(); \
1707 result_type var_name = test->InvokeWithCode<result_type>(thread);
1708
1709
1708 // LoadObject null. 1710 // LoadObject null.
1709 ASSEMBLER_TEST_GENERATE(LoadObjectNull, assembler) { 1711 ASSEMBLER_TEST_GENERATE(LoadObjectNull, assembler) {
1710 __ SetupDartSP(kTestStackSpace); 1712 __ SetupDartSP(kTestStackSpace);
1711 EnterTestFrame(assembler); 1713 EnterTestFrame(assembler);
1714 __ Push(THR);
1715 __ mov(THR, R1);
1712 __ LoadObject(R0, Object::null_object()); 1716 __ LoadObject(R0, Object::null_object());
1717 __ Pop(THR);
1713 LeaveTestFrame(assembler); 1718 LeaveTestFrame(assembler);
1714 __ mov(CSP, SP); 1719 __ mov(CSP, SP);
1715 __ ret(); 1720 __ ret();
1716 } 1721 }
1717 1722
1718 1723
1719 ASSEMBLER_TEST_RUN(LoadObjectNull, test) { 1724 ASSEMBLER_TEST_RUN(LoadObjectNull, test) {
1720 EXPECT_EQ(Object::null(), test->InvokeWithCodeAndThread<RawObject*>()); 1725 ASSEMBLER_TEST_RUN_WITH_THREAD(RawObject*, result);
1726 EXPECT_EQ(Object::null(), result);
1721 } 1727 }
1722 1728
1723 1729
1724 ASSEMBLER_TEST_GENERATE(LoadObjectTrue, assembler) { 1730 ASSEMBLER_TEST_GENERATE(LoadObjectTrue, assembler) {
1725 __ SetupDartSP(kTestStackSpace); 1731 __ SetupDartSP(kTestStackSpace);
1726 EnterTestFrame(assembler); 1732 EnterTestFrame(assembler);
1733 __ Push(THR);
1734 __ mov(THR, R1);
1727 __ LoadObject(R0, Bool::True()); 1735 __ LoadObject(R0, Bool::True());
1736 __ Pop(THR);
1728 LeaveTestFrame(assembler); 1737 LeaveTestFrame(assembler);
1729 __ mov(CSP, SP); 1738 __ mov(CSP, SP);
1730 __ ret(); 1739 __ ret();
1731 } 1740 }
1732 1741
1733 1742
1734 ASSEMBLER_TEST_RUN(LoadObjectTrue, test) { 1743 ASSEMBLER_TEST_RUN(LoadObjectTrue, test) {
1735 EXPECT_EQ(Bool::True().raw(), test->InvokeWithCodeAndThread<RawObject*>()); 1744 ASSEMBLER_TEST_RUN_WITH_THREAD(RawObject*, result);
1745 EXPECT_EQ(Bool::True().raw(), result);
1736 } 1746 }
1737 1747
1738 1748
1739 ASSEMBLER_TEST_GENERATE(LoadObjectFalse, assembler) { 1749 ASSEMBLER_TEST_GENERATE(LoadObjectFalse, assembler) {
1740 __ SetupDartSP(kTestStackSpace); 1750 __ SetupDartSP(kTestStackSpace);
1741 EnterTestFrame(assembler); 1751 EnterTestFrame(assembler);
1752 __ Push(THR);
1753 __ mov(THR, R1);
1742 __ LoadObject(R0, Bool::False()); 1754 __ LoadObject(R0, Bool::False());
1755 __ Pop(THR);
1743 LeaveTestFrame(assembler); 1756 LeaveTestFrame(assembler);
1744 __ mov(CSP, SP); 1757 __ mov(CSP, SP);
1745 __ ret(); 1758 __ ret();
1746 } 1759 }
1747 1760
1748 1761
1749 ASSEMBLER_TEST_RUN(LoadObjectFalse, test) { 1762 ASSEMBLER_TEST_RUN(LoadObjectFalse, test) {
1750 EXPECT_EQ(Bool::False().raw(), test->InvokeWithCodeAndThread<RawObject*>()); 1763 ASSEMBLER_TEST_RUN_WITH_THREAD(RawObject*, result);
1764 EXPECT_EQ(Bool::False().raw(), result);
1751 } 1765 }
1752 1766
1753 1767
1754 ASSEMBLER_TEST_GENERATE(CSelTrue, assembler) { 1768 ASSEMBLER_TEST_GENERATE(CSelTrue, assembler) {
1755 __ LoadImmediate(R1, 42); 1769 __ LoadImmediate(R1, 42);
1756 __ LoadImmediate(R2, 1234); 1770 __ LoadImmediate(R2, 1234);
1757 __ CompareRegisters(R1, R2); 1771 __ CompareRegisters(R1, R2);
1758 __ csel(R0, R1, R2, LT); 1772 __ csel(R0, R1, R2, LT);
1759 __ ret(); 1773 __ ret();
1760 } 1774 }
(...skipping 1809 matching lines...) Expand 10 before | Expand all | Expand 10 after
3570 __ Pop(CODE_REG); 3584 __ Pop(CODE_REG);
3571 __ mov(CSP, SP); 3585 __ mov(CSP, SP);
3572 __ ret(); 3586 __ ret();
3573 } 3587 }
3574 3588
3575 3589
3576 ASSEMBLER_TEST_GENERATE(ComputeRange, assembler) { 3590 ASSEMBLER_TEST_GENERATE(ComputeRange, assembler) {
3577 __ SetupDartSP(kTestStackSpace); 3591 __ SetupDartSP(kTestStackSpace);
3578 EnterTestFrame(assembler); 3592 EnterTestFrame(assembler);
3579 Label miss, done; 3593 Label miss, done;
3580 __ ComputeRange(R0, R2, R3, &miss); 3594 __ ComputeRange(R0, R1, R2, &miss);
3581 __ b(&done); 3595 __ b(&done);
3582 3596
3583 __ Bind(&miss); 3597 __ Bind(&miss);
3584 __ LoadImmediate(R0, -1); 3598 __ LoadImmediate(R0, -1);
3585 3599
3586 __ Bind(&done); 3600 __ Bind(&done);
3587 LeaveTestFrame(assembler); 3601 LeaveTestFrame(assembler);
3588 __ mov(CSP, SP); 3602 __ mov(CSP, SP);
3589 __ ret(); 3603 __ ret();
3590 } 3604 }
3591 3605
3592 3606
3593 ASSEMBLER_TEST_RUN(ComputeRange, test) { 3607 ASSEMBLER_TEST_RUN(ComputeRange, test) {
3594 #define RANGE_OF(arg_type, v) \ 3608 #define RANGE_OF(arg_type, v) test->InvokeWithCode<intptr_t, arg_type>(v)
3595 test->InvokeWithCodeAndThread<intptr_t, arg_type>(v)
3596 3609
3597 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(RawSmi*, Smi::New(0))); 3610 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(RawSmi*, Smi::New(0)));
3598 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(RawSmi*, Smi::New(1))); 3611 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(RawSmi*, Smi::New(1)));
3599 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(RawSmi*, Smi::New(kMaxInt32))); 3612 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(RawSmi*, Smi::New(kMaxInt32)));
3600 EXPECT_EQ(ICData::kInt32RangeBit | ICData::kSignedRangeBit, 3613 EXPECT_EQ(ICData::kInt32RangeBit | ICData::kSignedRangeBit,
3601 RANGE_OF(RawSmi*, Smi::New(-1))); 3614 RANGE_OF(RawSmi*, Smi::New(-1)));
3602 EXPECT_EQ(ICData::kInt32RangeBit | ICData::kSignedRangeBit, 3615 EXPECT_EQ(ICData::kInt32RangeBit | ICData::kSignedRangeBit,
3603 RANGE_OF(RawSmi*, Smi::New(kMinInt32))); 3616 RANGE_OF(RawSmi*, Smi::New(kMinInt32)));
3604 3617
3605 EXPECT_EQ(ICData::kUint32RangeBit, 3618 EXPECT_EQ(ICData::kUint32RangeBit,
(...skipping 24 matching lines...) Expand all
3630 3643
3631 EXPECT_EQ(-1, RANGE_OF(RawBool*, Bool::True().raw())); 3644 EXPECT_EQ(-1, RANGE_OF(RawBool*, Bool::True().raw()));
3632 3645
3633 #undef RANGE_OF 3646 #undef RANGE_OF
3634 } 3647 }
3635 3648
3636 3649
3637 } // namespace dart 3650 } // namespace dart
3638 3651
3639 #endif // defined(TARGET_ARCH_ARM64) 3652 #endif // defined(TARGET_ARCH_ARM64)
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/assembler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698