| 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(HInferRepresentation* h_infer) { |
| 2395 ASSERT(CheckFlag(kFlexibleRepresentation)); |
| 2396 Representation r = value()->representation().IsTagged() |
| 2397 ? Representation::Tagged() : Representation::Integer32(); |
| 2398 UpdateRepresentation(r, h_infer, "checksmiorint32"); |
| 2399 } |
| 2400 |
| 2401 |
| 2395 HType HPhi::CalculateInferredType() { | 2402 HType HPhi::CalculateInferredType() { |
| 2396 HType result = HType::Uninitialized(); | 2403 HType result = HType::Uninitialized(); |
| 2397 for (int i = 0; i < OperandCount(); ++i) { | 2404 for (int i = 0; i < OperandCount(); ++i) { |
| 2398 HType current = OperandAt(i)->type(); | 2405 HType current = OperandAt(i)->type(); |
| 2399 result = result.Combine(current); | 2406 result = result.Combine(current); |
| 2400 } | 2407 } |
| 2401 return result; | 2408 return result; |
| 2402 } | 2409 } |
| 2403 | 2410 |
| 2404 | 2411 |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2934 | 2941 |
| 2935 | 2942 |
| 2936 void HCheckFunction::Verify() { | 2943 void HCheckFunction::Verify() { |
| 2937 HInstruction::Verify(); | 2944 HInstruction::Verify(); |
| 2938 ASSERT(HasNoUses()); | 2945 ASSERT(HasNoUses()); |
| 2939 } | 2946 } |
| 2940 | 2947 |
| 2941 #endif | 2948 #endif |
| 2942 | 2949 |
| 2943 } } // namespace v8::internal | 2950 } } // namespace v8::internal |
| OLD | NEW |