OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 __ sar(dividend, shift); | 1630 __ sar(dividend, shift); |
1631 return; | 1631 return; |
1632 } | 1632 } |
1633 | 1633 |
1634 // If the divisor is negative, we have to negate and handle edge cases. | 1634 // If the divisor is negative, we have to negate and handle edge cases. |
1635 Label not_kmin_int, done; | 1635 Label not_kmin_int, done; |
1636 __ neg(dividend); | 1636 __ neg(dividend); |
1637 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1637 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
1638 DeoptimizeIf(zero, instr->environment()); | 1638 DeoptimizeIf(zero, instr->environment()); |
1639 } | 1639 } |
1640 if (instr->hydrogen()->left()->RangeCanInclude(kMinInt)) { | 1640 if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) { |
1641 // Note that we could emit branch-free code, but that would need one more | 1641 // Note that we could emit branch-free code, but that would need one more |
1642 // register. | 1642 // register. |
1643 __ j(no_overflow, ¬_kmin_int, Label::kNear); | |
1644 if (divisor == -1) { | 1643 if (divisor == -1) { |
1645 DeoptimizeIf(no_condition, instr->environment()); | 1644 DeoptimizeIf(overflow, instr->environment()); |
1646 } else { | 1645 } else { |
| 1646 __ j(no_overflow, ¬_kmin_int, Label::kNear); |
1647 __ mov(dividend, Immediate(kMinInt / divisor)); | 1647 __ mov(dividend, Immediate(kMinInt / divisor)); |
1648 __ jmp(&done, Label::kNear); | 1648 __ jmp(&done, Label::kNear); |
1649 } | 1649 } |
1650 } | 1650 } |
1651 __ bind(¬_kmin_int); | 1651 __ bind(¬_kmin_int); |
1652 __ sar(dividend, shift); | 1652 __ sar(dividend, shift); |
1653 __ bind(&done); | 1653 __ bind(&done); |
1654 } | 1654 } |
1655 | 1655 |
1656 | 1656 |
(...skipping 4674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6331 FixedArray::kHeaderSize - kPointerSize)); | 6331 FixedArray::kHeaderSize - kPointerSize)); |
6332 __ bind(&done); | 6332 __ bind(&done); |
6333 } | 6333 } |
6334 | 6334 |
6335 | 6335 |
6336 #undef __ | 6336 #undef __ |
6337 | 6337 |
6338 } } // namespace v8::internal | 6338 } } // namespace v8::internal |
6339 | 6339 |
6340 #endif // V8_TARGET_ARCH_IA32 | 6340 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |