| OLD | NEW |
| 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_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 } | 471 } |
| 472 | 472 |
| 473 | 473 |
| 474 ASSEMBLER_TEST_RUN(ForwardBranch, test) { | 474 ASSEMBLER_TEST_RUN(ForwardBranch, test) { |
| 475 EXPECT(test != NULL); | 475 EXPECT(test != NULL); |
| 476 typedef int (*ForwardBranch)(); | 476 typedef int (*ForwardBranch)(); |
| 477 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(ForwardBranch, test->entry())); | 477 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(ForwardBranch, test->entry())); |
| 478 } | 478 } |
| 479 | 479 |
| 480 | 480 |
| 481 ASSEMBLER_TEST_GENERATE(Loop2, assembler) { |
| 482 Label loop_entry; |
| 483 __ set_use_far_branches(true); |
| 484 __ mov(R0, ShifterOperand(1)); |
| 485 __ mov(R1, ShifterOperand(2)); |
| 486 __ Bind(&loop_entry); |
| 487 __ mov(R0, ShifterOperand(R0, LSL, 1)); |
| 488 __ movs(R1, ShifterOperand(R1, LSR, 1)); |
| 489 __ b(&loop_entry, NE); |
| 490 __ bx(LR); |
| 491 } |
| 492 |
| 493 |
| 494 ASSEMBLER_TEST_RUN(Loop2, test) { |
| 495 EXPECT(test != NULL); |
| 496 typedef int (*Loop)(); |
| 497 EXPECT_EQ(4, EXECUTE_TEST_CODE_INT32(Loop, test->entry())); |
| 498 } |
| 499 |
| 500 |
| 501 ASSEMBLER_TEST_GENERATE(Loop3, assembler) { |
| 502 Label loop_entry; |
| 503 __ set_use_far_branches(true); |
| 504 __ mov(R0, ShifterOperand(1)); |
| 505 __ mov(R1, ShifterOperand(2)); |
| 506 __ Bind(&loop_entry); |
| 507 for (int i = 0; i < (1 << 22); i++) { |
| 508 __ nop(); |
| 509 } |
| 510 __ mov(R0, ShifterOperand(R0, LSL, 1)); |
| 511 __ movs(R1, ShifterOperand(R1, LSR, 1)); |
| 512 __ b(&loop_entry, NE); |
| 513 __ bx(LR); |
| 514 } |
| 515 |
| 516 |
| 517 ASSEMBLER_TEST_RUN(Loop3, test) { |
| 518 EXPECT(test != NULL); |
| 519 typedef int (*Loop)(); |
| 520 EXPECT_EQ(4, EXECUTE_TEST_CODE_INT32(Loop, test->entry())); |
| 521 } |
| 522 |
| 523 |
| 481 ASSEMBLER_TEST_GENERATE(LoadStore, assembler) { | 524 ASSEMBLER_TEST_GENERATE(LoadStore, assembler) { |
| 482 __ mov(R1, ShifterOperand(123)); | 525 __ mov(R1, ShifterOperand(123)); |
| 483 __ Push(R1); | 526 __ Push(R1); |
| 484 __ Pop(R0); | 527 __ Pop(R0); |
| 485 __ bx(LR); | 528 __ bx(LR); |
| 486 } | 529 } |
| 487 | 530 |
| 488 | 531 |
| 489 ASSEMBLER_TEST_RUN(LoadStore, test) { | 532 ASSEMBLER_TEST_RUN(LoadStore, test) { |
| 490 EXPECT(test != NULL); | 533 EXPECT(test != NULL); |
| (...skipping 3049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3540 __ StoreIntoObject(R2, | 3583 __ StoreIntoObject(R2, |
| 3541 FieldAddress(R2, GrowableObjectArray::data_offset()), | 3584 FieldAddress(R2, GrowableObjectArray::data_offset()), |
| 3542 R1); | 3585 R1); |
| 3543 __ PopList((1 << CTX) | (1 << LR)); | 3586 __ PopList((1 << CTX) | (1 << LR)); |
| 3544 __ Ret(); | 3587 __ Ret(); |
| 3545 } | 3588 } |
| 3546 | 3589 |
| 3547 } // namespace dart | 3590 } // namespace dart |
| 3548 | 3591 |
| 3549 #endif // defined TARGET_ARCH_ARM | 3592 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |