Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(609)

Side by Side Diff: src/hydrogen-instructions.cc

Issue 195133002: Fixed range analysis for HMathFloorOfDiv. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1781 !CheckFlag(kAllUsesTruncatingToInt32) && 1781 !CheckFlag(kAllUsesTruncatingToInt32) &&
1782 ((a->CanBeZero() && b->CanBeNegative()) || 1782 ((a->CanBeZero() && b->CanBeNegative()) ||
1783 (a->CanBeNegative() && b->CanBeZero()))); 1783 (a->CanBeNegative() && b->CanBeZero())));
1784 return res; 1784 return res;
1785 } else { 1785 } else {
1786 return HValue::InferRange(zone); 1786 return HValue::InferRange(zone);
1787 } 1787 }
1788 } 1788 }
1789 1789
1790 1790
1791 Range* HDiv::InferRange(Zone* zone) { 1791 Range* HBinaryOperation::InferRangeForDiv(Zone* zone) {
1792 if (representation().IsInteger32()) { 1792 if (representation().IsInteger32()) {
1793 Range* a = left()->range(); 1793 Range* a = left()->range();
1794 Range* b = right()->range(); 1794 Range* b = right()->range();
1795 Range* result = new(zone) Range(); 1795 Range* result = new(zone) Range();
1796 result->set_can_be_minus_zero(!CheckFlag(kAllUsesTruncatingToInt32) && 1796 result->set_can_be_minus_zero(!CheckFlag(kAllUsesTruncatingToInt32) &&
1797 (a->CanBeMinusZero() || 1797 (a->CanBeMinusZero() ||
1798 (a->CanBeZero() && b->CanBeNegative()))); 1798 (a->CanBeZero() && b->CanBeNegative())));
1799 if (!a->Includes(kMinInt) || !b->Includes(-1)) { 1799 if (!a->Includes(kMinInt) || !b->Includes(-1)) {
1800 ClearFlag(HValue::kCanOverflow); 1800 ClearFlag(kCanOverflow);
1801 } 1801 }
1802 1802
1803 if (!b->CanBeZero()) { 1803 if (!b->CanBeZero()) {
1804 ClearFlag(HValue::kCanBeDivByZero); 1804 ClearFlag(kCanBeDivByZero);
1805 } 1805 }
1806 return result; 1806 return result;
1807 } else { 1807 } else {
1808 return HValue::InferRange(zone); 1808 return HValue::InferRange(zone);
1809 } 1809 }
1810 } 1810 }
1811 1811
1812 1812
1813 Range* HDiv::InferRange(Zone* zone) {
1814 return InferRangeForDiv(zone);
1815 }
1816
1817
1818 Range* HMathFloorOfDiv::InferRange(Zone* zone) {
1819 return InferRangeForDiv(zone);
1820 }
1821
1822
1813 Range* HMod::InferRange(Zone* zone) { 1823 Range* HMod::InferRange(Zone* zone) {
1814 if (representation().IsInteger32()) { 1824 if (representation().IsInteger32()) {
1815 Range* a = left()->range(); 1825 Range* a = left()->range();
1816 Range* b = right()->range(); 1826 Range* b = right()->range();
1817 1827
1818 // The magnitude of the modulus is bounded by the right operand. Note that 1828 // The magnitude of the modulus is bounded by the right operand. Note that
1819 // apart for the cases involving kMinInt, the calculation below is the same 1829 // apart for the cases involving kMinInt, the calculation below is the same
1820 // as Max(Abs(b->lower()), Abs(b->upper())) - 1. 1830 // as Max(Abs(b->lower()), Abs(b->upper())) - 1.
1821 int32_t positive_bound = -(Min(NegAbs(b->lower()), NegAbs(b->upper())) + 1); 1831 int32_t positive_bound = -(Min(NegAbs(b->lower()), NegAbs(b->upper())) + 1);
1822 1832
(...skipping 2720 matching lines...) Expand 10 before | Expand all | Expand 10 after
4543 break; 4553 break;
4544 case kExternalMemory: 4554 case kExternalMemory:
4545 stream->Add("[external-memory]"); 4555 stream->Add("[external-memory]");
4546 break; 4556 break;
4547 } 4557 }
4548 4558
4549 stream->Add("@%d", offset()); 4559 stream->Add("@%d", offset());
4550 } 4560 }
4551 4561
4552 } } // namespace v8::internal 4562 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698