Chromium Code Reviews| 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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 634 stream->Add("#%d", argument_count()); | 634 stream->Add("#%d", argument_count()); |
| 635 } | 635 } |
| 636 | 636 |
| 637 | 637 |
| 638 void HBoundsCheck::PrintDataTo(StringStream* stream) { | 638 void HBoundsCheck::PrintDataTo(StringStream* stream) { |
| 639 index()->PrintNameTo(stream); | 639 index()->PrintNameTo(stream); |
| 640 stream->Add(" "); | 640 stream->Add(" "); |
| 641 length()->PrintNameTo(stream); | 641 length()->PrintNameTo(stream); |
| 642 } | 642 } |
| 643 | 643 |
| 644 | |
| 644 void HCallConstantFunction::PrintDataTo(StringStream* stream) { | 645 void HCallConstantFunction::PrintDataTo(StringStream* stream) { |
| 645 if (IsApplyFunction()) { | 646 if (IsApplyFunction()) { |
| 646 stream->Add("optimized apply "); | 647 stream->Add("optimized apply "); |
| 647 } else { | 648 } else { |
| 648 stream->Add("%o ", function()->shared()->DebugName()); | 649 stream->Add("%o ", function()->shared()->DebugName()); |
| 649 } | 650 } |
| 650 stream->Add("#%d", argument_count()); | 651 stream->Add("#%d", argument_count()); |
| 651 } | 652 } |
| 652 | 653 |
| 653 | 654 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 868 | 869 |
| 869 | 870 |
| 870 Range* HValue::InferRange() { | 871 Range* HValue::InferRange() { |
| 871 // Untagged integer32 cannot be -0, all other representations can. | 872 // Untagged integer32 cannot be -0, all other representations can. |
| 872 Range* result = new Range(); | 873 Range* result = new Range(); |
| 873 result->set_can_be_minus_zero(!representation().IsInteger32()); | 874 result->set_can_be_minus_zero(!representation().IsInteger32()); |
| 874 return result; | 875 return result; |
| 875 } | 876 } |
| 876 | 877 |
| 877 | 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 return input_range != NULL ? input_range->Copy() : HValue::InferRange(); | |
|
Vyacheslav Egorov (Chromium)
2011/08/22 12:53:31
It seems that if we are converting to integer type
fschneider
2011/08/23 07:36:10
Done.
| |
| 887 } | |
| 888 | |
| 889 | |
| 878 Range* HConstant::InferRange() { | 890 Range* HConstant::InferRange() { |
| 879 if (has_int32_value_) { | 891 if (has_int32_value_) { |
| 880 Range* result = new Range(int32_value_, int32_value_); | 892 Range* result = new Range(int32_value_, int32_value_); |
| 881 result->set_can_be_minus_zero(false); | 893 result->set_can_be_minus_zero(false); |
| 882 return result; | 894 return result; |
| 883 } | 895 } |
| 884 return HValue::InferRange(); | 896 return HValue::InferRange(); |
| 885 } | 897 } |
| 886 | 898 |
| 887 | 899 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1213 | 1225 |
| 1214 | 1226 |
| 1215 Range* HSar::InferRange() { | 1227 Range* HSar::InferRange() { |
| 1216 if (right()->IsConstant()) { | 1228 if (right()->IsConstant()) { |
| 1217 HConstant* c = HConstant::cast(right()); | 1229 HConstant* c = HConstant::cast(right()); |
| 1218 if (c->HasInteger32Value()) { | 1230 if (c->HasInteger32Value()) { |
| 1219 Range* result = (left()->range() != NULL) | 1231 Range* result = (left()->range() != NULL) |
| 1220 ? left()->range()->Copy() | 1232 ? left()->range()->Copy() |
| 1221 : new Range(); | 1233 : new Range(); |
| 1222 result->Sar(c->Integer32Value()); | 1234 result->Sar(c->Integer32Value()); |
| 1235 result->set_can_be_minus_zero(false); | |
| 1223 return result; | 1236 return result; |
| 1224 } | 1237 } |
| 1225 } | 1238 } |
| 1226 return HValue::InferRange(); | 1239 return HValue::InferRange(); |
| 1227 } | 1240 } |
| 1228 | 1241 |
| 1229 | 1242 |
| 1230 Range* HShr::InferRange() { | 1243 Range* HShr::InferRange() { |
| 1231 if (right()->IsConstant()) { | 1244 if (right()->IsConstant()) { |
| 1232 HConstant* c = HConstant::cast(right()); | 1245 HConstant* c = HConstant::cast(right()); |
| 1233 if (c->HasInteger32Value()) { | 1246 if (c->HasInteger32Value()) { |
| 1234 int shift_count = c->Integer32Value() & 0x1f; | 1247 int shift_count = c->Integer32Value() & 0x1f; |
| 1235 if (left()->range()->CanBeNegative()) { | 1248 if (left()->range()->CanBeNegative()) { |
| 1236 // Only compute bounds if the result always fits into an int32. | 1249 // Only compute bounds if the result always fits into an int32. |
| 1237 return (shift_count >= 1) | 1250 return (shift_count >= 1) |
| 1238 ? new Range(0, static_cast<uint32_t>(0xffffffff) >> shift_count) | 1251 ? new Range(0, static_cast<uint32_t>(0xffffffff) >> shift_count) |
| 1239 : new Range(); | 1252 : new Range(); |
| 1240 } else { | 1253 } else { |
| 1241 // For positive inputs we can use the >> operator. | 1254 // For positive inputs we can use the >> operator. |
| 1242 Range* result = (left()->range() != NULL) | 1255 Range* result = (left()->range() != NULL) |
| 1243 ? left()->range()->Copy() | 1256 ? left()->range()->Copy() |
| 1244 : new Range(); | 1257 : new Range(); |
| 1245 result->Sar(c->Integer32Value()); | 1258 result->Sar(c->Integer32Value()); |
| 1259 result->set_can_be_minus_zero(false); | |
| 1246 return result; | 1260 return result; |
| 1247 } | 1261 } |
| 1248 } | 1262 } |
| 1249 } | 1263 } |
| 1250 return HValue::InferRange(); | 1264 return HValue::InferRange(); |
| 1251 } | 1265 } |
| 1252 | 1266 |
| 1253 | 1267 |
| 1254 Range* HShl::InferRange() { | 1268 Range* HShl::InferRange() { |
| 1255 if (right()->IsConstant()) { | 1269 if (right()->IsConstant()) { |
| 1256 HConstant* c = HConstant::cast(right()); | 1270 HConstant* c = HConstant::cast(right()); |
| 1257 if (c->HasInteger32Value()) { | 1271 if (c->HasInteger32Value()) { |
| 1258 Range* result = (left()->range() != NULL) | 1272 Range* result = (left()->range() != NULL) |
| 1259 ? left()->range()->Copy() | 1273 ? left()->range()->Copy() |
| 1260 : new Range(); | 1274 : new Range(); |
| 1261 result->Shl(c->Integer32Value()); | 1275 result->Shl(c->Integer32Value()); |
| 1276 result->set_can_be_minus_zero(false); | |
| 1262 return result; | 1277 return result; |
| 1263 } | 1278 } |
| 1264 } | 1279 } |
| 1265 return HValue::InferRange(); | 1280 return HValue::InferRange(); |
| 1266 } | 1281 } |
| 1267 | 1282 |
| 1268 | 1283 |
| 1269 | 1284 |
| 1270 void HCompareGeneric::PrintDataTo(StringStream* stream) { | 1285 void HCompareGeneric::PrintDataTo(StringStream* stream) { |
| 1271 stream->Add(Token::Name(token())); | 1286 stream->Add(Token::Name(token())); |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1852 | 1867 |
| 1853 | 1868 |
| 1854 void HCheckPrototypeMaps::Verify() { | 1869 void HCheckPrototypeMaps::Verify() { |
| 1855 HInstruction::Verify(); | 1870 HInstruction::Verify(); |
| 1856 ASSERT(HasNoUses()); | 1871 ASSERT(HasNoUses()); |
| 1857 } | 1872 } |
| 1858 | 1873 |
| 1859 #endif | 1874 #endif |
| 1860 | 1875 |
| 1861 } } // namespace v8::internal | 1876 } } // namespace v8::internal |
| OLD | NEW |