| 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 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 __ ret(); | 1204 __ ret(); |
| 1205 } | 1205 } |
| 1206 | 1206 |
| 1207 | 1207 |
| 1208 ASSEMBLER_TEST_RUN(TestAlignLarge, entry) { | 1208 ASSEMBLER_TEST_RUN(TestAlignLarge, entry) { |
| 1209 typedef int (*TestAlignLarge)(); | 1209 typedef int (*TestAlignLarge)(); |
| 1210 int res = reinterpret_cast<TestAlignLarge>(entry)(); | 1210 int res = reinterpret_cast<TestAlignLarge>(entry)(); |
| 1211 EXPECT_EQ(16, res); // 16 bytes emitted. | 1211 EXPECT_EQ(16, res); // 16 bytes emitted. |
| 1212 } | 1212 } |
| 1213 | 1213 |
| 1214 |
| 1215 ASSEMBLER_TEST_GENERATE(TestAdds, assembler) { |
| 1216 __ movq(RAX, Immediate(4)); |
| 1217 __ pushq(RAX); |
| 1218 __ addq(Address(RSP, 0), Immediate(5)); |
| 1219 // TOS: 9 |
| 1220 __ addq(Address(RSP, 0), Immediate(-2)); |
| 1221 // TOS: 7 |
| 1222 __ movq(RCX, Immediate(3)); |
| 1223 __ addq(Address(RSP, 0), RCX); |
| 1224 // TOS: 10 |
| 1225 __ popq(RAX); |
| 1226 __ ret(); |
| 1227 } |
| 1228 |
| 1229 |
| 1230 ASSEMBLER_TEST_RUN(TestAdds, entry) { |
| 1231 typedef int (*TestAdds)(); |
| 1232 int res = reinterpret_cast<TestAdds>(entry)(); |
| 1233 EXPECT_EQ(10, res); |
| 1234 } |
| 1235 |
| 1236 |
| 1214 } // namespace dart | 1237 } // namespace dart |
| 1215 | 1238 |
| 1216 #endif // defined TARGET_ARCH_X64 | 1239 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |