Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: runtime/vm/assembler_arm_test.cc

Issue 616223005: Adds back arm ldrex strex. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/assembler_arm.cc ('k') | runtime/vm/simulator_arm.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 } 659 }
660 660
661 661
662 ASSEMBLER_TEST_RUN(LoadStore, test) { 662 ASSEMBLER_TEST_RUN(LoadStore, test) {
663 EXPECT(test != NULL); 663 EXPECT(test != NULL);
664 typedef int (*LoadStore)() DART_UNUSED; 664 typedef int (*LoadStore)() DART_UNUSED;
665 EXPECT_EQ(123, EXECUTE_TEST_CODE_INT32(LoadStore, test->entry())); 665 EXPECT_EQ(123, EXECUTE_TEST_CODE_INT32(LoadStore, test->entry()));
666 } 666 }
667 667
668 668
669 ASSEMBLER_TEST_GENERATE(Semaphore, assembler) {
670 if (TargetCPUFeatures::arm_version() == ARMv5TE) {
671 __ mov(R0, Operand(42));
672 __ bx(LR);
673 } else {
674 __ mov(R0, Operand(40));
675 __ mov(R1, Operand(42));
676 __ Push(R0);
677 Label retry;
678 __ Bind(&retry);
679 __ ldrex(R0, SP);
680 __ strex(IP, R1, SP); // IP == 0, success
681 __ tst(IP, Operand(0));
682 __ b(&retry, NE); // NE if context switch occurred between ldrex and strex.
683 __ Pop(R0); // 42
684 __ bx(LR);
685 }
686 }
687
688
689 ASSEMBLER_TEST_RUN(Semaphore, test) {
690 EXPECT(test != NULL);
691 typedef int (*Semaphore)();
692 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Semaphore, test->entry()));
693 }
694
695
696 ASSEMBLER_TEST_GENERATE(FailedSemaphore, assembler) {
697 if (TargetCPUFeatures::arm_version() == ARMv5TE) {
698 __ mov(R0, Operand(41));
699 __ bx(LR);
700 } else {
701 __ mov(R0, Operand(40));
702 __ mov(R1, Operand(42));
703 __ Push(R0);
704 __ ldrex(R0, SP);
705 __ clrex(); // Simulate a context switch.
706 __ strex(IP, R1, SP); // IP == 1, failure
707 __ Pop(R0); // 40
708 __ add(R0, R0, Operand(IP));
709 __ bx(LR);
710 }
711 }
712
713
714 ASSEMBLER_TEST_RUN(FailedSemaphore, test) {
715 EXPECT(test != NULL);
716 typedef int (*FailedSemaphore)();
717 EXPECT_EQ(41, EXECUTE_TEST_CODE_INT32(FailedSemaphore, test->entry()));
718 }
719
720
669 ASSEMBLER_TEST_GENERATE(AddSub, assembler) { 721 ASSEMBLER_TEST_GENERATE(AddSub, assembler) {
670 __ mov(R1, Operand(40)); 722 __ mov(R1, Operand(40));
671 __ sub(R1, R1, Operand(2)); 723 __ sub(R1, R1, Operand(2));
672 __ add(R0, R1, Operand(4)); 724 __ add(R0, R1, Operand(4));
673 __ rsbs(R0, R0, Operand(100)); 725 __ rsbs(R0, R0, Operand(100));
674 __ rsc(R0, R0, Operand(100)); 726 __ rsc(R0, R0, Operand(100));
675 __ bx(LR); 727 __ bx(LR);
676 } 728 }
677 729
678 730
(...skipping 3397 matching lines...) Expand 10 before | Expand all | Expand 10 after
4076 __ StoreIntoObject(R2, 4128 __ StoreIntoObject(R2,
4077 FieldAddress(R2, GrowableObjectArray::data_offset()), 4129 FieldAddress(R2, GrowableObjectArray::data_offset()),
4078 R1); 4130 R1);
4079 __ PopList((1 << CTX) | (1 << LR)); 4131 __ PopList((1 << CTX) | (1 << LR));
4080 __ Ret(); 4132 __ Ret();
4081 } 4133 }
4082 4134
4083 } // namespace dart 4135 } // namespace dart
4084 4136
4085 #endif // defined TARGET_ARCH_ARM 4137 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/assembler_arm.cc ('k') | runtime/vm/simulator_arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698