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" // Needed here to get TARGET_ARCH_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/intrinsifier.h" | 8 #include "vm/intrinsifier.h" |
9 | 9 |
10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 // Check for overflow by shifting left and shifting back arithmetically. | 862 // Check for overflow by shifting left and shifting back arithmetically. |
863 // If the result is different from the original, there was overflow. | 863 // If the result is different from the original, there was overflow. |
864 __ mov(IP, ShifterOperand(R1, LSL, R0)); | 864 __ mov(IP, ShifterOperand(R1, LSL, R0)); |
865 __ cmp(R1, ShifterOperand(IP, ASR, R0)); | 865 __ cmp(R1, ShifterOperand(IP, ASR, R0)); |
866 | 866 |
867 // No overflow, result in R0. | 867 // No overflow, result in R0. |
868 __ mov(R0, ShifterOperand(R1, LSL, R0), EQ); | 868 __ mov(R0, ShifterOperand(R1, LSL, R0), EQ); |
869 __ bx(LR, EQ); | 869 __ bx(LR, EQ); |
870 | 870 |
871 // Arguments are Smi but the shift produced an overflow to Mint. | 871 // Arguments are Smi but the shift produced an overflow to Mint. |
872 __ CompareImmediate(R6, 0); | 872 __ CompareImmediate(R1, 0); |
873 __ b(&fall_through, LT); | 873 __ b(&fall_through, LT); |
874 __ SmiUntag(R6); | 874 __ SmiUntag(R1); |
875 | 875 |
876 // Pull off high bits that will be shifted off of R6 by making a mask | 876 // Pull off high bits that will be shifted off of R1 by making a mask |
877 // ((1 << R0) - 1), shifting it to the left, masking R6, then shifting back. | 877 // ((1 << R0) - 1), shifting it to the left, masking R1, then shifting back. |
878 // high bits = (((1 << R0) - 1) << (32 - R0)) & R6) >> (32 - R0) | 878 // high bits = (((1 << R0) - 1) << (32 - R0)) & R1) >> (32 - R0) |
879 // lo bits = R6 << R0 | 879 // lo bits = R1 << R0 |
880 __ LoadImmediate(R7, 1); | 880 __ LoadImmediate(R7, 1); |
881 __ mov(R7, ShifterOperand(R7, LSL, R0)); // R7 <- 1 << R0 | 881 __ mov(R7, ShifterOperand(R7, LSL, R0)); // R7 <- 1 << R0 |
882 __ sub(R7, R7, ShifterOperand(1)); // R7 <- R7 - 1 | 882 __ sub(R7, R7, ShifterOperand(1)); // R7 <- R7 - 1 |
883 __ rsb(R8, R0, ShifterOperand(32)); // R8 <- 32 - R0 | 883 __ rsb(R8, R0, ShifterOperand(32)); // R8 <- 32 - R0 |
884 __ mov(R7, ShifterOperand(R7, LSL, R8)); // R7 <- R7 << R8 | 884 __ mov(R7, ShifterOperand(R7, LSL, R8)); // R7 <- R7 << R8 |
885 __ and_(R7, R6, ShifterOperand(R7)); // R7 <- R7 & R6 | 885 __ and_(R7, R1, ShifterOperand(R7)); // R7 <- R7 & R1 |
886 __ mov(R7, ShifterOperand(R7, LSR, R8)); // R7 <- R7 >> R8 | 886 __ mov(R7, ShifterOperand(R7, LSR, R8)); // R7 <- R7 >> R8 |
887 // Now R7 has the bits that fall off of R6 on a left shift. | 887 // Now R7 has the bits that fall off of R1 on a left shift. |
888 __ mov(R1, ShifterOperand(R6, LSL, R0)); // R1 gets the low bits. | 888 __ mov(R1, ShifterOperand(R1, LSL, R0)); // R1 gets the low bits. |
889 | 889 |
890 const Class& mint_class = Class::Handle( | 890 const Class& mint_class = Class::Handle( |
891 Isolate::Current()->object_store()->mint_class()); | 891 Isolate::Current()->object_store()->mint_class()); |
892 __ TryAllocate(mint_class, &fall_through, R0); | 892 __ TryAllocate(mint_class, &fall_through, R0); |
893 | 893 |
894 | 894 |
895 __ str(R1, FieldAddress(R0, Mint::value_offset())); | 895 __ str(R1, FieldAddress(R0, Mint::value_offset())); |
896 __ str(R7, FieldAddress(R0, Mint::value_offset() + kWordSize)); | 896 __ str(R7, FieldAddress(R0, Mint::value_offset() + kWordSize)); |
897 __ Ret(); | 897 __ Ret(); |
898 __ Bind(&fall_through); | 898 __ Bind(&fall_through); |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1687 __ Bind(&ok); | 1687 __ Bind(&ok); |
1688 __ Ret(); | 1688 __ Ret(); |
1689 | 1689 |
1690 __ Bind(&fall_through); | 1690 __ Bind(&fall_through); |
1691 return false; | 1691 return false; |
1692 } | 1692 } |
1693 | 1693 |
1694 } // namespace dart | 1694 } // namespace dart |
1695 | 1695 |
1696 #endif // defined TARGET_ARCH_ARM | 1696 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |