Revision f230a1cf deps/v8/src/mips/simulator-mips.cc

View differences:

deps/v8/src/mips/simulator-mips.cc
2274 2274
          break;
2275 2275
        case DIV:
2276 2276
          // Divide by zero and overflow was not checked in the configuration
2277
          // step - div and divu do not raise exceptions. On division by 0 and
2278
          // on overflow (INT_MIN/-1), the result will be UNPREDICTABLE.
2279
          if (rt != 0 && !(rs == INT_MIN && rt == -1)) {
2277
          // step - div and divu do not raise exceptions. On division by 0
2278
          // the result will be UNPREDICTABLE. On overflow (INT_MIN/-1),
2279
          // return INT_MIN which is what the hardware does.
2280
          if (rs == INT_MIN && rt == -1) {
2281
            set_register(LO, INT_MIN);
2282
            set_register(HI, 0);
2283
          } else if (rt != 0) {
2280 2284
            set_register(LO, rs / rt);
2281 2285
            set_register(HI, rs % rt);
2282 2286
          }

Also available in: Unified diff