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

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

Issue 1225933002: Remove fixed contant pool entries by caching some global constants in Thread (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: added helper methods to Thread Created 5 years, 5 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
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 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after
1686 } 1686 }
1687 1687
1688 1688
1689 ASSEMBLER_TEST_RUN(LoadImmediatePPLarge, test) { 1689 ASSEMBLER_TEST_RUN(LoadImmediatePPLarge, test) {
1690 typedef int64_t (*Int64Return)() DART_UNUSED; 1690 typedef int64_t (*Int64Return)() DART_UNUSED;
1691 EXPECT_EQ(static_cast<int64_t>(0x9287436598237465), 1691 EXPECT_EQ(static_cast<int64_t>(0x9287436598237465),
1692 EXECUTE_TEST_CODE_INT64(Int64Return, test->entry())); 1692 EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
1693 } 1693 }
1694 1694
1695 1695
1696 #if defined(USING_SIMULATOR)
1697 #define ASSEMBLER_TEST_RUN_WITH_THREAD(var_name) \
1698 Thread* thread = Thread::Current(); \
1699 int64_t var_name = Simulator::Current()->Call( \
1700 bit_cast<intptr_t, uword>(test->entry()), \
1701 reinterpret_cast<intptr_t>(thread), 0, 0, 0)
1702 #else
1703 #define ASSEMBER_TEST_RUN_WITH_THREAD(var_name) \
1704 typedef int64_t (*Int64Return)(Thread* thread); \
1705 Int64Return test_code = reinterpret_cast<Int64Return>(test->entry()); \
1706 int64_t var_name = test_code(thread)
1707 #endif
1708
1709
1696 // LoadObject null. 1710 // LoadObject null.
1697 ASSEMBLER_TEST_GENERATE(LoadObjectNull, assembler) { 1711 ASSEMBLER_TEST_GENERATE(LoadObjectNull, assembler) {
1698 __ SetupDartSP(kTestStackSpace); 1712 __ SetupDartSP(kTestStackSpace);
1713 __ Push(THR);
1714 __ mov(THR, R0);
1699 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here. 1715 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here.
1700 __ LoadPoolPointer(PP); 1716 __ LoadPoolPointer(PP);
1701 __ LoadObject(R0, Object::null_object(), PP); 1717 __ LoadObject(R0, Object::null_object(), PP);
1702 __ PopAndUntagPP(); 1718 __ PopAndUntagPP();
1719 __ Pop(THR);
1703 __ mov(CSP, SP); 1720 __ mov(CSP, SP);
1704 __ ret(); 1721 __ ret();
1705 } 1722 }
1706 1723
1707 1724
1708 ASSEMBLER_TEST_RUN(LoadObjectNull, test) { 1725 ASSEMBLER_TEST_RUN(LoadObjectNull, test) {
1709 typedef int64_t (*Int64Return)() DART_UNUSED; 1726 ASSEMBLER_TEST_RUN_WITH_THREAD(result);
1710 EXPECT_EQ(reinterpret_cast<int64_t>(Object::null()), 1727 EXPECT_EQ(reinterpret_cast<int64_t>(Object::null()), result);
1711 EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
1712 } 1728 }
1713 1729
1714 1730
1715 ASSEMBLER_TEST_GENERATE(LoadObjectTrue, assembler) { 1731 ASSEMBLER_TEST_GENERATE(LoadObjectTrue, assembler) {
1716 __ SetupDartSP(kTestStackSpace); 1732 __ SetupDartSP(kTestStackSpace);
1733 __ Push(THR);
1734 __ mov(THR, R0);
1717 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here. 1735 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here.
1718 __ LoadPoolPointer(PP); 1736 __ LoadPoolPointer(PP);
1719 __ LoadObject(R0, Bool::True(), PP); 1737 __ LoadObject(R0, Bool::True(), PP);
1720 __ PopAndUntagPP(); 1738 __ PopAndUntagPP();
1739 __ Pop(THR);
1721 __ mov(CSP, SP); 1740 __ mov(CSP, SP);
1722 __ ret(); 1741 __ ret();
1723 } 1742 }
1724 1743
1725 1744
1726 ASSEMBLER_TEST_RUN(LoadObjectTrue, test) { 1745 ASSEMBLER_TEST_RUN(LoadObjectTrue, test) {
1727 typedef int64_t (*Int64Return)() DART_UNUSED; 1746 ASSEMBLER_TEST_RUN_WITH_THREAD(result);
1728 EXPECT_EQ(reinterpret_cast<int64_t>(Bool::True().raw()), 1747 EXPECT_EQ(reinterpret_cast<int64_t>(Bool::True().raw()), result);
1729 EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
1730 } 1748 }
1731 1749
1732 1750
1733 ASSEMBLER_TEST_GENERATE(LoadObjectFalse, assembler) { 1751 ASSEMBLER_TEST_GENERATE(LoadObjectFalse, assembler) {
1734 __ SetupDartSP(kTestStackSpace); 1752 __ SetupDartSP(kTestStackSpace);
1753 __ Push(THR);
1754 __ mov(THR, R0);
1735 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here. 1755 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here.
1736 __ LoadPoolPointer(PP); 1756 __ LoadPoolPointer(PP);
1737 __ LoadObject(R0, Bool::False(), PP); 1757 __ LoadObject(R0, Bool::False(), PP);
1738 __ PopAndUntagPP(); 1758 __ PopAndUntagPP();
1759 __ Pop(THR);
1739 __ mov(CSP, SP); 1760 __ mov(CSP, SP);
1740 __ ret(); 1761 __ ret();
1741 } 1762 }
1742 1763
1743 1764
1744 ASSEMBLER_TEST_RUN(LoadObjectFalse, test) { 1765 ASSEMBLER_TEST_RUN(LoadObjectFalse, test) {
1745 typedef int64_t (*Int64Return)() DART_UNUSED; 1766 ASSEMBLER_TEST_RUN_WITH_THREAD(result);
1746 EXPECT_EQ(reinterpret_cast<int64_t>(Bool::False().raw()), 1767 EXPECT_EQ(reinterpret_cast<int64_t>(Bool::False().raw()), result);
1747 EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
1748 } 1768 }
1749 1769
1750 1770
1751 ASSEMBLER_TEST_GENERATE(CSelTrue, assembler) { 1771 ASSEMBLER_TEST_GENERATE(CSelTrue, assembler) {
1752 __ LoadImmediate(R1, 42, kNoRegister); 1772 __ LoadImmediate(R1, 42, kNoRegister);
1753 __ LoadImmediate(R2, 1234, kNoRegister); 1773 __ LoadImmediate(R2, 1234, kNoRegister);
1754 __ CompareRegisters(R1, R2); 1774 __ CompareRegisters(R1, R2);
1755 __ csel(R0, R1, R2, LT); 1775 __ csel(R0, R1, R2, LT);
1756 __ ret(); 1776 __ ret();
1757 } 1777 }
(...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after
3631 3651
3632 EXPECT_EQ(-1, RANGE_OF(Bool::True().raw())); 3652 EXPECT_EQ(-1, RANGE_OF(Bool::True().raw()));
3633 3653
3634 #undef RANGE_OF 3654 #undef RANGE_OF
3635 } 3655 }
3636 3656
3637 3657
3638 } // namespace dart 3658 } // namespace dart
3639 3659
3640 #endif // defined(TARGET_ARCH_ARM64) 3660 #endif // defined(TARGET_ARCH_ARM64)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698