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 1781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1792 !CheckFlag(kAllUsesTruncatingToInt32) && | 1792 !CheckFlag(kAllUsesTruncatingToInt32) && |
1793 ((a->CanBeZero() && b->CanBeNegative()) || | 1793 ((a->CanBeZero() && b->CanBeNegative()) || |
1794 (a->CanBeNegative() && b->CanBeZero()))); | 1794 (a->CanBeNegative() && b->CanBeZero()))); |
1795 return res; | 1795 return res; |
1796 } else { | 1796 } else { |
1797 return HValue::InferRange(zone); | 1797 return HValue::InferRange(zone); |
1798 } | 1798 } |
1799 } | 1799 } |
1800 | 1800 |
1801 | 1801 |
1802 Range* HBinaryOperation::InferRangeForDiv(Zone* zone) { | 1802 Range* HDiv::InferRange(Zone* zone) { |
1803 if (representation().IsInteger32()) { | 1803 if (representation().IsInteger32()) { |
1804 Range* a = left()->range(); | 1804 Range* a = left()->range(); |
1805 Range* b = right()->range(); | 1805 Range* b = right()->range(); |
1806 Range* result = new(zone) Range(); | 1806 Range* result = new(zone) Range(); |
1807 result->set_can_be_minus_zero(!CheckFlag(kAllUsesTruncatingToInt32) && | 1807 result->set_can_be_minus_zero(!CheckFlag(kAllUsesTruncatingToInt32) && |
1808 (a->CanBeMinusZero() || | 1808 (a->CanBeMinusZero() || |
1809 (a->CanBeZero() && b->CanBeNegative()))); | 1809 (a->CanBeZero() && b->CanBeNegative()))); |
1810 if (!a->Includes(kMinInt) || !b->Includes(-1)) { | 1810 if (!a->Includes(kMinInt) || !b->Includes(-1)) { |
1811 ClearFlag(kCanOverflow); | 1811 ClearFlag(kCanOverflow); |
1812 } | 1812 } |
1813 | 1813 |
1814 if (!b->CanBeZero()) { | 1814 if (!b->CanBeZero()) { |
1815 ClearFlag(kCanBeDivByZero); | 1815 ClearFlag(kCanBeDivByZero); |
1816 } | 1816 } |
1817 return result; | 1817 return result; |
1818 } else { | 1818 } else { |
1819 return HValue::InferRange(zone); | 1819 return HValue::InferRange(zone); |
1820 } | 1820 } |
1821 } | 1821 } |
1822 | 1822 |
1823 | 1823 |
1824 Range* HDiv::InferRange(Zone* zone) { | |
1825 return InferRangeForDiv(zone); | |
1826 } | |
1827 | |
1828 | |
1829 Range* HMathFloorOfDiv::InferRange(Zone* zone) { | 1824 Range* HMathFloorOfDiv::InferRange(Zone* zone) { |
1830 return InferRangeForDiv(zone); | 1825 if (representation().IsInteger32()) { |
| 1826 Range* a = left()->range(); |
| 1827 Range* b = right()->range(); |
| 1828 Range* result = new(zone) Range(); |
| 1829 result->set_can_be_minus_zero(!CheckFlag(kAllUsesTruncatingToInt32) && |
| 1830 (a->CanBeMinusZero() || |
| 1831 (a->CanBeZero() && b->CanBeNegative()))); |
| 1832 if (!a->Includes(kMinInt)) { |
| 1833 ClearFlag(kLeftCanBeMinInt); |
| 1834 } |
| 1835 |
| 1836 if (!a->Includes(kMinInt) || !b->Includes(-1)) { |
| 1837 ClearFlag(kCanOverflow); |
| 1838 } |
| 1839 |
| 1840 if (!b->CanBeZero()) { |
| 1841 ClearFlag(kCanBeDivByZero); |
| 1842 } |
| 1843 return result; |
| 1844 } else { |
| 1845 return HValue::InferRange(zone); |
| 1846 } |
1831 } | 1847 } |
1832 | 1848 |
1833 | 1849 |
1834 Range* HMod::InferRange(Zone* zone) { | 1850 Range* HMod::InferRange(Zone* zone) { |
1835 if (representation().IsInteger32()) { | 1851 if (representation().IsInteger32()) { |
1836 Range* a = left()->range(); | 1852 Range* a = left()->range(); |
1837 Range* b = right()->range(); | 1853 Range* b = right()->range(); |
1838 | 1854 |
1839 // The magnitude of the modulus is bounded by the right operand. Note that | 1855 // The magnitude of the modulus is bounded by the right operand. Note that |
1840 // apart for the cases involving kMinInt, the calculation below is the same | 1856 // apart for the cases involving kMinInt, the calculation below is the same |
(...skipping 2714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4555 break; | 4571 break; |
4556 case kExternalMemory: | 4572 case kExternalMemory: |
4557 stream->Add("[external-memory]"); | 4573 stream->Add("[external-memory]"); |
4558 break; | 4574 break; |
4559 } | 4575 } |
4560 | 4576 |
4561 stream->Add("@%d", offset()); | 4577 stream->Add("@%d", offset()); |
4562 } | 4578 } |
4563 | 4579 |
4564 } } // namespace v8::internal | 4580 } } // namespace v8::internal |
OLD | NEW |