| 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 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 } | 767 } |
| 768 | 768 |
| 769 | 769 |
| 770 void HBoundsCheck::PrintDataTo(StringStream* stream) { | 770 void HBoundsCheck::PrintDataTo(StringStream* stream) { |
| 771 index()->PrintNameTo(stream); | 771 index()->PrintNameTo(stream); |
| 772 stream->Add(" "); | 772 stream->Add(" "); |
| 773 length()->PrintNameTo(stream); | 773 length()->PrintNameTo(stream); |
| 774 } | 774 } |
| 775 | 775 |
| 776 | 776 |
| 777 void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) { |
| 778 ASSERT(CheckFlag(kFlexibleRepresentation)); |
| 779 Representation r; |
| 780 if (key_mode_ == DONT_ALLOW_SMI_KEY || |
| 781 !length()->representation().IsTagged()) { |
| 782 r = Representation::Integer32(); |
| 783 } else if (index()->representation().IsTagged() || |
| 784 (index()->IsConstant() && |
| 785 HConstant::cast(index())->HasInteger32Value() && |
| 786 Smi::IsValid(HConstant::cast(index())->Integer32Value()))) { |
| 787 // If the index is tagged, or a constant that holds a Smi, allow the length |
| 788 // to be tagged, since it is usually already tagged from loading it out of |
| 789 // the length field of a JSArray. This allows for direct comparison without |
| 790 // untagging. |
| 791 r = Representation::Tagged(); |
| 792 } else { |
| 793 r = Representation::Integer32(); |
| 794 } |
| 795 UpdateRepresentation(r, h_infer, "boundscheck"); |
| 796 } |
| 797 |
| 798 |
| 777 void HCallConstantFunction::PrintDataTo(StringStream* stream) { | 799 void HCallConstantFunction::PrintDataTo(StringStream* stream) { |
| 778 if (IsApplyFunction()) { | 800 if (IsApplyFunction()) { |
| 779 stream->Add("optimized apply "); | 801 stream->Add("optimized apply "); |
| 780 } else { | 802 } else { |
| 781 stream->Add("%o ", function()->shared()->DebugName()); | 803 stream->Add("%o ", function()->shared()->DebugName()); |
| 782 } | 804 } |
| 783 stream->Add("#%d", argument_count()); | 805 stream->Add("#%d", argument_count()); |
| 784 } | 806 } |
| 785 | 807 |
| 786 | 808 |
| (...skipping 2052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2839 | 2861 |
| 2840 | 2862 |
| 2841 void HCheckFunction::Verify() { | 2863 void HCheckFunction::Verify() { |
| 2842 HInstruction::Verify(); | 2864 HInstruction::Verify(); |
| 2843 ASSERT(HasNoUses()); | 2865 ASSERT(HasNoUses()); |
| 2844 } | 2866 } |
| 2845 | 2867 |
| 2846 #endif | 2868 #endif |
| 2847 | 2869 |
| 2848 } } // namespace v8::internal | 2870 } } // namespace v8::internal |
| OLD | NEW |