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 | |
785 void HCallConstantFunction::PrintDataTo(StringStream* stream) { | 763 void HCallConstantFunction::PrintDataTo(StringStream* stream) { |
786 if (IsApplyFunction()) { | 764 if (IsApplyFunction()) { |
787 stream->Add("optimized apply "); | 765 stream->Add("optimized apply "); |
788 } else { | 766 } else { |
789 stream->Add("%o ", function()->shared()->DebugName()); | 767 stream->Add("%o ", function()->shared()->DebugName()); |
790 } | 768 } |
791 stream->Add("#%d", argument_count()); | 769 stream->Add("#%d", argument_count()); |
792 } | 770 } |
793 | 771 |
794 | 772 |
(...skipping 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2821 | 2799 |
2822 | 2800 |
2823 void HCheckFunction::Verify() { | 2801 void HCheckFunction::Verify() { |
2824 HInstruction::Verify(); | 2802 HInstruction::Verify(); |
2825 ASSERT(HasNoUses()); | 2803 ASSERT(HasNoUses()); |
2826 } | 2804 } |
2827 | 2805 |
2828 #endif | 2806 #endif |
2829 | 2807 |
2830 } } // namespace v8::internal | 2808 } } // namespace v8::internal |
OLD | NEW |