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 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1438 } | 1438 } |
1439 | 1439 |
1440 | 1440 |
1441 HValue* HMul::Canonicalize() { | 1441 HValue* HMul::Canonicalize() { |
1442 if (IsIdentityOperation(left(), right(), 1)) return left(); | 1442 if (IsIdentityOperation(left(), right(), 1)) return left(); |
1443 if (IsIdentityOperation(right(), left(), 1)) return right(); | 1443 if (IsIdentityOperation(right(), left(), 1)) return right(); |
1444 return this; | 1444 return this; |
1445 } | 1445 } |
1446 | 1446 |
1447 | 1447 |
| 1448 HValue* HMod::Canonicalize() { |
| 1449 return this; |
| 1450 } |
| 1451 |
| 1452 |
| 1453 HValue* HDiv::Canonicalize() { |
| 1454 return this; |
| 1455 } |
| 1456 |
| 1457 |
1448 HValue* HChange::Canonicalize() { | 1458 HValue* HChange::Canonicalize() { |
1449 return (from().Equals(to())) ? value() : this; | 1459 return (from().Equals(to())) ? value() : this; |
1450 } | 1460 } |
1451 | 1461 |
1452 | 1462 |
1453 HValue* HWrapReceiver::Canonicalize() { | 1463 HValue* HWrapReceiver::Canonicalize() { |
1454 if (HasNoUses()) return NULL; | 1464 if (HasNoUses()) return NULL; |
1455 if (receiver()->type().IsJSObject()) { | 1465 if (receiver()->type().IsJSObject()) { |
1456 return receiver(); | 1466 return receiver(); |
1457 } | 1467 } |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 res->set_can_be_minus_zero(m0); | 1776 res->set_can_be_minus_zero(m0); |
1767 return res; | 1777 return res; |
1768 } else { | 1778 } else { |
1769 return HValue::InferRange(zone); | 1779 return HValue::InferRange(zone); |
1770 } | 1780 } |
1771 } | 1781 } |
1772 | 1782 |
1773 | 1783 |
1774 Range* HDiv::InferRange(Zone* zone) { | 1784 Range* HDiv::InferRange(Zone* zone) { |
1775 if (representation().IsInteger32()) { | 1785 if (representation().IsInteger32()) { |
| 1786 Range* a = left()->range(); |
| 1787 Range* b = right()->range(); |
1776 Range* result = new(zone) Range(); | 1788 Range* result = new(zone) Range(); |
1777 if (left()->range()->CanBeMinusZero()) { | 1789 if (a->CanBeMinusZero()) { |
1778 result->set_can_be_minus_zero(true); | 1790 result->set_can_be_minus_zero(true); |
1779 } | 1791 } |
1780 | 1792 |
1781 if (left()->range()->CanBeZero() && right()->range()->CanBeNegative()) { | 1793 if (a->CanBeZero() && b->CanBeNegative()) { |
1782 result->set_can_be_minus_zero(true); | 1794 result->set_can_be_minus_zero(true); |
1783 } | 1795 } |
1784 | 1796 |
1785 if (right()->range()->Includes(-1) && left()->range()->Includes(kMinInt)) { | 1797 if (!a->Includes(kMinInt) || !b->Includes(-1)) { |
1786 SetFlag(HValue::kCanOverflow); | 1798 ClearFlag(HValue::kCanOverflow); |
1787 } | 1799 } |
1788 | 1800 |
1789 if (!right()->range()->CanBeZero()) { | 1801 if (!b->CanBeZero()) { |
1790 ClearFlag(HValue::kCanBeDivByZero); | 1802 ClearFlag(HValue::kCanBeDivByZero); |
1791 } | 1803 } |
1792 return result; | 1804 return result; |
1793 } else { | 1805 } else { |
1794 return HValue::InferRange(zone); | 1806 return HValue::InferRange(zone); |
1795 } | 1807 } |
1796 } | 1808 } |
1797 | 1809 |
1798 | 1810 |
1799 Range* HMod::InferRange(Zone* zone) { | 1811 Range* HMod::InferRange(Zone* zone) { |
1800 if (representation().IsInteger32()) { | 1812 if (representation().IsInteger32()) { |
1801 Range* a = left()->range(); | 1813 Range* a = left()->range(); |
| 1814 Range* b = right()->range(); |
1802 Range* result = new(zone) Range(); | 1815 Range* result = new(zone) Range(); |
1803 if (a->CanBeMinusZero() || a->CanBeNegative()) { | 1816 if (a->CanBeMinusZero() || a->CanBeNegative()) { |
1804 result->set_can_be_minus_zero(true); | 1817 result->set_can_be_minus_zero(true); |
1805 } | 1818 } |
1806 | 1819 |
1807 if (right()->range()->Includes(-1) && left()->range()->Includes(kMinInt)) { | 1820 if (!a->Includes(kMinInt) || !b->Includes(-1)) { |
1808 SetFlag(HValue::kCanOverflow); | 1821 ClearFlag(HValue::kCanOverflow); |
1809 } | 1822 } |
1810 | 1823 |
1811 if (!right()->range()->CanBeZero()) { | 1824 if (!b->CanBeZero()) { |
1812 ClearFlag(HValue::kCanBeDivByZero); | 1825 ClearFlag(HValue::kCanBeDivByZero); |
1813 } | 1826 } |
1814 return result; | 1827 return result; |
1815 } else { | 1828 } else { |
1816 return HValue::InferRange(zone); | 1829 return HValue::InferRange(zone); |
1817 } | 1830 } |
1818 } | 1831 } |
1819 | 1832 |
1820 | 1833 |
1821 void HPhi::AddInformativeDefinitions() { | 1834 void HPhi::AddInformativeDefinitions() { |
(...skipping 1830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3652 | 3665 |
3653 | 3666 |
3654 void HCheckFunction::Verify() { | 3667 void HCheckFunction::Verify() { |
3655 HInstruction::Verify(); | 3668 HInstruction::Verify(); |
3656 ASSERT(HasNoUses()); | 3669 ASSERT(HasNoUses()); |
3657 } | 3670 } |
3658 | 3671 |
3659 #endif | 3672 #endif |
3660 | 3673 |
3661 } } // namespace v8::internal | 3674 } } // namespace v8::internal |
OLD | NEW |