| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 __ ret(); | 271 __ ret(); |
| 272 } | 272 } |
| 273 | 273 |
| 274 | 274 |
| 275 ASSEMBLER_TEST_RUN(SimpleLoop, test) { | 275 ASSEMBLER_TEST_RUN(SimpleLoop, test) { |
| 276 typedef int (*SimpleLoopCode)(); | 276 typedef int (*SimpleLoopCode)(); |
| 277 EXPECT_EQ(2 * 87, reinterpret_cast<SimpleLoopCode>(test->entry())()); | 277 EXPECT_EQ(2 * 87, reinterpret_cast<SimpleLoopCode>(test->entry())()); |
| 278 } | 278 } |
| 279 | 279 |
| 280 | 280 |
| 281 ASSEMBLER_TEST_GENERATE(Cmpb, assembler) { |
| 282 Label done; |
| 283 __ movq(RAX, Immediate(1)); |
| 284 __ pushq(Immediate(0xffffff11)); |
| 285 __ cmpb(Address(RSP, 0), Immediate(0x11)); |
| 286 __ j(EQUAL, &done, Assembler::kNearJump); |
| 287 __ movq(RAX, Immediate(0)); |
| 288 __ Bind(&done); |
| 289 __ popq(RCX); |
| 290 __ ret(); |
| 291 } |
| 292 |
| 293 |
| 294 ASSEMBLER_TEST_RUN(Cmpb, test) { |
| 295 typedef int (*CmpbCode)(); |
| 296 EXPECT_EQ(1, reinterpret_cast<CmpbCode>(test->entry())()); |
| 297 } |
| 298 |
| 299 |
| 281 ASSEMBLER_TEST_GENERATE(Increment, assembler) { | 300 ASSEMBLER_TEST_GENERATE(Increment, assembler) { |
| 282 __ movq(RAX, Immediate(0)); | 301 __ movq(RAX, Immediate(0)); |
| 283 __ pushq(RAX); | 302 __ pushq(RAX); |
| 284 __ incl(Address(RSP, 0)); | 303 __ incl(Address(RSP, 0)); |
| 285 __ incq(Address(RSP, 0)); | 304 __ incq(Address(RSP, 0)); |
| 286 __ movq(RCX, Address(RSP, 0)); | 305 __ movq(RCX, Address(RSP, 0)); |
| 287 __ incq(RCX); | 306 __ incq(RCX); |
| 288 __ popq(RAX); | 307 __ popq(RAX); |
| 289 __ movq(RAX, RCX); | 308 __ movq(RAX, RCX); |
| 290 __ ret(); | 309 __ ret(); |
| (...skipping 2714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3005 int res = reinterpret_cast<ConditionalMovesNoOverflowCode>( | 3024 int res = reinterpret_cast<ConditionalMovesNoOverflowCode>( |
| 3006 test->entry())(0x7fffffffffffffff, 2); | 3025 test->entry())(0x7fffffffffffffff, 2); |
| 3007 EXPECT_EQ(1, res); | 3026 EXPECT_EQ(1, res); |
| 3008 res = reinterpret_cast<ConditionalMovesNoOverflowCode>(test->entry())(1, 1); | 3027 res = reinterpret_cast<ConditionalMovesNoOverflowCode>(test->entry())(1, 1); |
| 3009 EXPECT_EQ(0, res); | 3028 EXPECT_EQ(0, res); |
| 3010 } | 3029 } |
| 3011 | 3030 |
| 3012 } // namespace dart | 3031 } // namespace dart |
| 3013 | 3032 |
| 3014 #endif // defined TARGET_ARCH_X64 | 3033 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |