| OLD | NEW |
| 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 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 ? left()->range()->Copy() | 1223 ? left()->range()->Copy() |
| 1224 : new Range(); | 1224 : new Range(); |
| 1225 result->Sar(c->Integer32Value()); | 1225 result->Sar(c->Integer32Value()); |
| 1226 return result; | 1226 return result; |
| 1227 } | 1227 } |
| 1228 } | 1228 } |
| 1229 return HValue::InferRange(); | 1229 return HValue::InferRange(); |
| 1230 } | 1230 } |
| 1231 | 1231 |
| 1232 | 1232 |
| 1233 Range* HShr::InferRange() { |
| 1234 if (right()->IsConstant()) { |
| 1235 HConstant* c = HConstant::cast(right()); |
| 1236 if (c->HasInteger32Value()) { |
| 1237 int shift_count = c->Integer32Value() & 0x1f; |
| 1238 if (left()->range()->CanBeNegative()) { |
| 1239 // Only compute bounds if the result always fits into an int32. |
| 1240 return (shift_count >= 1) |
| 1241 ? new Range(0, static_cast<uint32_t>(0xffffffff) >> shift_count) |
| 1242 : new Range(); |
| 1243 } else { |
| 1244 // For positive inputs we can use the >> operator. |
| 1245 Range* result = (left()->range() != NULL) |
| 1246 ? left()->range()->Copy() |
| 1247 : new Range(); |
| 1248 result->Sar(c->Integer32Value()); |
| 1249 return result; |
| 1250 } |
| 1251 } |
| 1252 } |
| 1253 return HValue::InferRange(); |
| 1254 } |
| 1255 |
| 1256 |
| 1233 Range* HShl::InferRange() { | 1257 Range* HShl::InferRange() { |
| 1234 if (right()->IsConstant()) { | 1258 if (right()->IsConstant()) { |
| 1235 HConstant* c = HConstant::cast(right()); | 1259 HConstant* c = HConstant::cast(right()); |
| 1236 if (c->HasInteger32Value()) { | 1260 if (c->HasInteger32Value()) { |
| 1237 Range* result = (left()->range() != NULL) | 1261 Range* result = (left()->range() != NULL) |
| 1238 ? left()->range()->Copy() | 1262 ? left()->range()->Copy() |
| 1239 : new Range(); | 1263 : new Range(); |
| 1240 result->Shl(c->Integer32Value()); | 1264 result->Shl(c->Integer32Value()); |
| 1241 return result; | 1265 return result; |
| 1242 } | 1266 } |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1359 | 1383 |
| 1360 bool HLoadKeyedFastElement::RequiresHoleCheck() const { | 1384 bool HLoadKeyedFastElement::RequiresHoleCheck() const { |
| 1361 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { | 1385 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { |
| 1362 HValue* use = it.value(); | 1386 HValue* use = it.value(); |
| 1363 if (!use->IsChange()) return true; | 1387 if (!use->IsChange()) return true; |
| 1364 } | 1388 } |
| 1365 return false; | 1389 return false; |
| 1366 } | 1390 } |
| 1367 | 1391 |
| 1368 | 1392 |
| 1393 void HLoadKeyedFastDoubleElement::PrintDataTo(StringStream* stream) { |
| 1394 elements()->PrintNameTo(stream); |
| 1395 stream->Add("["); |
| 1396 key()->PrintNameTo(stream); |
| 1397 stream->Add("]"); |
| 1398 } |
| 1399 |
| 1400 |
| 1401 bool HLoadKeyedFastDoubleElement::RequiresHoleCheck() const { |
| 1402 return true; |
| 1403 } |
| 1404 |
| 1405 |
| 1369 void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) { | 1406 void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) { |
| 1370 object()->PrintNameTo(stream); | 1407 object()->PrintNameTo(stream); |
| 1371 stream->Add("["); | 1408 stream->Add("["); |
| 1372 key()->PrintNameTo(stream); | 1409 key()->PrintNameTo(stream); |
| 1373 stream->Add("]"); | 1410 stream->Add("]"); |
| 1374 } | 1411 } |
| 1375 | 1412 |
| 1376 | 1413 |
| 1377 void HLoadKeyedSpecializedArrayElement::PrintDataTo( | 1414 void HLoadKeyedSpecializedArrayElement::PrintDataTo( |
| 1378 StringStream* stream) { | 1415 StringStream* stream) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1444 | 1481 |
| 1445 void HStoreKeyedFastElement::PrintDataTo(StringStream* stream) { | 1482 void HStoreKeyedFastElement::PrintDataTo(StringStream* stream) { |
| 1446 object()->PrintNameTo(stream); | 1483 object()->PrintNameTo(stream); |
| 1447 stream->Add("["); | 1484 stream->Add("["); |
| 1448 key()->PrintNameTo(stream); | 1485 key()->PrintNameTo(stream); |
| 1449 stream->Add("] = "); | 1486 stream->Add("] = "); |
| 1450 value()->PrintNameTo(stream); | 1487 value()->PrintNameTo(stream); |
| 1451 } | 1488 } |
| 1452 | 1489 |
| 1453 | 1490 |
| 1491 void HStoreKeyedFastDoubleElement::PrintDataTo(StringStream* stream) { |
| 1492 elements()->PrintNameTo(stream); |
| 1493 stream->Add("["); |
| 1494 key()->PrintNameTo(stream); |
| 1495 stream->Add("] = "); |
| 1496 value()->PrintNameTo(stream); |
| 1497 } |
| 1498 |
| 1499 |
| 1454 void HStoreKeyedGeneric::PrintDataTo(StringStream* stream) { | 1500 void HStoreKeyedGeneric::PrintDataTo(StringStream* stream) { |
| 1455 object()->PrintNameTo(stream); | 1501 object()->PrintNameTo(stream); |
| 1456 stream->Add("["); | 1502 stream->Add("["); |
| 1457 key()->PrintNameTo(stream); | 1503 key()->PrintNameTo(stream); |
| 1458 stream->Add("] = "); | 1504 stream->Add("] = "); |
| 1459 value()->PrintNameTo(stream); | 1505 value()->PrintNameTo(stream); |
| 1460 } | 1506 } |
| 1461 | 1507 |
| 1462 | 1508 |
| 1463 void HStoreKeyedSpecializedArrayElement::PrintDataTo( | 1509 void HStoreKeyedSpecializedArrayElement::PrintDataTo( |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1769 } | 1815 } |
| 1770 } | 1816 } |
| 1771 | 1817 |
| 1772 | 1818 |
| 1773 void HSimulate::Verify() { | 1819 void HSimulate::Verify() { |
| 1774 HInstruction::Verify(); | 1820 HInstruction::Verify(); |
| 1775 ASSERT(HasAstId()); | 1821 ASSERT(HasAstId()); |
| 1776 } | 1822 } |
| 1777 | 1823 |
| 1778 | 1824 |
| 1779 void HBoundsCheck::Verify() { | |
| 1780 HInstruction::Verify(); | |
| 1781 } | |
| 1782 | |
| 1783 | |
| 1784 void HCheckSmi::Verify() { | 1825 void HCheckSmi::Verify() { |
| 1785 HInstruction::Verify(); | 1826 HInstruction::Verify(); |
| 1786 ASSERT(HasNoUses()); | 1827 ASSERT(HasNoUses()); |
| 1787 } | 1828 } |
| 1788 | 1829 |
| 1789 | 1830 |
| 1790 void HCheckNonSmi::Verify() { | 1831 void HCheckNonSmi::Verify() { |
| 1791 HInstruction::Verify(); | 1832 HInstruction::Verify(); |
| 1792 ASSERT(HasNoUses()); | 1833 ASSERT(HasNoUses()); |
| 1793 } | 1834 } |
| 1794 | 1835 |
| 1795 | 1836 |
| 1796 void HCheckInstanceType::Verify() { | |
| 1797 HInstruction::Verify(); | |
| 1798 ASSERT(HasNoUses()); | |
| 1799 } | |
| 1800 | |
| 1801 | |
| 1802 void HCheckMap::Verify() { | |
| 1803 HInstruction::Verify(); | |
| 1804 ASSERT(HasNoUses()); | |
| 1805 } | |
| 1806 | |
| 1807 | |
| 1808 void HCheckFunction::Verify() { | 1837 void HCheckFunction::Verify() { |
| 1809 HInstruction::Verify(); | 1838 HInstruction::Verify(); |
| 1810 ASSERT(HasNoUses()); | 1839 ASSERT(HasNoUses()); |
| 1811 } | 1840 } |
| 1812 | 1841 |
| 1813 | 1842 |
| 1814 void HCheckPrototypeMaps::Verify() { | 1843 void HCheckPrototypeMaps::Verify() { |
| 1815 HInstruction::Verify(); | 1844 HInstruction::Verify(); |
| 1816 ASSERT(HasNoUses()); | 1845 ASSERT(HasNoUses()); |
| 1817 } | 1846 } |
| 1818 | 1847 |
| 1819 #endif | 1848 #endif |
| 1820 | 1849 |
| 1821 } } // namespace v8::internal | 1850 } } // namespace v8::internal |
| OLD | NEW |