OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 } | 753 } |
754 | 754 |
755 | 755 |
756 void HBoundsCheck::PrintDataTo(StringStream* stream) { | 756 void HBoundsCheck::PrintDataTo(StringStream* stream) { |
757 index()->PrintNameTo(stream); | 757 index()->PrintNameTo(stream); |
758 stream->Add(" "); | 758 stream->Add(" "); |
759 length()->PrintNameTo(stream); | 759 length()->PrintNameTo(stream); |
760 } | 760 } |
761 | 761 |
762 | 762 |
| 763 void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) { |
| 764 ASSERT(CheckFlag(kFlexibleRepresentation)); |
| 765 Representation r; |
| 766 if (key_mode_ == DONT_ALLOW_SMI_KEY || |
| 767 !length()->representation().IsTagged()) { |
| 768 r = Representation::Integer32(); |
| 769 } else if (index()->representation().IsTagged() || |
| 770 (index()->IsConstant() && |
| 771 HConstant::cast(index())->HasInteger32Value() && |
| 772 Smi::IsValid(HConstant::cast(index())->Integer32Value()))) { |
| 773 // If the index is tagged, or a constant that holds a Smi, allow the length |
| 774 // to be tagged, since it is usually already tagged from loading it out of |
| 775 // the length field of a JSArray. This allows for direct comparison without |
| 776 // untagging. |
| 777 r = Representation::Tagged(); |
| 778 } else { |
| 779 r = Representation::Integer32(); |
| 780 } |
| 781 UpdateRepresentation(r, h_infer, "boundscheck"); |
| 782 } |
| 783 |
| 784 |
763 void HCallConstantFunction::PrintDataTo(StringStream* stream) { | 785 void HCallConstantFunction::PrintDataTo(StringStream* stream) { |
764 if (IsApplyFunction()) { | 786 if (IsApplyFunction()) { |
765 stream->Add("optimized apply "); | 787 stream->Add("optimized apply "); |
766 } else { | 788 } else { |
767 stream->Add("%o ", function()->shared()->DebugName()); | 789 stream->Add("%o ", function()->shared()->DebugName()); |
768 } | 790 } |
769 stream->Add("#%d", argument_count()); | 791 stream->Add("#%d", argument_count()); |
770 } | 792 } |
771 | 793 |
772 | 794 |
(...skipping 2019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2792 | 2814 |
2793 | 2815 |
2794 void HCheckFunction::Verify() { | 2816 void HCheckFunction::Verify() { |
2795 HInstruction::Verify(); | 2817 HInstruction::Verify(); |
2796 ASSERT(HasNoUses()); | 2818 ASSERT(HasNoUses()); |
2797 } | 2819 } |
2798 | 2820 |
2799 #endif | 2821 #endif |
2800 | 2822 |
2801 } } // namespace v8::internal | 2823 } } // namespace v8::internal |
OLD | NEW |