| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 <stdarg.h> | 5 #include <stdarg.h> |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #if V8_TARGET_ARCH_PPC | 9 #if V8_TARGET_ARCH_PPC |
| 10 | 10 |
| (...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1616 } | 1616 } |
| 1617 | 1617 |
| 1618 if (instr->Bit(0) == 1) { // LK flag set | 1618 if (instr->Bit(0) == 1) { // LK flag set |
| 1619 special_reg_lr_ = old_pc + 4; | 1619 special_reg_lr_ = old_pc + 4; |
| 1620 } | 1620 } |
| 1621 } | 1621 } |
| 1622 | 1622 |
| 1623 | 1623 |
| 1624 // Handle execution based on instruction types. | 1624 // Handle execution based on instruction types. |
| 1625 void Simulator::ExecuteExt1(Instruction* instr) { | 1625 void Simulator::ExecuteExt1(Instruction* instr) { |
| 1626 switch (instr->Bits(10, 1) << 1) { | 1626 uint32_t opcode = EXT1 | instr->BitField(10, 1); |
| 1627 switch (opcode) { |
| 1627 case MCRF: | 1628 case MCRF: |
| 1628 UNIMPLEMENTED(); // Not used by V8. | 1629 UNIMPLEMENTED(); // Not used by V8. |
| 1629 case BCLRX: | 1630 case BCLRX: |
| 1630 ExecuteBranchConditional(instr, BC_LINK_REG); | 1631 ExecuteBranchConditional(instr, BC_LINK_REG); |
| 1631 break; | 1632 break; |
| 1632 case BCCTRX: | 1633 case BCCTRX: |
| 1633 ExecuteBranchConditional(instr, BC_CTR_REG); | 1634 ExecuteBranchConditional(instr, BC_CTR_REG); |
| 1634 break; | 1635 break; |
| 1635 case CRNOR: | 1636 case CRNOR: |
| 1636 case RFI: | 1637 case RFI: |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1671 default: { | 1672 default: { |
| 1672 UNIMPLEMENTED(); // Not used by V8. | 1673 UNIMPLEMENTED(); // Not used by V8. |
| 1673 } | 1674 } |
| 1674 } | 1675 } |
| 1675 } | 1676 } |
| 1676 | 1677 |
| 1677 | 1678 |
| 1678 bool Simulator::ExecuteExt2_10bit(Instruction* instr) { | 1679 bool Simulator::ExecuteExt2_10bit(Instruction* instr) { |
| 1679 bool found = true; | 1680 bool found = true; |
| 1680 | 1681 |
| 1681 int opcode = instr->Bits(10, 1) << 1; | 1682 uint32_t opcode = EXT2 | instr->BitField(10, 1); |
| 1682 switch (opcode) { | 1683 switch (opcode) { |
| 1683 case SRWX: { | 1684 case SRWX: { |
| 1684 int rs = instr->RSValue(); | 1685 int rs = instr->RSValue(); |
| 1685 int ra = instr->RAValue(); | 1686 int ra = instr->RAValue(); |
| 1686 int rb = instr->RBValue(); | 1687 int rb = instr->RBValue(); |
| 1687 uint32_t rs_val = get_register(rs); | 1688 uint32_t rs_val = get_register(rs); |
| 1688 uintptr_t rb_val = get_register(rb) & 0x3f; | 1689 uintptr_t rb_val = get_register(rb) & 0x3f; |
| 1689 intptr_t result = (rb_val > 31) ? 0 : rs_val >> rb_val; | 1690 intptr_t result = (rb_val > 31) ? 0 : rs_val >> rb_val; |
| 1690 set_register(ra, result); | 1691 set_register(ra, result); |
| 1691 if (instr->Bit(0)) { // RC bit set | 1692 if (instr->Bit(0)) { // RC bit set |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1942 } | 1943 } |
| 1943 default: { | 1944 default: { |
| 1944 found = false; | 1945 found = false; |
| 1945 break; | 1946 break; |
| 1946 } | 1947 } |
| 1947 } | 1948 } |
| 1948 | 1949 |
| 1949 if (found) return found; | 1950 if (found) return found; |
| 1950 | 1951 |
| 1951 found = true; | 1952 found = true; |
| 1952 opcode = instr->Bits(10, 2) << 2; | 1953 opcode = EXT2 | instr->BitField(10, 2); |
| 1953 switch (opcode) { | 1954 switch (opcode) { |
| 1954 case SRADIX: { | 1955 case SRADIX: { |
| 1955 int ra = instr->RAValue(); | 1956 int ra = instr->RAValue(); |
| 1956 int rs = instr->RSValue(); | 1957 int rs = instr->RSValue(); |
| 1957 int sh = (instr->Bits(15, 11) | (instr->Bit(1) << 5)); | 1958 int sh = (instr->Bits(15, 11) | (instr->Bit(1) << 5)); |
| 1958 intptr_t rs_val = get_register(rs); | 1959 intptr_t rs_val = get_register(rs); |
| 1959 intptr_t result = rs_val >> sh; | 1960 intptr_t result = rs_val >> sh; |
| 1960 set_register(ra, result); | 1961 set_register(ra, result); |
| 1961 if (instr->Bit(0)) { // RC bit set | 1962 if (instr->Bit(0)) { // RC bit set |
| 1962 SetCR0(result); | 1963 SetCR0(result); |
| 1963 } | 1964 } |
| 1964 break; | 1965 break; |
| 1965 } | 1966 } |
| 1966 default: { | 1967 default: { |
| 1967 found = false; | 1968 found = false; |
| 1968 break; | 1969 break; |
| 1969 } | 1970 } |
| 1970 } | 1971 } |
| 1971 | 1972 |
| 1972 return found; | 1973 return found; |
| 1973 } | 1974 } |
| 1974 | 1975 |
| 1975 | 1976 |
| 1976 bool Simulator::ExecuteExt2_9bit_part1(Instruction* instr) { | 1977 bool Simulator::ExecuteExt2_9bit_part1(Instruction* instr) { |
| 1977 bool found = true; | 1978 bool found = true; |
| 1978 | 1979 |
| 1979 int opcode = instr->Bits(9, 1) << 1; | 1980 uint32_t opcode = EXT2 | instr->BitField(9, 1); |
| 1980 switch (opcode) { | 1981 switch (opcode) { |
| 1981 case TW: { | 1982 case TW: { |
| 1982 // used for call redirection in simulation mode | 1983 // used for call redirection in simulation mode |
| 1983 SoftwareInterrupt(instr); | 1984 SoftwareInterrupt(instr); |
| 1984 break; | 1985 break; |
| 1985 } | 1986 } |
| 1986 case CMP: { | 1987 case CMP: { |
| 1987 int ra = instr->RAValue(); | 1988 int ra = instr->RAValue(); |
| 1988 int rb = instr->RBValue(); | 1989 int rb = instr->RBValue(); |
| 1989 int cr = instr->Bits(25, 23); | 1990 int cr = instr->Bits(25, 23); |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2227 break; | 2228 break; |
| 2228 } | 2229 } |
| 2229 } | 2230 } |
| 2230 | 2231 |
| 2231 return found; | 2232 return found; |
| 2232 } | 2233 } |
| 2233 | 2234 |
| 2234 | 2235 |
| 2235 bool Simulator::ExecuteExt2_9bit_part2(Instruction* instr) { | 2236 bool Simulator::ExecuteExt2_9bit_part2(Instruction* instr) { |
| 2236 bool found = true; | 2237 bool found = true; |
| 2237 int opcode = instr->Bits(9, 1) << 1; | 2238 uint32_t opcode = EXT2 | instr->BitField(9, 1); |
| 2238 switch (opcode) { | 2239 switch (opcode) { |
| 2239 case CNTLZWX: { | 2240 case CNTLZWX: { |
| 2240 int rs = instr->RSValue(); | 2241 int rs = instr->RSValue(); |
| 2241 int ra = instr->RAValue(); | 2242 int ra = instr->RAValue(); |
| 2242 uintptr_t rs_val = get_register(rs); | 2243 uintptr_t rs_val = get_register(rs); |
| 2243 uintptr_t count = 0; | 2244 uintptr_t count = 0; |
| 2244 int n = 0; | 2245 int n = 0; |
| 2245 uintptr_t bit = 0x80000000; | 2246 uintptr_t bit = 0x80000000; |
| 2246 for (; n < 32; n++) { | 2247 for (; n < 32; n++) { |
| 2247 if (bit & rs_val) break; | 2248 if (bit & rs_val) break; |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2745 found = false; | 2746 found = false; |
| 2746 break; | 2747 break; |
| 2747 } | 2748 } |
| 2748 } | 2749 } |
| 2749 | 2750 |
| 2750 return found; | 2751 return found; |
| 2751 } | 2752 } |
| 2752 | 2753 |
| 2753 | 2754 |
| 2754 void Simulator::ExecuteExt2_5bit(Instruction* instr) { | 2755 void Simulator::ExecuteExt2_5bit(Instruction* instr) { |
| 2755 int opcode = instr->Bits(5, 1) << 1; | 2756 uint32_t opcode = EXT2 | instr->BitField(5, 1); |
| 2756 switch (opcode) { | 2757 switch (opcode) { |
| 2757 case ISEL: { | 2758 case ISEL: { |
| 2758 int rt = instr->RTValue(); | 2759 int rt = instr->RTValue(); |
| 2759 int ra = instr->RAValue(); | 2760 int ra = instr->RAValue(); |
| 2760 int rb = instr->RBValue(); | 2761 int rb = instr->RBValue(); |
| 2761 int condition_bit = instr->RCValue(); | 2762 int condition_bit = instr->RCValue(); |
| 2762 int condition_mask = 0x80000000 >> condition_bit; | 2763 int condition_mask = 0x80000000 >> condition_bit; |
| 2763 intptr_t ra_val = (ra == 0) ? 0 : get_register(ra); | 2764 intptr_t ra_val = (ra == 0) ? 0 : get_register(ra); |
| 2764 intptr_t rb_val = get_register(rb); | 2765 intptr_t rb_val = get_register(rb); |
| 2765 intptr_t value = (condition_reg_ & condition_mask) ? ra_val : rb_val; | 2766 intptr_t value = (condition_reg_ & condition_mask) ? ra_val : rb_val; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2778 // Check first the 10-1 bit versions | 2779 // Check first the 10-1 bit versions |
| 2779 if (ExecuteExt2_10bit(instr)) return; | 2780 if (ExecuteExt2_10bit(instr)) return; |
| 2780 // Now look at the lesser encodings | 2781 // Now look at the lesser encodings |
| 2781 if (ExecuteExt2_9bit_part1(instr)) return; | 2782 if (ExecuteExt2_9bit_part1(instr)) return; |
| 2782 if (ExecuteExt2_9bit_part2(instr)) return; | 2783 if (ExecuteExt2_9bit_part2(instr)) return; |
| 2783 ExecuteExt2_5bit(instr); | 2784 ExecuteExt2_5bit(instr); |
| 2784 } | 2785 } |
| 2785 | 2786 |
| 2786 | 2787 |
| 2787 void Simulator::ExecuteExt3(Instruction* instr) { | 2788 void Simulator::ExecuteExt3(Instruction* instr) { |
| 2788 int opcode = instr->Bits(10, 1) << 1; | 2789 uint32_t opcode = EXT3 | instr->BitField(10, 1); |
| 2789 switch (opcode) { | 2790 switch (opcode) { |
| 2790 case FCFID: { | 2791 case FCFIDS: { |
| 2791 // fcfids | 2792 // fcfids |
| 2792 int frt = instr->RTValue(); | 2793 int frt = instr->RTValue(); |
| 2793 int frb = instr->RBValue(); | 2794 int frb = instr->RBValue(); |
| 2794 int64_t frb_val = get_d_register(frb); | 2795 int64_t frb_val = get_d_register(frb); |
| 2795 double frt_val = static_cast<float>(frb_val); | 2796 double frt_val = static_cast<float>(frb_val); |
| 2796 set_d_register_from_double(frt, frt_val); | 2797 set_d_register_from_double(frt, frt_val); |
| 2797 return; | 2798 return; |
| 2798 } | 2799 } |
| 2799 case FCFIDU: { | 2800 case FCFIDUS: { |
| 2800 // fcfidus | 2801 // fcfidus |
| 2801 int frt = instr->RTValue(); | 2802 int frt = instr->RTValue(); |
| 2802 int frb = instr->RBValue(); | 2803 int frb = instr->RBValue(); |
| 2803 uint64_t frb_val = get_d_register(frb); | 2804 uint64_t frb_val = get_d_register(frb); |
| 2804 double frt_val = static_cast<float>(frb_val); | 2805 double frt_val = static_cast<float>(frb_val); |
| 2805 set_d_register_from_double(frt, frt_val); | 2806 set_d_register_from_double(frt, frt_val); |
| 2806 return; | 2807 return; |
| 2807 } | 2808 } |
| 2808 } | 2809 } |
| 2809 UNIMPLEMENTED(); // Not used by V8. | 2810 UNIMPLEMENTED(); // Not used by V8. |
| 2810 } | 2811 } |
| 2811 | 2812 |
| 2812 | 2813 |
| 2813 void Simulator::ExecuteExt4(Instruction* instr) { | 2814 void Simulator::ExecuteExt4(Instruction* instr) { |
| 2814 switch (instr->Bits(5, 1) << 1) { | 2815 uint32_t opcode = EXT4 | instr->BitField(5, 1); |
| 2816 switch (opcode) { |
| 2815 case FDIV: { | 2817 case FDIV: { |
| 2816 int frt = instr->RTValue(); | 2818 int frt = instr->RTValue(); |
| 2817 int fra = instr->RAValue(); | 2819 int fra = instr->RAValue(); |
| 2818 int frb = instr->RBValue(); | 2820 int frb = instr->RBValue(); |
| 2819 double fra_val = get_double_from_d_register(fra); | 2821 double fra_val = get_double_from_d_register(fra); |
| 2820 double frb_val = get_double_from_d_register(frb); | 2822 double frb_val = get_double_from_d_register(frb); |
| 2821 double frt_val = fra_val / frb_val; | 2823 double frt_val = fra_val / frb_val; |
| 2822 set_d_register_from_double(frt, frt_val); | 2824 set_d_register_from_double(frt, frt_val); |
| 2823 return; | 2825 return; |
| 2824 } | 2826 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2891 int frb = instr->RBValue(); | 2893 int frb = instr->RBValue(); |
| 2892 int frc = instr->RCValue(); | 2894 int frc = instr->RCValue(); |
| 2893 double fra_val = get_double_from_d_register(fra); | 2895 double fra_val = get_double_from_d_register(fra); |
| 2894 double frb_val = get_double_from_d_register(frb); | 2896 double frb_val = get_double_from_d_register(frb); |
| 2895 double frc_val = get_double_from_d_register(frc); | 2897 double frc_val = get_double_from_d_register(frc); |
| 2896 double frt_val = (fra_val * frc_val) + frb_val; | 2898 double frt_val = (fra_val * frc_val) + frb_val; |
| 2897 set_d_register_from_double(frt, frt_val); | 2899 set_d_register_from_double(frt, frt_val); |
| 2898 return; | 2900 return; |
| 2899 } | 2901 } |
| 2900 } | 2902 } |
| 2901 int opcode = instr->Bits(10, 1) << 1; | 2903 opcode = EXT4 | instr->BitField(10, 1); |
| 2902 switch (opcode) { | 2904 switch (opcode) { |
| 2903 case FCMPU: { | 2905 case FCMPU: { |
| 2904 int fra = instr->RAValue(); | 2906 int fra = instr->RAValue(); |
| 2905 int frb = instr->RBValue(); | 2907 int frb = instr->RBValue(); |
| 2906 double fra_val = get_double_from_d_register(fra); | 2908 double fra_val = get_double_from_d_register(fra); |
| 2907 double frb_val = get_double_from_d_register(frb); | 2909 double frb_val = get_double_from_d_register(frb); |
| 2908 int cr = instr->Bits(25, 23); | 2910 int cr = instr->Bits(25, 23); |
| 2909 int bf = 0; | 2911 int bf = 0; |
| 2910 if (fra_val < frb_val) { | 2912 if (fra_val < frb_val) { |
| 2911 bf |= 0x80000000; | 2913 bf |= 0x80000000; |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3229 double frt_val = std::fabs(frb_val); | 3231 double frt_val = std::fabs(frb_val); |
| 3230 set_d_register_from_double(frt, frt_val); | 3232 set_d_register_from_double(frt, frt_val); |
| 3231 return; | 3233 return; |
| 3232 } | 3234 } |
| 3233 } | 3235 } |
| 3234 UNIMPLEMENTED(); // Not used by V8. | 3236 UNIMPLEMENTED(); // Not used by V8. |
| 3235 } | 3237 } |
| 3236 | 3238 |
| 3237 #if V8_TARGET_ARCH_PPC64 | 3239 #if V8_TARGET_ARCH_PPC64 |
| 3238 void Simulator::ExecuteExt5(Instruction* instr) { | 3240 void Simulator::ExecuteExt5(Instruction* instr) { |
| 3239 switch (instr->Bits(4, 2) << 2) { | 3241 uint32_t opcode = EXT5 | instr->BitField(4, 2); |
| 3242 switch (opcode) { |
| 3240 case RLDICL: { | 3243 case RLDICL: { |
| 3241 int ra = instr->RAValue(); | 3244 int ra = instr->RAValue(); |
| 3242 int rs = instr->RSValue(); | 3245 int rs = instr->RSValue(); |
| 3243 uintptr_t rs_val = get_register(rs); | 3246 uintptr_t rs_val = get_register(rs); |
| 3244 int sh = (instr->Bits(15, 11) | (instr->Bit(1) << 5)); | 3247 int sh = (instr->Bits(15, 11) | (instr->Bit(1) << 5)); |
| 3245 int mb = (instr->Bits(10, 6) | (instr->Bit(5) << 5)); | 3248 int mb = (instr->Bits(10, 6) | (instr->Bit(5) << 5)); |
| 3246 DCHECK(sh >= 0 && sh <= 63); | 3249 DCHECK(sh >= 0 && sh <= 63); |
| 3247 DCHECK(mb >= 0 && mb <= 63); | 3250 DCHECK(mb >= 0 && mb <= 63); |
| 3248 uintptr_t result = base::bits::RotateLeft64(rs_val, sh); | 3251 uintptr_t result = base::bits::RotateLeft64(rs_val, sh); |
| 3249 uintptr_t mask = 0xffffffffffffffff >> mb; | 3252 uintptr_t mask = 0xffffffffffffffff >> mb; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3317 result &= mask; | 3320 result &= mask; |
| 3318 ra_val &= ~mask; | 3321 ra_val &= ~mask; |
| 3319 result |= ra_val; | 3322 result |= ra_val; |
| 3320 set_register(ra, result); | 3323 set_register(ra, result); |
| 3321 if (instr->Bit(0)) { // RC bit set | 3324 if (instr->Bit(0)) { // RC bit set |
| 3322 SetCR0(result); | 3325 SetCR0(result); |
| 3323 } | 3326 } |
| 3324 return; | 3327 return; |
| 3325 } | 3328 } |
| 3326 } | 3329 } |
| 3327 switch (instr->Bits(4, 1) << 1) { | 3330 opcode = EXT5 | instr->BitField(4, 1); |
| 3331 switch (opcode) { |
| 3328 case RLDCL: { | 3332 case RLDCL: { |
| 3329 int ra = instr->RAValue(); | 3333 int ra = instr->RAValue(); |
| 3330 int rs = instr->RSValue(); | 3334 int rs = instr->RSValue(); |
| 3331 int rb = instr->RBValue(); | 3335 int rb = instr->RBValue(); |
| 3332 uintptr_t rs_val = get_register(rs); | 3336 uintptr_t rs_val = get_register(rs); |
| 3333 uintptr_t rb_val = get_register(rb); | 3337 uintptr_t rb_val = get_register(rb); |
| 3334 int sh = (rb_val & 0x3f); | 3338 int sh = (rb_val & 0x3f); |
| 3335 int mb = (instr->Bits(10, 6) | (instr->Bit(5) << 5)); | 3339 int mb = (instr->Bits(10, 6) | (instr->Bit(5) << 5)); |
| 3336 DCHECK(sh >= 0 && sh <= 63); | 3340 DCHECK(sh >= 0 && sh <= 63); |
| 3337 DCHECK(mb >= 0 && mb <= 63); | 3341 DCHECK(mb >= 0 && mb <= 63); |
| 3338 uintptr_t result = base::bits::RotateLeft64(rs_val, sh); | 3342 uintptr_t result = base::bits::RotateLeft64(rs_val, sh); |
| 3339 uintptr_t mask = 0xffffffffffffffff >> mb; | 3343 uintptr_t mask = 0xffffffffffffffff >> mb; |
| 3340 result &= mask; | 3344 result &= mask; |
| 3341 set_register(ra, result); | 3345 set_register(ra, result); |
| 3342 if (instr->Bit(0)) { // RC bit set | 3346 if (instr->Bit(0)) { // RC bit set |
| 3343 SetCR0(result); | 3347 SetCR0(result); |
| 3344 } | 3348 } |
| 3345 return; | 3349 return; |
| 3346 } | 3350 } |
| 3347 } | 3351 } |
| 3348 UNIMPLEMENTED(); // Not used by V8. | 3352 UNIMPLEMENTED(); // Not used by V8. |
| 3349 } | 3353 } |
| 3350 #endif | 3354 #endif |
| 3351 | 3355 |
| 3352 void Simulator::ExecuteExt6(Instruction* instr) { | 3356 void Simulator::ExecuteExt6(Instruction* instr) { |
| 3353 switch (instr->Bits(10, 3) << 3) { | 3357 uint32_t opcode = EXT6 | instr->BitField(10, 3); |
| 3358 switch (opcode) { |
| 3354 case XSADDDP: { | 3359 case XSADDDP: { |
| 3355 int frt = instr->RTValue(); | 3360 int frt = instr->RTValue(); |
| 3356 int fra = instr->RAValue(); | 3361 int fra = instr->RAValue(); |
| 3357 int frb = instr->RBValue(); | 3362 int frb = instr->RBValue(); |
| 3358 double fra_val = get_double_from_d_register(fra); | 3363 double fra_val = get_double_from_d_register(fra); |
| 3359 double frb_val = get_double_from_d_register(frb); | 3364 double frb_val = get_double_from_d_register(frb); |
| 3360 double frt_val = fra_val + frb_val; | 3365 double frt_val = fra_val + frb_val; |
| 3361 set_d_register_from_double(frt, frt_val); | 3366 set_d_register_from_double(frt, frt_val); |
| 3362 return; | 3367 return; |
| 3363 } | 3368 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 3389 double frb_val = get_double_from_d_register(frb); | 3394 double frb_val = get_double_from_d_register(frb); |
| 3390 double frt_val = fra_val / frb_val; | 3395 double frt_val = fra_val / frb_val; |
| 3391 set_d_register_from_double(frt, frt_val); | 3396 set_d_register_from_double(frt, frt_val); |
| 3392 return; | 3397 return; |
| 3393 } | 3398 } |
| 3394 } | 3399 } |
| 3395 UNIMPLEMENTED(); // Not used by V8. | 3400 UNIMPLEMENTED(); // Not used by V8. |
| 3396 } | 3401 } |
| 3397 | 3402 |
| 3398 void Simulator::ExecuteGeneric(Instruction* instr) { | 3403 void Simulator::ExecuteGeneric(Instruction* instr) { |
| 3399 int opcode = instr->OpcodeValue() << 26; | 3404 uint32_t opcode = instr->OpcodeField(); |
| 3400 switch (opcode) { | 3405 switch (opcode) { |
| 3401 case SUBFIC: { | 3406 case SUBFIC: { |
| 3402 int rt = instr->RTValue(); | 3407 int rt = instr->RTValue(); |
| 3403 int ra = instr->RAValue(); | 3408 int ra = instr->RAValue(); |
| 3404 intptr_t ra_val = get_register(ra); | 3409 intptr_t ra_val = get_register(ra); |
| 3405 int32_t im_val = instr->Bits(15, 0); | 3410 int32_t im_val = instr->Bits(15, 0); |
| 3406 im_val = SIGN_EXT_IMM16(im_val); | 3411 im_val = SIGN_EXT_IMM16(im_val); |
| 3407 intptr_t alu_out = im_val - ra_val; | 3412 intptr_t alu_out = im_val - ra_val; |
| 3408 set_register(rt, alu_out); | 3413 set_register(rt, alu_out); |
| 3409 // todo - handle RC bit | 3414 // todo - handle RC bit |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3956 | 3961 |
| 3957 // Executes the current instruction. | 3962 // Executes the current instruction. |
| 3958 void Simulator::ExecuteInstruction(Instruction* instr) { | 3963 void Simulator::ExecuteInstruction(Instruction* instr) { |
| 3959 if (v8::internal::FLAG_check_icache) { | 3964 if (v8::internal::FLAG_check_icache) { |
| 3960 CheckICache(isolate_->simulator_i_cache(), instr); | 3965 CheckICache(isolate_->simulator_i_cache(), instr); |
| 3961 } | 3966 } |
| 3962 pc_modified_ = false; | 3967 pc_modified_ = false; |
| 3963 if (::v8::internal::FLAG_trace_sim) { | 3968 if (::v8::internal::FLAG_trace_sim) { |
| 3964 Trace(instr); | 3969 Trace(instr); |
| 3965 } | 3970 } |
| 3966 int opcode = instr->OpcodeValue() << 26; | 3971 uint32_t opcode = instr->OpcodeField(); |
| 3967 if (opcode == TWI) { | 3972 if (opcode == TWI) { |
| 3968 SoftwareInterrupt(instr); | 3973 SoftwareInterrupt(instr); |
| 3969 } else { | 3974 } else { |
| 3970 ExecuteGeneric(instr); | 3975 ExecuteGeneric(instr); |
| 3971 } | 3976 } |
| 3972 if (!pc_modified_) { | 3977 if (!pc_modified_) { |
| 3973 set_pc(reinterpret_cast<intptr_t>(instr) + Instruction::kInstrSize); | 3978 set_pc(reinterpret_cast<intptr_t>(instr) + Instruction::kInstrSize); |
| 3974 } | 3979 } |
| 3975 } | 3980 } |
| 3976 | 3981 |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4205 uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(current_sp); | 4210 uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(current_sp); |
| 4206 uintptr_t address = *stack_slot; | 4211 uintptr_t address = *stack_slot; |
| 4207 set_register(sp, current_sp + sizeof(uintptr_t)); | 4212 set_register(sp, current_sp + sizeof(uintptr_t)); |
| 4208 return address; | 4213 return address; |
| 4209 } | 4214 } |
| 4210 } // namespace internal | 4215 } // namespace internal |
| 4211 } // namespace v8 | 4216 } // namespace v8 |
| 4212 | 4217 |
| 4213 #endif // USE_SIMULATOR | 4218 #endif // USE_SIMULATOR |
| 4214 #endif // V8_TARGET_ARCH_PPC | 4219 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |