Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <limits.h> | 5 #include <limits.h> |
| 6 #include <stdarg.h> | 6 #include <stdarg.h> |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #if V8_TARGET_ARCH_MIPS | 10 #if V8_TARGET_ARCH_MIPS |
| (...skipping 3815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3826 0x10101LU >> | 3826 0x10101LU >> |
| 3827 16); | 3827 16); |
| 3828 | 3828 |
| 3829 output = output | (static_cast<uint32_t>(o_byte << 24)); | 3829 output = output | (static_cast<uint32_t>(o_byte << 24)); |
| 3830 input = input >> 8; | 3830 input = input >> 8; |
| 3831 } | 3831 } |
| 3832 | 3832 |
| 3833 alu_out = static_cast<int32_t>(output); | 3833 alu_out = static_cast<int32_t>(output); |
| 3834 break; | 3834 break; |
| 3835 } | 3835 } |
| 3836 case SEB: | 3836 case SEB: { |
| 3837 case SEH: | 3837 int8_t input = static_cast<int8_t>(rt()); |
| 3838 case WSBH: | 3838 int32_t output = 0x000000FF & input; |
|
balazs.kilvady
2016/06/21 10:24:58
In the above line if input is an int8_t then why d
| |
| 3839 alu_out = 0x12345678; | 3839 int32_t mask = 0x00000080; |
| 3840 UNREACHABLE(); | 3840 |
| 3841 if (mask & input) output += 0xFFFFFF00; | |
| 3842 | |
| 3843 alu_out = static_cast<int32_t>(output); | |
| 3841 break; | 3844 break; |
| 3845 } | |
| 3846 case SEH: { | |
| 3847 int16_t input = static_cast<int16_t>(rt()); | |
| 3848 int32_t output = 0x0000FFFF & input; | |
| 3849 int32_t mask = 0x00008000; | |
| 3850 | |
| 3851 if (mask & input) output += 0xFFFF0000; | |
| 3852 | |
| 3853 alu_out = static_cast<int32_t>(output); | |
| 3854 break; | |
| 3855 } | |
| 3856 case WSBH: { | |
| 3857 int32_t input = static_cast<uint32_t>(rt()); | |
| 3858 int32_t output = 0; | |
| 3859 | |
| 3860 uint32_t mask = 0xFF000000; | |
| 3861 for (int i = 0; i < 4; i++) { | |
| 3862 uint32_t tmp = mask & input; | |
| 3863 if (i % 2 == 0) { | |
| 3864 tmp = tmp >> 8; | |
| 3865 } else { | |
| 3866 tmp = tmp << 8; | |
| 3867 } | |
| 3868 output = output | tmp; | |
| 3869 mask = mask >> 8; | |
| 3870 } | |
| 3871 | |
| 3872 alu_out = static_cast<int32_t>(output); | |
| 3873 break; | |
| 3874 } | |
| 3842 default: { | 3875 default: { |
| 3843 const uint8_t bp = get_instr()->Bp2Value(); | 3876 const uint8_t bp = get_instr()->Bp2Value(); |
| 3844 sa >>= kBp2Bits; | 3877 sa >>= kBp2Bits; |
| 3845 switch (sa) { | 3878 switch (sa) { |
| 3846 case ALIGN: { | 3879 case ALIGN: { |
| 3847 if (bp == 0) { | 3880 if (bp == 0) { |
| 3848 alu_out = static_cast<int32_t>(rt()); | 3881 alu_out = static_cast<int32_t>(rt()); |
| 3849 } else { | 3882 } else { |
| 3850 uint32_t rt_hi = rt() << (8 * bp); | 3883 uint32_t rt_hi = rt() << (8 * bp); |
| 3851 uint32_t rs_lo = rs() >> (8 * (4 - bp)); | 3884 uint32_t rs_lo = rs() >> (8 * (4 - bp)); |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4599 | 4632 |
| 4600 | 4633 |
| 4601 #undef UNSUPPORTED | 4634 #undef UNSUPPORTED |
| 4602 | 4635 |
| 4603 } // namespace internal | 4636 } // namespace internal |
| 4604 } // namespace v8 | 4637 } // namespace v8 |
| 4605 | 4638 |
| 4606 #endif // USE_SIMULATOR | 4639 #endif // USE_SIMULATOR |
| 4607 | 4640 |
| 4608 #endif // V8_TARGET_ARCH_MIPS | 4641 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |