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

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

Issue 8426005: Merge IR classes for different bitwise operations AND, OR and XOR into one class. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 1 month 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') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 1245
1246 void HBinaryOperation::PrintDataTo(StringStream* stream) { 1246 void HBinaryOperation::PrintDataTo(StringStream* stream) {
1247 left()->PrintNameTo(stream); 1247 left()->PrintNameTo(stream);
1248 stream->Add(" "); 1248 stream->Add(" ");
1249 right()->PrintNameTo(stream); 1249 right()->PrintNameTo(stream);
1250 if (CheckFlag(kCanOverflow)) stream->Add(" !"); 1250 if (CheckFlag(kCanOverflow)) stream->Add(" !");
1251 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?"); 1251 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?");
1252 } 1252 }
1253 1253
1254 1254
1255 Range* HBitAnd::InferRange() { 1255 Range* HBitwise::InferRange() {
1256 if (op() == Token::BIT_XOR) return HValue::InferRange();
1256 int32_t left_mask = (left()->range() != NULL) 1257 int32_t left_mask = (left()->range() != NULL)
1257 ? left()->range()->Mask() 1258 ? left()->range()->Mask()
1258 : 0xffffffff; 1259 : 0xffffffff;
1259 int32_t right_mask = (right()->range() != NULL) 1260 int32_t right_mask = (right()->range() != NULL)
1260 ? right()->range()->Mask() 1261 ? right()->range()->Mask()
1261 : 0xffffffff; 1262 : 0xffffffff;
1262 int32_t result_mask = left_mask & right_mask; 1263 int32_t result_mask = (op() == Token::BIT_AND)
1263 return (result_mask >= 0) 1264 ? left_mask & right_mask
1264 ? new Range(0, result_mask) 1265 : left_mask | right_mask;
1265 : HValue::InferRange();
1266 }
1267
1268
1269 Range* HBitOr::InferRange() {
1270 int32_t left_mask = (left()->range() != NULL)
1271 ? left()->range()->Mask()
1272 : 0xffffffff;
1273 int32_t right_mask = (right()->range() != NULL)
1274 ? right()->range()->Mask()
1275 : 0xffffffff;
1276 int32_t result_mask = left_mask | right_mask;
1277 return (result_mask >= 0) 1266 return (result_mask >= 0)
1278 ? new Range(0, result_mask) 1267 ? new Range(0, result_mask)
1279 : HValue::InferRange(); 1268 : HValue::InferRange();
1280 } 1269 }
1281 1270
1282 1271
1283 Range* HSar::InferRange() { 1272 Range* HSar::InferRange() {
1284 if (right()->IsConstant()) { 1273 if (right()->IsConstant()) {
1285 HConstant* c = HConstant::cast(right()); 1274 HConstant* c = HConstant::cast(right());
1286 if (c->HasInteger32Value()) { 1275 if (c->HasInteger32Value()) {
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 HType HArithmeticBinaryOperation::CalculateInferredType() { 1767 HType HArithmeticBinaryOperation::CalculateInferredType() {
1779 return HType::TaggedNumber(); 1768 return HType::TaggedNumber();
1780 } 1769 }
1781 1770
1782 1771
1783 HType HAdd::CalculateInferredType() { 1772 HType HAdd::CalculateInferredType() {
1784 return HType::Tagged(); 1773 return HType::Tagged();
1785 } 1774 }
1786 1775
1787 1776
1788 HType HBitAnd::CalculateInferredType() {
1789 return HType::TaggedNumber();
1790 }
1791
1792
1793 HType HBitXor::CalculateInferredType() {
1794 return HType::TaggedNumber();
1795 }
1796
1797
1798 HType HBitOr::CalculateInferredType() {
1799 return HType::TaggedNumber();
1800 }
1801
1802
1803 HType HBitNot::CalculateInferredType() { 1777 HType HBitNot::CalculateInferredType() {
1804 return HType::TaggedNumber(); 1778 return HType::TaggedNumber();
1805 } 1779 }
1806 1780
1807 1781
1808 HType HUnaryMathOperation::CalculateInferredType() { 1782 HType HUnaryMathOperation::CalculateInferredType() {
1809 return HType::TaggedNumber(); 1783 return HType::TaggedNumber();
1810 } 1784 }
1811 1785
1812 1786
1813 HType HShl::CalculateInferredType() {
1814 return HType::TaggedNumber();
1815 }
1816
1817
1818 HType HShr::CalculateInferredType() {
1819 return HType::TaggedNumber();
1820 }
1821
1822
1823 HType HSar::CalculateInferredType() {
1824 return HType::TaggedNumber();
1825 }
1826
1827
1828 HType HStringCharFromCode::CalculateInferredType() { 1787 HType HStringCharFromCode::CalculateInferredType() {
1829 return HType::String(); 1788 return HType::String();
1830 } 1789 }
1831 1790
1832 1791
1833 HType HArrayLiteral::CalculateInferredType() { 1792 HType HArrayLiteral::CalculateInferredType() {
1834 return HType::JSArray(); 1793 return HType::JSArray();
1835 } 1794 }
1836 1795
1837 1796
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1984 1943
1985 1944
1986 void HCheckPrototypeMaps::Verify() { 1945 void HCheckPrototypeMaps::Verify() {
1987 HInstruction::Verify(); 1946 HInstruction::Verify();
1988 ASSERT(HasNoUses()); 1947 ASSERT(HasNoUses());
1989 } 1948 }
1990 1949
1991 #endif 1950 #endif
1992 1951
1993 } } // namespace v8::internal 1952 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698