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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 } else { | 474 } else { |
475 removed->set_tail(new_value->use_list_); | 475 removed->set_tail(new_value->use_list_); |
476 new_value->use_list_ = removed; | 476 new_value->use_list_ = removed; |
477 } | 477 } |
478 } | 478 } |
479 } | 479 } |
480 | 480 |
481 | 481 |
482 void HValue::AddNewRange(Range* r) { | 482 void HValue::AddNewRange(Range* r) { |
483 if (!HasRange()) ComputeInitialRange(); | 483 if (!HasRange()) ComputeInitialRange(); |
| 484 if (!HasRange()) range_ = new Range(); |
484 ASSERT(HasRange()); | 485 ASSERT(HasRange()); |
485 r->StackUpon(range_); | 486 r->StackUpon(range_); |
486 range_ = r; | 487 range_ = r; |
487 } | 488 } |
488 | 489 |
489 | 490 |
490 void HValue::RemoveLastAddedRange() { | 491 void HValue::RemoveLastAddedRange() { |
491 ASSERT(HasRange()); | 492 ASSERT(HasRange()); |
492 ASSERT(range_->next() != NULL); | 493 ASSERT(range_->next() != NULL); |
493 range_ = range_->next(); | 494 range_ = range_->next(); |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 void HInstanceOf::PrintDataTo(StringStream* stream) { | 855 void HInstanceOf::PrintDataTo(StringStream* stream) { |
855 left()->PrintNameTo(stream); | 856 left()->PrintNameTo(stream); |
856 stream->Add(" "); | 857 stream->Add(" "); |
857 right()->PrintNameTo(stream); | 858 right()->PrintNameTo(stream); |
858 stream->Add(" "); | 859 stream->Add(" "); |
859 context()->PrintNameTo(stream); | 860 context()->PrintNameTo(stream); |
860 } | 861 } |
861 | 862 |
862 | 863 |
863 Range* HValue::InferRange() { | 864 Range* HValue::InferRange() { |
864 if (representation().IsInteger32()) { | 865 if (representation().IsTagged()) { |
865 // Untagged integer32 cannot be -0. | 866 // Tagged values are always in int32 range when converted to integer, |
866 return new Range (); | 867 // but they can contain -0. |
867 } else { | |
868 // Tagged values, untagged doubles, and values with unknown representation | |
869 // can contain -0. | |
870 Range* result = new Range(); | 868 Range* result = new Range(); |
871 result->set_can_be_minus_zero(true); | 869 result->set_can_be_minus_zero(true); |
872 return result; | 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(); |
873 } | 877 } |
874 } | 878 } |
875 | 879 |
876 | 880 |
877 Range* HConstant::InferRange() { | 881 Range* HConstant::InferRange() { |
878 if (has_int32_value_) { | 882 if (has_int32_value_) { |
879 return new Range(int32_value_, int32_value_); | 883 Range* result = new Range(int32_value_, int32_value_); |
| 884 result->set_can_be_minus_zero(false); |
| 885 return result; |
880 } | 886 } |
881 return HValue::InferRange(); | 887 return HValue::InferRange(); |
882 } | 888 } |
883 | 889 |
884 | 890 |
885 Range* HPhi::InferRange() { | 891 Range* HPhi::InferRange() { |
886 if (representation().IsInteger32()) { | 892 if (representation().IsInteger32()) { |
887 if (block()->IsLoopHeader()) { | 893 if (block()->IsLoopHeader()) { |
888 return new Range(); | 894 Range* range = new Range(kMinInt, kMaxInt); |
| 895 return range; |
889 } else { | 896 } else { |
890 Range* range = OperandAt(0)->range()->Copy(); | 897 Range* range = OperandAt(0)->range()->Copy(); |
891 for (int i = 1; i < OperandCount(); ++i) { | 898 for (int i = 1; i < OperandCount(); ++i) { |
892 range->Union(OperandAt(i)->range()); | 899 range->Union(OperandAt(i)->range()); |
893 } | 900 } |
894 return range; | 901 return range; |
895 } | 902 } |
896 } else { | 903 } else { |
897 return HValue::InferRange(); | 904 return HValue::InferRange(); |
898 } | 905 } |
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1834 | 1841 |
1835 | 1842 |
1836 void HCheckPrototypeMaps::Verify() { | 1843 void HCheckPrototypeMaps::Verify() { |
1837 HInstruction::Verify(); | 1844 HInstruction::Verify(); |
1838 ASSERT(HasNoUses()); | 1845 ASSERT(HasNoUses()); |
1839 } | 1846 } |
1840 | 1847 |
1841 #endif | 1848 #endif |
1842 | 1849 |
1843 } } // namespace v8::internal | 1850 } } // namespace v8::internal |
OLD | NEW |