OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/os.h" | 9 #include "vm/os.h" |
10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 static const int64_t kLargeConstant = 0x1234567812345678LL; | 31 static const int64_t kLargeConstant = 0x1234567812345678LL; |
32 EXPECT_EQ(kLargeConstant, id(kLargeConstant)); | 32 EXPECT_EQ(kLargeConstant, id(kLargeConstant)); |
33 } | 33 } |
34 | 34 |
35 | 35 |
36 ASSEMBLER_TEST_GENERATE(AddressingModes, assembler) { | 36 ASSEMBLER_TEST_GENERATE(AddressingModes, assembler) { |
37 __ movq(RAX, Address(RSP, 0)); | 37 __ movq(RAX, Address(RSP, 0)); |
38 __ movq(RAX, Address(RBP, 0)); | 38 __ movq(RAX, Address(RBP, 0)); |
39 __ movq(RAX, Address(RAX, 0)); | 39 __ movq(RAX, Address(RAX, 0)); |
40 __ movq(RAX, Address(R10, 0)); | 40 __ movq(RAX, Address(R10, 0)); |
| 41 __ movq(RAX, Address(R12, 0)); |
| 42 __ movq(RAX, Address(R13, 0)); |
41 __ movq(R10, Address(RAX, 0)); | 43 __ movq(R10, Address(RAX, 0)); |
42 | 44 |
43 __ movq(RAX, Address(RSP, kWordSize)); | 45 __ movq(RAX, Address(RSP, kWordSize)); |
44 __ movq(RAX, Address(RBP, kWordSize)); | 46 __ movq(RAX, Address(RBP, kWordSize)); |
45 __ movq(RAX, Address(RAX, kWordSize)); | 47 __ movq(RAX, Address(RAX, kWordSize)); |
46 __ movq(RAX, Address(R10, kWordSize)); | 48 __ movq(RAX, Address(R10, kWordSize)); |
| 49 __ movq(RAX, Address(R12, kWordSize)); |
| 50 __ movq(RAX, Address(R13, kWordSize)); |
47 | 51 |
48 __ movq(RAX, Address(RSP, -kWordSize)); | 52 __ movq(RAX, Address(RSP, -kWordSize)); |
49 __ movq(RAX, Address(RBP, -kWordSize)); | 53 __ movq(RAX, Address(RBP, -kWordSize)); |
50 __ movq(RAX, Address(RAX, -kWordSize)); | 54 __ movq(RAX, Address(RAX, -kWordSize)); |
51 __ movq(RAX, Address(R10, -kWordSize)); | 55 __ movq(RAX, Address(R10, -kWordSize)); |
| 56 __ movq(RAX, Address(R12, -kWordSize)); |
| 57 __ movq(RAX, Address(R13, -kWordSize)); |
52 | 58 |
53 __ movq(RAX, Address(RSP, 256 * kWordSize)); | 59 __ movq(RAX, Address(RSP, 256 * kWordSize)); |
54 __ movq(RAX, Address(RBP, 256 * kWordSize)); | 60 __ movq(RAX, Address(RBP, 256 * kWordSize)); |
55 __ movq(RAX, Address(RAX, 256 * kWordSize)); | 61 __ movq(RAX, Address(RAX, 256 * kWordSize)); |
56 __ movq(RAX, Address(R10, 256 * kWordSize)); | 62 __ movq(RAX, Address(R10, 256 * kWordSize)); |
| 63 __ movq(RAX, Address(R12, 256 * kWordSize)); |
| 64 __ movq(RAX, Address(R13, 256 * kWordSize)); |
57 | 65 |
58 __ movq(RAX, Address(RSP, -256 * kWordSize)); | 66 __ movq(RAX, Address(RSP, -256 * kWordSize)); |
59 __ movq(RAX, Address(RBP, -256 * kWordSize)); | 67 __ movq(RAX, Address(RBP, -256 * kWordSize)); |
60 __ movq(RAX, Address(RAX, -256 * kWordSize)); | 68 __ movq(RAX, Address(RAX, -256 * kWordSize)); |
61 __ movq(RAX, Address(R10, -256 * kWordSize)); | 69 __ movq(RAX, Address(R10, -256 * kWordSize)); |
| 70 __ movq(RAX, Address(R12, -256 * kWordSize)); |
| 71 __ movq(RAX, Address(R13, -256 * kWordSize)); |
62 | 72 |
63 __ movq(RAX, Address(RAX, TIMES_1)); | 73 __ movq(RAX, Address(RAX, TIMES_1, 0)); |
64 __ movq(RAX, Address(RAX, TIMES_2)); | 74 __ movq(RAX, Address(RAX, TIMES_2, 0)); |
65 __ movq(RAX, Address(RAX, TIMES_4)); | 75 __ movq(RAX, Address(RAX, TIMES_4, 0)); |
66 __ movq(RAX, Address(RAX, TIMES_8)); | 76 __ movq(RAX, Address(RAX, TIMES_8, 0)); |
67 | 77 |
68 __ movq(RAX, Address(RBP, TIMES_2)); | 78 __ movq(RAX, Address(RBP, TIMES_2, 0)); |
69 __ movq(RAX, Address(RAX, TIMES_2)); | 79 __ movq(RAX, Address(RAX, TIMES_2, 0)); |
70 __ movq(RAX, Address(R10, TIMES_2)); | 80 __ movq(RAX, Address(R10, TIMES_2, 0)); |
| 81 __ movq(RAX, Address(R12, TIMES_2, 0)); |
| 82 __ movq(RAX, Address(R13, TIMES_2, 0)); |
71 | 83 |
72 __ movq(RAX, Address(RBP, TIMES_2, kWordSize)); | 84 __ movq(RAX, Address(RBP, TIMES_2, kWordSize)); |
73 __ movq(RAX, Address(RAX, TIMES_2, kWordSize)); | 85 __ movq(RAX, Address(RAX, TIMES_2, kWordSize)); |
74 __ movq(RAX, Address(R10, TIMES_2, kWordSize)); | 86 __ movq(RAX, Address(R10, TIMES_2, kWordSize)); |
| 87 __ movq(RAX, Address(R12, TIMES_2, kWordSize)); |
| 88 __ movq(RAX, Address(R13, TIMES_2, kWordSize)); |
75 | 89 |
76 __ movq(RAX, Address(RBP, TIMES_2, 256 * kWordSize)); | 90 __ movq(RAX, Address(RBP, TIMES_2, 256 * kWordSize)); |
77 __ movq(RAX, Address(RAX, TIMES_2, 256 * kWordSize)); | 91 __ movq(RAX, Address(RAX, TIMES_2, 256 * kWordSize)); |
78 __ movq(RAX, Address(R10, TIMES_2, 256 * kWordSize)); | 92 __ movq(RAX, Address(R10, TIMES_2, 256 * kWordSize)); |
| 93 __ movq(RAX, Address(R12, TIMES_2, 256 * kWordSize)); |
| 94 __ movq(RAX, Address(R13, TIMES_2, 256 * kWordSize)); |
79 | 95 |
80 __ movq(RAX, Address(RAX, RBP, TIMES_2, 0)); | 96 __ movq(RAX, Address(RAX, RBP, TIMES_2, 0)); |
81 __ movq(RAX, Address(RAX, RAX, TIMES_2, 0)); | 97 __ movq(RAX, Address(RAX, RAX, TIMES_2, 0)); |
82 __ movq(RAX, Address(RAX, R10, TIMES_2, 0)); | 98 __ movq(RAX, Address(RAX, R10, TIMES_2, 0)); |
| 99 __ movq(RAX, Address(RAX, R12, TIMES_2, 0)); |
| 100 __ movq(RAX, Address(RAX, R13, TIMES_2, 0)); |
83 | 101 |
84 __ movq(RAX, Address(RBP, RBP, TIMES_2, 0)); | 102 __ movq(RAX, Address(RBP, RBP, TIMES_2, 0)); |
85 __ movq(RAX, Address(RBP, RAX, TIMES_2, 0)); | 103 __ movq(RAX, Address(RBP, RAX, TIMES_2, 0)); |
86 __ movq(RAX, Address(RBP, R10, TIMES_2, 0)); | 104 __ movq(RAX, Address(RBP, R10, TIMES_2, 0)); |
| 105 __ movq(RAX, Address(RBP, R12, TIMES_2, 0)); |
| 106 __ movq(RAX, Address(RBP, R13, TIMES_2, 0)); |
87 | 107 |
88 __ movq(RAX, Address(RSP, RBP, TIMES_2, 0)); | 108 __ movq(RAX, Address(RSP, RBP, TIMES_2, 0)); |
89 __ movq(RAX, Address(RSP, RAX, TIMES_2, 0)); | 109 __ movq(RAX, Address(RSP, RAX, TIMES_2, 0)); |
90 __ movq(RAX, Address(RSP, R10, TIMES_2, 0)); | 110 __ movq(RAX, Address(RSP, R10, TIMES_2, 0)); |
| 111 __ movq(RAX, Address(RSP, R12, TIMES_2, 0)); |
| 112 __ movq(RAX, Address(RSP, R13, TIMES_2, 0)); |
91 | 113 |
92 __ movq(RAX, Address(R10, RBP, TIMES_2, 0)); | 114 __ movq(RAX, Address(R10, RBP, TIMES_2, 0)); |
93 __ movq(RAX, Address(R10, RAX, TIMES_2, 0)); | 115 __ movq(RAX, Address(R10, RAX, TIMES_2, 0)); |
94 __ movq(RAX, Address(R10, R10, TIMES_2, 0)); | 116 __ movq(RAX, Address(R10, R10, TIMES_2, 0)); |
| 117 __ movq(RAX, Address(R10, R12, TIMES_2, 0)); |
| 118 __ movq(RAX, Address(R10, R13, TIMES_2, 0)); |
| 119 |
| 120 __ movq(RAX, Address(R12, RBP, TIMES_2, 0)); |
| 121 __ movq(RAX, Address(R12, RAX, TIMES_2, 0)); |
| 122 __ movq(RAX, Address(R12, R10, TIMES_2, 0)); |
| 123 __ movq(RAX, Address(R12, R12, TIMES_2, 0)); |
| 124 __ movq(RAX, Address(R12, R13, TIMES_2, 0)); |
| 125 |
| 126 __ movq(RAX, Address(R13, RBP, TIMES_2, 0)); |
| 127 __ movq(RAX, Address(R13, RAX, TIMES_2, 0)); |
| 128 __ movq(RAX, Address(R13, R10, TIMES_2, 0)); |
| 129 __ movq(RAX, Address(R13, R12, TIMES_2, 0)); |
| 130 __ movq(RAX, Address(R13, R13, TIMES_2, 0)); |
95 | 131 |
96 __ movq(RAX, Address(RAX, RBP, TIMES_2, kWordSize)); | 132 __ movq(RAX, Address(RAX, RBP, TIMES_2, kWordSize)); |
97 __ movq(RAX, Address(RAX, RAX, TIMES_2, kWordSize)); | 133 __ movq(RAX, Address(RAX, RAX, TIMES_2, kWordSize)); |
98 __ movq(RAX, Address(RAX, R10, TIMES_2, kWordSize)); | 134 __ movq(RAX, Address(RAX, R10, TIMES_2, kWordSize)); |
| 135 __ movq(RAX, Address(RAX, R12, TIMES_2, kWordSize)); |
| 136 __ movq(RAX, Address(RAX, R13, TIMES_2, kWordSize)); |
99 | 137 |
100 __ movq(RAX, Address(RBP, RBP, TIMES_2, kWordSize)); | 138 __ movq(RAX, Address(RBP, RBP, TIMES_2, kWordSize)); |
101 __ movq(RAX, Address(RBP, RAX, TIMES_2, kWordSize)); | 139 __ movq(RAX, Address(RBP, RAX, TIMES_2, kWordSize)); |
102 __ movq(RAX, Address(RBP, R10, TIMES_2, kWordSize)); | 140 __ movq(RAX, Address(RBP, R10, TIMES_2, kWordSize)); |
| 141 __ movq(RAX, Address(RBP, R12, TIMES_2, kWordSize)); |
| 142 __ movq(RAX, Address(RBP, R13, TIMES_2, kWordSize)); |
103 | 143 |
104 __ movq(RAX, Address(RSP, RBP, TIMES_2, kWordSize)); | 144 __ movq(RAX, Address(RSP, RBP, TIMES_2, kWordSize)); |
105 __ movq(RAX, Address(RSP, RAX, TIMES_2, kWordSize)); | 145 __ movq(RAX, Address(RSP, RAX, TIMES_2, kWordSize)); |
106 __ movq(RAX, Address(RSP, R10, TIMES_2, kWordSize)); | 146 __ movq(RAX, Address(RSP, R10, TIMES_2, kWordSize)); |
| 147 __ movq(RAX, Address(RSP, R12, TIMES_2, kWordSize)); |
| 148 __ movq(RAX, Address(RSP, R13, TIMES_2, kWordSize)); |
107 | 149 |
108 __ movq(RAX, Address(R10, RBP, TIMES_2, kWordSize)); | 150 __ movq(RAX, Address(R10, RBP, TIMES_2, kWordSize)); |
109 __ movq(RAX, Address(R10, RAX, TIMES_2, kWordSize)); | 151 __ movq(RAX, Address(R10, RAX, TIMES_2, kWordSize)); |
110 __ movq(RAX, Address(R10, R10, TIMES_2, kWordSize)); | 152 __ movq(RAX, Address(R10, R10, TIMES_2, kWordSize)); |
| 153 __ movq(RAX, Address(R10, R12, TIMES_2, kWordSize)); |
| 154 __ movq(RAX, Address(R10, R13, TIMES_2, kWordSize)); |
| 155 |
| 156 __ movq(RAX, Address(R12, RBP, TIMES_2, kWordSize)); |
| 157 __ movq(RAX, Address(R12, RAX, TIMES_2, kWordSize)); |
| 158 __ movq(RAX, Address(R12, R10, TIMES_2, kWordSize)); |
| 159 __ movq(RAX, Address(R12, R12, TIMES_2, kWordSize)); |
| 160 __ movq(RAX, Address(R12, R13, TIMES_2, kWordSize)); |
| 161 |
| 162 __ movq(RAX, Address(R13, RBP, TIMES_2, kWordSize)); |
| 163 __ movq(RAX, Address(R13, RAX, TIMES_2, kWordSize)); |
| 164 __ movq(RAX, Address(R13, R10, TIMES_2, kWordSize)); |
| 165 __ movq(RAX, Address(R13, R12, TIMES_2, kWordSize)); |
| 166 __ movq(RAX, Address(R13, R13, TIMES_2, kWordSize)); |
111 | 167 |
112 __ movq(RAX, Address(RAX, RBP, TIMES_2, 256 * kWordSize)); | 168 __ movq(RAX, Address(RAX, RBP, TIMES_2, 256 * kWordSize)); |
113 __ movq(RAX, Address(RAX, RAX, TIMES_2, 256 * kWordSize)); | 169 __ movq(RAX, Address(RAX, RAX, TIMES_2, 256 * kWordSize)); |
114 __ movq(RAX, Address(RAX, R10, TIMES_2, 256 * kWordSize)); | 170 __ movq(RAX, Address(RAX, R10, TIMES_2, 256 * kWordSize)); |
| 171 __ movq(RAX, Address(RAX, R12, TIMES_2, 256 * kWordSize)); |
| 172 __ movq(RAX, Address(RAX, R13, TIMES_2, 256 * kWordSize)); |
115 | 173 |
116 __ movq(RAX, Address(RBP, RBP, TIMES_2, 256 * kWordSize)); | 174 __ movq(RAX, Address(RBP, RBP, TIMES_2, 256 * kWordSize)); |
117 __ movq(RAX, Address(RBP, RAX, TIMES_2, 256 * kWordSize)); | 175 __ movq(RAX, Address(RBP, RAX, TIMES_2, 256 * kWordSize)); |
118 __ movq(RAX, Address(RBP, R10, TIMES_2, 256 * kWordSize)); | 176 __ movq(RAX, Address(RBP, R10, TIMES_2, 256 * kWordSize)); |
| 177 __ movq(RAX, Address(RBP, R12, TIMES_2, 256 * kWordSize)); |
| 178 __ movq(RAX, Address(RBP, R13, TIMES_2, 256 * kWordSize)); |
119 | 179 |
120 __ movq(RAX, Address(RSP, RBP, TIMES_2, 256 * kWordSize)); | 180 __ movq(RAX, Address(RSP, RBP, TIMES_2, 256 * kWordSize)); |
121 __ movq(RAX, Address(RSP, RAX, TIMES_2, 256 * kWordSize)); | 181 __ movq(RAX, Address(RSP, RAX, TIMES_2, 256 * kWordSize)); |
122 __ movq(RAX, Address(RSP, R10, TIMES_2, 256 * kWordSize)); | 182 __ movq(RAX, Address(RSP, R10, TIMES_2, 256 * kWordSize)); |
| 183 __ movq(RAX, Address(RSP, R12, TIMES_2, 256 * kWordSize)); |
| 184 __ movq(RAX, Address(RSP, R13, TIMES_2, 256 * kWordSize)); |
123 | 185 |
124 __ movq(RAX, Address(R10, RBP, TIMES_2, 256 * kWordSize)); | 186 __ movq(RAX, Address(R10, RBP, TIMES_2, 256 * kWordSize)); |
125 __ movq(RAX, Address(R10, RAX, TIMES_2, 256 * kWordSize)); | 187 __ movq(RAX, Address(R10, RAX, TIMES_2, 256 * kWordSize)); |
126 __ movq(RAX, Address(R10, R10, TIMES_2, 256 * kWordSize)); | 188 __ movq(RAX, Address(R10, R10, TIMES_2, 256 * kWordSize)); |
| 189 __ movq(RAX, Address(R10, R12, TIMES_2, 256 * kWordSize)); |
| 190 __ movq(RAX, Address(R10, R13, TIMES_2, 256 * kWordSize)); |
| 191 |
| 192 __ movq(RAX, Address(R12, RBP, TIMES_2, 256 * kWordSize)); |
| 193 __ movq(RAX, Address(R12, RAX, TIMES_2, 256 * kWordSize)); |
| 194 __ movq(RAX, Address(R12, R10, TIMES_2, 256 * kWordSize)); |
| 195 __ movq(RAX, Address(R12, R12, TIMES_2, 256 * kWordSize)); |
| 196 __ movq(RAX, Address(R12, R13, TIMES_2, 256 * kWordSize)); |
| 197 |
| 198 __ movq(RAX, Address(R13, RBP, TIMES_2, 256 * kWordSize)); |
| 199 __ movq(RAX, Address(R13, RAX, TIMES_2, 256 * kWordSize)); |
| 200 __ movq(RAX, Address(R13, R10, TIMES_2, 256 * kWordSize)); |
| 201 __ movq(RAX, Address(R13, R12, TIMES_2, 256 * kWordSize)); |
| 202 __ movq(RAX, Address(R13, R13, TIMES_2, 256 * kWordSize)); |
127 } | 203 } |
128 | 204 |
129 | 205 |
130 ASSEMBLER_TEST_RUN(AddressingModes, entry) { | 206 ASSEMBLER_TEST_RUN(AddressingModes, entry) { |
131 // Avoid running the code since it is constructed to lead to crashes. | 207 // Avoid running the code since it is constructed to lead to crashes. |
132 } | 208 } |
133 | 209 |
134 | 210 |
135 ASSEMBLER_TEST_GENERATE(JumpAroundCrash, assembler) { | 211 ASSEMBLER_TEST_GENERATE(JumpAroundCrash, assembler) { |
136 Label done; | 212 Label done; |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 | 1109 |
1034 ASSEMBLER_TEST_RUN(TestObjectCompare, entry) { | 1110 ASSEMBLER_TEST_RUN(TestObjectCompare, entry) { |
1035 typedef bool (*TestObjectCompare)(); | 1111 typedef bool (*TestObjectCompare)(); |
1036 bool res = reinterpret_cast<TestObjectCompare>(entry)(); | 1112 bool res = reinterpret_cast<TestObjectCompare>(entry)(); |
1037 EXPECT_EQ(true, res); | 1113 EXPECT_EQ(true, res); |
1038 } | 1114 } |
1039 | 1115 |
1040 } // namespace dart | 1116 } // namespace dart |
1041 | 1117 |
1042 #endif // defined TARGET_ARCH_X64 | 1118 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |