| 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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 | 628 |
| 629 void HBinaryCall::PrintDataTo(StringStream* stream) { | 629 void HBinaryCall::PrintDataTo(StringStream* stream) { |
| 630 first()->PrintNameTo(stream); | 630 first()->PrintNameTo(stream); |
| 631 stream->Add(" "); | 631 stream->Add(" "); |
| 632 second()->PrintNameTo(stream); | 632 second()->PrintNameTo(stream); |
| 633 stream->Add(" "); | 633 stream->Add(" "); |
| 634 stream->Add("#%d", argument_count()); | 634 stream->Add("#%d", argument_count()); |
| 635 } | 635 } |
| 636 | 636 |
| 637 | 637 |
| 638 void HBoundsCheck::PrintDataTo(StringStream* stream) { |
| 639 index()->PrintNameTo(stream); |
| 640 stream->Add(" "); |
| 641 length()->PrintNameTo(stream); |
| 642 } |
| 643 |
| 644 |
| 638 void HCallConstantFunction::PrintDataTo(StringStream* stream) { | 645 void HCallConstantFunction::PrintDataTo(StringStream* stream) { |
| 639 if (IsApplyFunction()) { | 646 if (IsApplyFunction()) { |
| 640 stream->Add("optimized apply "); | 647 stream->Add("optimized apply "); |
| 641 } else { | 648 } else { |
| 642 stream->Add("%o ", function()->shared()->DebugName()); | 649 stream->Add("%o ", function()->shared()->DebugName()); |
| 643 } | 650 } |
| 644 stream->Add("#%d", argument_count()); | 651 stream->Add("#%d", argument_count()); |
| 645 } | 652 } |
| 646 | 653 |
| 647 | 654 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 break; | 771 break; |
| 765 default: | 772 default: |
| 766 break; | 773 break; |
| 767 } | 774 } |
| 768 } | 775 } |
| 769 | 776 |
| 770 | 777 |
| 771 void HTypeofIsAndBranch::PrintDataTo(StringStream* stream) { | 778 void HTypeofIsAndBranch::PrintDataTo(StringStream* stream) { |
| 772 value()->PrintNameTo(stream); | 779 value()->PrintNameTo(stream); |
| 773 stream->Add(" == "); | 780 stream->Add(" == "); |
| 774 stream->Add(type_literal_->ToAsciiVector()); | 781 stream->Add(type_literal_->GetFlatContent().ToAsciiVector()); |
| 775 } | 782 } |
| 776 | 783 |
| 777 | 784 |
| 778 void HChange::PrintDataTo(StringStream* stream) { | 785 void HChange::PrintDataTo(StringStream* stream) { |
| 779 HUnaryOperation::PrintDataTo(stream); | 786 HUnaryOperation::PrintDataTo(stream); |
| 780 stream->Add(" %s to %s", from_.Mnemonic(), to().Mnemonic()); | 787 stream->Add(" %s to %s", from_.Mnemonic(), to().Mnemonic()); |
| 781 | 788 |
| 782 if (CanTruncateToInt32()) stream->Add(" truncating-int32"); | 789 if (CanTruncateToInt32()) stream->Add(" truncating-int32"); |
| 783 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?"); | 790 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?"); |
| 784 } | 791 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 void HInstanceOf::PrintDataTo(StringStream* stream) { | 862 void HInstanceOf::PrintDataTo(StringStream* stream) { |
| 856 left()->PrintNameTo(stream); | 863 left()->PrintNameTo(stream); |
| 857 stream->Add(" "); | 864 stream->Add(" "); |
| 858 right()->PrintNameTo(stream); | 865 right()->PrintNameTo(stream); |
| 859 stream->Add(" "); | 866 stream->Add(" "); |
| 860 context()->PrintNameTo(stream); | 867 context()->PrintNameTo(stream); |
| 861 } | 868 } |
| 862 | 869 |
| 863 | 870 |
| 864 Range* HValue::InferRange() { | 871 Range* HValue::InferRange() { |
| 865 if (representation().IsTagged()) { | 872 // Untagged integer32 cannot be -0, all other representations can. |
| 866 // Tagged values are always in int32 range when converted to integer, | 873 Range* result = new Range(); |
| 867 // but they can contain -0. | 874 result->set_can_be_minus_zero(!representation().IsInteger32()); |
| 868 Range* result = new Range(); | 875 return result; |
| 869 result->set_can_be_minus_zero(true); | |
| 870 return result; | |
| 871 } else if (representation().IsNone()) { | |
| 872 return NULL; | |
| 873 } else { | |
| 874 // Untagged integer32 cannot be -0 and we don't compute ranges for | |
| 875 // untagged doubles. | |
| 876 return new Range(); | |
| 877 } | |
| 878 } | 876 } |
| 879 | 877 |
| 880 | 878 |
| 879 Range* HChange::InferRange() { |
| 880 Range* input_range = value()->range(); |
| 881 if (from().IsInteger32() && |
| 882 to().IsTagged() && |
| 883 input_range != NULL && input_range->IsInSmiRange()) { |
| 884 set_type(HType::Smi()); |
| 885 } |
| 886 Range* result = (input_range != NULL) |
| 887 ? input_range->Copy() |
| 888 : HValue::InferRange(); |
| 889 if (to().IsInteger32()) result->set_can_be_minus_zero(false); |
| 890 return result; |
| 891 } |
| 892 |
| 893 |
| 881 Range* HConstant::InferRange() { | 894 Range* HConstant::InferRange() { |
| 882 if (has_int32_value_) { | 895 if (has_int32_value_) { |
| 883 Range* result = new Range(int32_value_, int32_value_); | 896 Range* result = new Range(int32_value_, int32_value_); |
| 884 result->set_can_be_minus_zero(false); | 897 result->set_can_be_minus_zero(false); |
| 885 return result; | 898 return result; |
| 886 } | 899 } |
| 887 return HValue::InferRange(); | 900 return HValue::InferRange(); |
| 888 } | 901 } |
| 889 | 902 |
| 890 | 903 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 | 1229 |
| 1217 | 1230 |
| 1218 Range* HSar::InferRange() { | 1231 Range* HSar::InferRange() { |
| 1219 if (right()->IsConstant()) { | 1232 if (right()->IsConstant()) { |
| 1220 HConstant* c = HConstant::cast(right()); | 1233 HConstant* c = HConstant::cast(right()); |
| 1221 if (c->HasInteger32Value()) { | 1234 if (c->HasInteger32Value()) { |
| 1222 Range* result = (left()->range() != NULL) | 1235 Range* result = (left()->range() != NULL) |
| 1223 ? left()->range()->Copy() | 1236 ? left()->range()->Copy() |
| 1224 : new Range(); | 1237 : new Range(); |
| 1225 result->Sar(c->Integer32Value()); | 1238 result->Sar(c->Integer32Value()); |
| 1239 result->set_can_be_minus_zero(false); |
| 1226 return result; | 1240 return result; |
| 1227 } | 1241 } |
| 1228 } | 1242 } |
| 1229 return HValue::InferRange(); | 1243 return HValue::InferRange(); |
| 1230 } | 1244 } |
| 1231 | 1245 |
| 1232 | 1246 |
| 1233 Range* HShr::InferRange() { | 1247 Range* HShr::InferRange() { |
| 1234 if (right()->IsConstant()) { | 1248 if (right()->IsConstant()) { |
| 1235 HConstant* c = HConstant::cast(right()); | 1249 HConstant* c = HConstant::cast(right()); |
| 1236 if (c->HasInteger32Value()) { | 1250 if (c->HasInteger32Value()) { |
| 1237 int shift_count = c->Integer32Value() & 0x1f; | 1251 int shift_count = c->Integer32Value() & 0x1f; |
| 1238 if (left()->range()->CanBeNegative()) { | 1252 if (left()->range()->CanBeNegative()) { |
| 1239 // Only compute bounds if the result always fits into an int32. | 1253 // Only compute bounds if the result always fits into an int32. |
| 1240 return (shift_count >= 1) | 1254 return (shift_count >= 1) |
| 1241 ? new Range(0, static_cast<uint32_t>(0xffffffff) >> shift_count) | 1255 ? new Range(0, static_cast<uint32_t>(0xffffffff) >> shift_count) |
| 1242 : new Range(); | 1256 : new Range(); |
| 1243 } else { | 1257 } else { |
| 1244 // For positive inputs we can use the >> operator. | 1258 // For positive inputs we can use the >> operator. |
| 1245 Range* result = (left()->range() != NULL) | 1259 Range* result = (left()->range() != NULL) |
| 1246 ? left()->range()->Copy() | 1260 ? left()->range()->Copy() |
| 1247 : new Range(); | 1261 : new Range(); |
| 1248 result->Sar(c->Integer32Value()); | 1262 result->Sar(c->Integer32Value()); |
| 1263 result->set_can_be_minus_zero(false); |
| 1249 return result; | 1264 return result; |
| 1250 } | 1265 } |
| 1251 } | 1266 } |
| 1252 } | 1267 } |
| 1253 return HValue::InferRange(); | 1268 return HValue::InferRange(); |
| 1254 } | 1269 } |
| 1255 | 1270 |
| 1256 | 1271 |
| 1257 Range* HShl::InferRange() { | 1272 Range* HShl::InferRange() { |
| 1258 if (right()->IsConstant()) { | 1273 if (right()->IsConstant()) { |
| 1259 HConstant* c = HConstant::cast(right()); | 1274 HConstant* c = HConstant::cast(right()); |
| 1260 if (c->HasInteger32Value()) { | 1275 if (c->HasInteger32Value()) { |
| 1261 Range* result = (left()->range() != NULL) | 1276 Range* result = (left()->range() != NULL) |
| 1262 ? left()->range()->Copy() | 1277 ? left()->range()->Copy() |
| 1263 : new Range(); | 1278 : new Range(); |
| 1264 result->Shl(c->Integer32Value()); | 1279 result->Shl(c->Integer32Value()); |
| 1280 result->set_can_be_minus_zero(false); |
| 1265 return result; | 1281 return result; |
| 1266 } | 1282 } |
| 1267 } | 1283 } |
| 1268 return HValue::InferRange(); | 1284 return HValue::InferRange(); |
| 1269 } | 1285 } |
| 1270 | 1286 |
| 1271 | 1287 |
| 1272 | 1288 |
| 1273 void HCompareGeneric::PrintDataTo(StringStream* stream) { | 1289 void HCompareGeneric::PrintDataTo(StringStream* stream) { |
| 1274 stream->Add(Token::Name(token())); | 1290 stream->Add(Token::Name(token())); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1302 | 1318 |
| 1303 | 1319 |
| 1304 void HLoadNamedField::PrintDataTo(StringStream* stream) { | 1320 void HLoadNamedField::PrintDataTo(StringStream* stream) { |
| 1305 object()->PrintNameTo(stream); | 1321 object()->PrintNameTo(stream); |
| 1306 stream->Add(" @%d%s", offset(), is_in_object() ? "[in-object]" : ""); | 1322 stream->Add(" @%d%s", offset(), is_in_object() ? "[in-object]" : ""); |
| 1307 } | 1323 } |
| 1308 | 1324 |
| 1309 | 1325 |
| 1310 HLoadNamedFieldPolymorphic::HLoadNamedFieldPolymorphic(HValue* context, | 1326 HLoadNamedFieldPolymorphic::HLoadNamedFieldPolymorphic(HValue* context, |
| 1311 HValue* object, | 1327 HValue* object, |
| 1312 ZoneMapList* types, | 1328 SmallMapList* types, |
| 1313 Handle<String> name) | 1329 Handle<String> name) |
| 1314 : types_(Min(types->length(), kMaxLoadPolymorphism)), | 1330 : types_(Min(types->length(), kMaxLoadPolymorphism)), |
| 1315 name_(name), | 1331 name_(name), |
| 1316 need_generic_(false) { | 1332 need_generic_(false) { |
| 1317 SetOperandAt(0, context); | 1333 SetOperandAt(0, context); |
| 1318 SetOperandAt(1, object); | 1334 SetOperandAt(1, object); |
| 1319 set_representation(Representation::Tagged()); | 1335 set_representation(Representation::Tagged()); |
| 1320 SetFlag(kDependsOnMaps); | 1336 SetFlag(kDependsOnMaps); |
| 1321 for (int i = 0; | 1337 for (int i = 0; |
| 1322 i < types->length() && types_.length() < kMaxLoadPolymorphism; | 1338 i < types->length() && types_.length() < kMaxLoadPolymorphism; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 found = true; | 1382 found = true; |
| 1367 break; | 1383 break; |
| 1368 } | 1384 } |
| 1369 } | 1385 } |
| 1370 if (!found) return false; | 1386 if (!found) return false; |
| 1371 } | 1387 } |
| 1372 return true; | 1388 return true; |
| 1373 } | 1389 } |
| 1374 | 1390 |
| 1375 | 1391 |
| 1392 void HLoadNamedFieldPolymorphic::PrintDataTo(StringStream* stream) { |
| 1393 object()->PrintNameTo(stream); |
| 1394 stream->Add(" ."); |
| 1395 stream->Add(*String::cast(*name())->ToCString()); |
| 1396 } |
| 1397 |
| 1398 |
| 1399 void HLoadNamedGeneric::PrintDataTo(StringStream* stream) { |
| 1400 object()->PrintNameTo(stream); |
| 1401 stream->Add(" ."); |
| 1402 stream->Add(*String::cast(*name())->ToCString()); |
| 1403 } |
| 1404 |
| 1405 |
| 1376 void HLoadKeyedFastElement::PrintDataTo(StringStream* stream) { | 1406 void HLoadKeyedFastElement::PrintDataTo(StringStream* stream) { |
| 1377 object()->PrintNameTo(stream); | 1407 object()->PrintNameTo(stream); |
| 1378 stream->Add("["); | 1408 stream->Add("["); |
| 1379 key()->PrintNameTo(stream); | 1409 key()->PrintNameTo(stream); |
| 1380 stream->Add("]"); | 1410 stream->Add("]"); |
| 1381 } | 1411 } |
| 1382 | 1412 |
| 1383 | 1413 |
| 1384 bool HLoadKeyedFastElement::RequiresHoleCheck() const { | 1414 bool HLoadKeyedFastElement::RequiresHoleCheck() const { |
| 1385 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { | 1415 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1841 | 1871 |
| 1842 | 1872 |
| 1843 void HCheckPrototypeMaps::Verify() { | 1873 void HCheckPrototypeMaps::Verify() { |
| 1844 HInstruction::Verify(); | 1874 HInstruction::Verify(); |
| 1845 ASSERT(HasNoUses()); | 1875 ASSERT(HasNoUses()); |
| 1846 } | 1876 } |
| 1847 | 1877 |
| 1848 #endif | 1878 #endif |
| 1849 | 1879 |
| 1850 } } // namespace v8::internal | 1880 } } // namespace v8::internal |
| OLD | NEW |