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 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
822 } | 822 } |
823 | 823 |
824 | 824 |
825 void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) { | 825 void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) { |
826 ASSERT(CheckFlag(kFlexibleRepresentation)); | 826 ASSERT(CheckFlag(kFlexibleRepresentation)); |
827 Representation r; | 827 Representation r; |
828 if (key_mode_ == DONT_ALLOW_SMI_KEY || | 828 if (key_mode_ == DONT_ALLOW_SMI_KEY || |
829 !length()->representation().IsTagged()) { | 829 !length()->representation().IsTagged()) { |
830 r = Representation::Integer32(); | 830 r = Representation::Integer32(); |
831 } else if (index()->representation().IsTagged() || | 831 } else if (index()->representation().IsTagged() || |
832 (index()->IsConstant() && | 832 (index()->ActualValue()->IsConstant() && |
833 HConstant::cast(index())->HasInteger32Value() && | 833 HConstant::cast(index()->ActualValue())->HasSmiValue())) { |
834 Smi::IsValid(HConstant::cast(index())->Integer32Value()))) { | |
835 // If the index is tagged, or a constant that holds a Smi, allow the length | 834 // If the index is tagged, or a constant that holds a Smi, allow the length |
836 // to be tagged, since it is usually already tagged from loading it out of | 835 // to be tagged, since it is usually already tagged from loading it out of |
837 // the length field of a JSArray. This allows for direct comparison without | 836 // the length field of a JSArray. This allows for direct comparison without |
838 // untagging. | 837 // untagging. |
839 r = Representation::Tagged(); | 838 r = Representation::Tagged(); |
840 } else { | 839 } else { |
841 r = Representation::Integer32(); | 840 r = Representation::Integer32(); |
842 } | 841 } |
843 UpdateRepresentation(r, h_infer, "boundscheck"); | 842 UpdateRepresentation(r, h_infer, "boundscheck"); |
844 } | 843 } |
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2385 // TODO(kasperl): Is there any way to signal that this isn't a smi? | 2384 // TODO(kasperl): Is there any way to signal that this isn't a smi? |
2386 return HType::Tagged(); | 2385 return HType::Tagged(); |
2387 } | 2386 } |
2388 | 2387 |
2389 | 2388 |
2390 HType HCheckSmi::CalculateInferredType() { | 2389 HType HCheckSmi::CalculateInferredType() { |
2391 return HType::Smi(); | 2390 return HType::Smi(); |
2392 } | 2391 } |
2393 | 2392 |
2394 | 2393 |
2394 void HCheckSmiOrInt32::InferRepresentation( | |
2395 HInferRepresentation* h_infer) { | |
Jakob Kummerow
2013/02/07 16:17:14
nit: fits on one line now.
Massi
2013/02/11 10:35:55
Done.
| |
2396 ASSERT(CheckFlag(kFlexibleRepresentation)); | |
2397 Representation r = value()->representation().IsTagged() | |
2398 ? Representation::Tagged() : Representation::Integer32(); | |
2399 UpdateRepresentation(r, h_infer, "checksmiorint32"); | |
2400 } | |
2401 | |
2402 | |
2395 HType HPhi::CalculateInferredType() { | 2403 HType HPhi::CalculateInferredType() { |
2396 HType result = HType::Uninitialized(); | 2404 HType result = HType::Uninitialized(); |
2397 for (int i = 0; i < OperandCount(); ++i) { | 2405 for (int i = 0; i < OperandCount(); ++i) { |
2398 HType current = OperandAt(i)->type(); | 2406 HType current = OperandAt(i)->type(); |
2399 result = result.Combine(current); | 2407 result = result.Combine(current); |
2400 } | 2408 } |
2401 return result; | 2409 return result; |
2402 } | 2410 } |
2403 | 2411 |
2404 | 2412 |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2920 ASSERT(HasAstId()); | 2928 ASSERT(HasAstId()); |
2921 } | 2929 } |
2922 | 2930 |
2923 | 2931 |
2924 void HCheckSmi::Verify() { | 2932 void HCheckSmi::Verify() { |
2925 HInstruction::Verify(); | 2933 HInstruction::Verify(); |
2926 ASSERT(HasNoUses()); | 2934 ASSERT(HasNoUses()); |
2927 } | 2935 } |
2928 | 2936 |
2929 | 2937 |
2938 void HCheckSmiOrInt32::Verify() { | |
2939 HInstruction::Verify(); | |
2940 } | |
2941 | |
2942 | |
2930 void HCheckNonSmi::Verify() { | 2943 void HCheckNonSmi::Verify() { |
2931 HInstruction::Verify(); | 2944 HInstruction::Verify(); |
2932 ASSERT(HasNoUses()); | 2945 ASSERT(HasNoUses()); |
2933 } | 2946 } |
2934 | 2947 |
2935 | 2948 |
2936 void HCheckFunction::Verify() { | 2949 void HCheckFunction::Verify() { |
2937 HInstruction::Verify(); | 2950 HInstruction::Verify(); |
2938 ASSERT(HasNoUses()); | 2951 ASSERT(HasNoUses()); |
2939 } | 2952 } |
2940 | 2953 |
2941 #endif | 2954 #endif |
2942 | 2955 |
2943 } } // namespace v8::internal | 2956 } } // namespace v8::internal |
OLD | NEW |