| 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/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/os.h" | 10 #include "vm/os.h" |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 __ tst(IP, Operand(0)); | 681 __ tst(IP, Operand(0)); |
| 682 __ b(&retry, NE); // NE if context switch occurred between ldrex and strex. | 682 __ b(&retry, NE); // NE if context switch occurred between ldrex and strex. |
| 683 __ Pop(R0); // 42 | 683 __ Pop(R0); // 42 |
| 684 __ bx(LR); | 684 __ bx(LR); |
| 685 } | 685 } |
| 686 } | 686 } |
| 687 | 687 |
| 688 | 688 |
| 689 ASSEMBLER_TEST_RUN(Semaphore, test) { | 689 ASSEMBLER_TEST_RUN(Semaphore, test) { |
| 690 EXPECT(test != NULL); | 690 EXPECT(test != NULL); |
| 691 typedef int (*Semaphore)(); | 691 typedef int (*Semaphore)() DART_UNUSED; |
| 692 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Semaphore, test->entry())); | 692 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Semaphore, test->entry())); |
| 693 } | 693 } |
| 694 | 694 |
| 695 | 695 |
| 696 ASSEMBLER_TEST_GENERATE(FailedSemaphore, assembler) { | 696 ASSEMBLER_TEST_GENERATE(FailedSemaphore, assembler) { |
| 697 if (TargetCPUFeatures::arm_version() == ARMv5TE) { | 697 if (TargetCPUFeatures::arm_version() == ARMv5TE) { |
| 698 __ mov(R0, Operand(41)); | 698 __ mov(R0, Operand(41)); |
| 699 __ bx(LR); | 699 __ bx(LR); |
| 700 } else { | 700 } else { |
| 701 __ mov(R0, Operand(40)); | 701 __ mov(R0, Operand(40)); |
| 702 __ mov(R1, Operand(42)); | 702 __ mov(R1, Operand(42)); |
| 703 __ Push(R0); | 703 __ Push(R0); |
| 704 __ ldrex(R0, SP); | 704 __ ldrex(R0, SP); |
| 705 __ clrex(); // Simulate a context switch. | 705 __ clrex(); // Simulate a context switch. |
| 706 __ strex(IP, R1, SP); // IP == 1, failure | 706 __ strex(IP, R1, SP); // IP == 1, failure |
| 707 __ Pop(R0); // 40 | 707 __ Pop(R0); // 40 |
| 708 __ add(R0, R0, Operand(IP)); | 708 __ add(R0, R0, Operand(IP)); |
| 709 __ bx(LR); | 709 __ bx(LR); |
| 710 } | 710 } |
| 711 } | 711 } |
| 712 | 712 |
| 713 | 713 |
| 714 ASSEMBLER_TEST_RUN(FailedSemaphore, test) { | 714 ASSEMBLER_TEST_RUN(FailedSemaphore, test) { |
| 715 EXPECT(test != NULL); | 715 EXPECT(test != NULL); |
| 716 typedef int (*FailedSemaphore)(); | 716 typedef int (*FailedSemaphore)() DART_UNUSED; |
| 717 EXPECT_EQ(41, EXECUTE_TEST_CODE_INT32(FailedSemaphore, test->entry())); | 717 EXPECT_EQ(41, EXECUTE_TEST_CODE_INT32(FailedSemaphore, test->entry())); |
| 718 } | 718 } |
| 719 | 719 |
| 720 | 720 |
| 721 ASSEMBLER_TEST_GENERATE(AddSub, assembler) { | 721 ASSEMBLER_TEST_GENERATE(AddSub, assembler) { |
| 722 __ mov(R1, Operand(40)); | 722 __ mov(R1, Operand(40)); |
| 723 __ sub(R1, R1, Operand(2)); | 723 __ sub(R1, R1, Operand(2)); |
| 724 __ add(R0, R1, Operand(4)); | 724 __ add(R0, R1, Operand(4)); |
| 725 __ rsbs(R0, R0, Operand(100)); | 725 __ rsbs(R0, R0, Operand(100)); |
| 726 __ rsc(R0, R0, Operand(100)); | 726 __ rsc(R0, R0, Operand(100)); |
| (...skipping 3401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4128 __ StoreIntoObject(R2, | 4128 __ StoreIntoObject(R2, |
| 4129 FieldAddress(R2, GrowableObjectArray::data_offset()), | 4129 FieldAddress(R2, GrowableObjectArray::data_offset()), |
| 4130 R1); | 4130 R1); |
| 4131 __ PopList((1 << CTX) | (1 << LR)); | 4131 __ PopList((1 << CTX) | (1 << LR)); |
| 4132 __ Ret(); | 4132 __ Ret(); |
| 4133 } | 4133 } |
| 4134 | 4134 |
| 4135 } // namespace dart | 4135 } // namespace dart |
| 4136 | 4136 |
| 4137 #endif // defined TARGET_ARCH_ARM | 4137 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |