| 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 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 } | 1136 } |
| 1137 } | 1137 } |
| 1138 | 1138 |
| 1139 | 1139 |
| 1140 void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) { | 1140 void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) { |
| 1141 ASSERT(CheckFlag(kFlexibleRepresentation)); | 1141 ASSERT(CheckFlag(kFlexibleRepresentation)); |
| 1142 Representation r; | 1142 Representation r; |
| 1143 HValue* actual_length = length()->ActualValue(); | 1143 HValue* actual_length = length()->ActualValue(); |
| 1144 HValue* actual_index = index()->ActualValue(); | 1144 HValue* actual_index = index()->ActualValue(); |
| 1145 if (key_mode_ == DONT_ALLOW_SMI_KEY || | 1145 if (key_mode_ == DONT_ALLOW_SMI_KEY || |
| 1146 !actual_length->representation().IsTagged()) { | 1146 !actual_length->representation().IsSmiOrTagged()) { |
| 1147 r = Representation::Integer32(); | 1147 r = Representation::Integer32(); |
| 1148 } else if (actual_index->representation().IsTagged() || | 1148 } else if (actual_index->representation().IsSmiOrTagged() || |
| 1149 (actual_index->IsConstant() && | 1149 (actual_index->IsConstant() && |
| 1150 HConstant::cast(actual_index)->HasSmiValue())) { | 1150 HConstant::cast(actual_index)->HasSmiValue())) { |
| 1151 // If the index is tagged, or a constant that holds a Smi, allow the length | 1151 // If the index is smi, or a constant that holds a Smi, allow the length to |
| 1152 // to be tagged, since it is usually already tagged from loading it out of | 1152 // be smi, since it is usually already smi from loading it out of the length |
| 1153 // the length field of a JSArray. This allows for direct comparison without | 1153 // field of a JSArray. This allows for direct comparison without untagging. |
| 1154 // untagging. | 1154 r = Representation::Smi(); |
| 1155 r = Representation::Tagged(); | |
| 1156 } else { | 1155 } else { |
| 1157 r = Representation::Integer32(); | 1156 r = Representation::Integer32(); |
| 1158 } | 1157 } |
| 1159 UpdateRepresentation(r, h_infer, "boundscheck"); | 1158 UpdateRepresentation(r, h_infer, "boundscheck"); |
| 1160 } | 1159 } |
| 1161 | 1160 |
| 1162 | 1161 |
| 1163 bool HBoundsCheckBaseIndexInformation::IsRelationTrueInternal( | 1162 bool HBoundsCheckBaseIndexInformation::IsRelationTrueInternal( |
| 1164 NumericRelation relation, | 1163 NumericRelation relation, |
| 1165 HValue* related_value, | 1164 HValue* related_value, |
| (...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2940 // TODO(kasperl): Is there any way to signal that this isn't a smi? | 2939 // TODO(kasperl): Is there any way to signal that this isn't a smi? |
| 2941 return HType::Tagged(); | 2940 return HType::Tagged(); |
| 2942 } | 2941 } |
| 2943 | 2942 |
| 2944 | 2943 |
| 2945 HType HCheckSmi::CalculateInferredType() { | 2944 HType HCheckSmi::CalculateInferredType() { |
| 2946 return HType::Smi(); | 2945 return HType::Smi(); |
| 2947 } | 2946 } |
| 2948 | 2947 |
| 2949 | 2948 |
| 2950 void HCheckSmiOrInt32::InferRepresentation(HInferRepresentation* h_infer) { | |
| 2951 ASSERT(CheckFlag(kFlexibleRepresentation)); | |
| 2952 ASSERT(UseCount() == 1); | |
| 2953 HUseIterator use = uses(); | |
| 2954 Representation r = use.value()->RequiredInputRepresentation(use.index()); | |
| 2955 UpdateRepresentation(r, h_infer, "checksmiorint32"); | |
| 2956 } | |
| 2957 | |
| 2958 | |
| 2959 HType HPhi::CalculateInferredType() { | 2949 HType HPhi::CalculateInferredType() { |
| 2960 HType result = HType::Uninitialized(); | 2950 HType result = HType::Uninitialized(); |
| 2961 for (int i = 0; i < OperandCount(); ++i) { | 2951 for (int i = 0; i < OperandCount(); ++i) { |
| 2962 HType current = OperandAt(i)->type(); | 2952 HType current = OperandAt(i)->type(); |
| 2963 result = result.Combine(current); | 2953 result = result.Combine(current); |
| 2964 } | 2954 } |
| 2965 return result; | 2955 return result; |
| 2966 } | 2956 } |
| 2967 | 2957 |
| 2968 | 2958 |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3663 | 3653 |
| 3664 | 3654 |
| 3665 void HCheckFunction::Verify() { | 3655 void HCheckFunction::Verify() { |
| 3666 HInstruction::Verify(); | 3656 HInstruction::Verify(); |
| 3667 ASSERT(HasNoUses()); | 3657 ASSERT(HasNoUses()); |
| 3668 } | 3658 } |
| 3669 | 3659 |
| 3670 #endif | 3660 #endif |
| 3671 | 3661 |
| 3672 } } // namespace v8::internal | 3662 } } // namespace v8::internal |
| OLD | NEW |