OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2212 // Instructions using HI and LO registers. | 2212 // Instructions using HI and LO registers. |
2213 case MULT: | 2213 case MULT: |
2214 set_register(LO, static_cast<int32_t>(i64hilo & 0xffffffff)); | 2214 set_register(LO, static_cast<int32_t>(i64hilo & 0xffffffff)); |
2215 set_register(HI, static_cast<int32_t>(i64hilo >> 32)); | 2215 set_register(HI, static_cast<int32_t>(i64hilo >> 32)); |
2216 break; | 2216 break; |
2217 case MULTU: | 2217 case MULTU: |
2218 set_register(LO, static_cast<int32_t>(u64hilo & 0xffffffff)); | 2218 set_register(LO, static_cast<int32_t>(u64hilo & 0xffffffff)); |
2219 set_register(HI, static_cast<int32_t>(u64hilo >> 32)); | 2219 set_register(HI, static_cast<int32_t>(u64hilo >> 32)); |
2220 break; | 2220 break; |
2221 case DIV: | 2221 case DIV: |
2222 // Divide by zero was not checked in the configuration step - div and | 2222 // Divide by zero and overflow was not checked in the configuration |
2223 // divu do not raise exceptions. On division by 0, the result will | 2223 // step - div and divu do not raise exceptions. On division by 0 and |
2224 // be UNPREDICTABLE. | 2224 // on overflow (INT_MIN/-1), the result will be UNPREDICTABLE. |
2225 if (rt != 0) { | 2225 if (rt != 0 && !(rs == INT_MIN && rt == -1)) { |
2226 set_register(LO, rs / rt); | 2226 set_register(LO, rs / rt); |
2227 set_register(HI, rs % rt); | 2227 set_register(HI, rs % rt); |
2228 } | 2228 } |
2229 break; | 2229 break; |
2230 case DIVU: | 2230 case DIVU: |
2231 if (rt_u != 0) { | 2231 if (rt_u != 0) { |
2232 set_register(LO, rs_u / rt_u); | 2232 set_register(LO, rs_u / rt_u); |
2233 set_register(HI, rs_u % rt_u); | 2233 set_register(HI, rs_u % rt_u); |
2234 } | 2234 } |
2235 break; | 2235 break; |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2837 } | 2837 } |
2838 | 2838 |
2839 | 2839 |
2840 #undef UNSUPPORTED | 2840 #undef UNSUPPORTED |
2841 | 2841 |
2842 } } // namespace v8::internal | 2842 } } // namespace v8::internal |
2843 | 2843 |
2844 #endif // USE_SIMULATOR | 2844 #endif // USE_SIMULATOR |
2845 | 2845 |
2846 #endif // V8_TARGET_ARCH_MIPS | 2846 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |