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 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 stream->Add(" + %d) >> %d)", offset(), scale()); | 1140 stream->Add(" + %d) >> %d)", offset(), scale()); |
1141 } | 1141 } |
1142 if (skip_check()) { | 1142 if (skip_check()) { |
1143 stream->Add(" [DISABLED]"); | 1143 stream->Add(" [DISABLED]"); |
1144 } | 1144 } |
1145 } | 1145 } |
1146 | 1146 |
1147 | 1147 |
1148 void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) { | 1148 void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) { |
1149 ASSERT(CheckFlag(kFlexibleRepresentation)); | 1149 ASSERT(CheckFlag(kFlexibleRepresentation)); |
1150 Representation r; | |
1151 HValue* actual_index = index()->ActualValue(); | 1150 HValue* actual_index = index()->ActualValue(); |
1152 HValue* actual_length = length()->ActualValue(); | 1151 HValue* actual_length = length()->ActualValue(); |
1153 Representation index_rep = actual_index->representation(); | 1152 Representation index_rep = actual_index->representation(); |
1154 if (!actual_length->representation().IsSmiOrTagged()) { | 1153 Representation length_rep = actual_length->representation(); |
1155 r = Representation::Integer32(); | 1154 if (index_rep.IsTagged()) index_rep = Representation::Smi(); |
1156 } else if ((index_rep.IsTagged() && actual_index->type().IsSmi()) || | 1155 if (length_rep.IsTagged()) length_rep = Representation::Smi(); |
1157 index_rep.IsSmi()) { | 1156 Representation r = index_rep.generalize(length_rep); |
1158 // If the index is smi, allow the length to be smi, since it is usually | 1157 if (r.is_more_general_than(Representation::Integer32())) { |
1159 // already smi from loading it out of the length field of a JSArray. This | |
1160 // allows for direct comparison without untagging. | |
1161 r = Representation::Smi(); | |
1162 } else { | |
1163 r = Representation::Integer32(); | 1158 r = Representation::Integer32(); |
1164 } | 1159 } |
1165 UpdateRepresentation(r, h_infer, "boundscheck"); | 1160 UpdateRepresentation(r, h_infer, "boundscheck"); |
1166 } | 1161 } |
1167 | 1162 |
1168 | 1163 |
1169 bool HBoundsCheckBaseIndexInformation::IsRelationTrueInternal( | 1164 bool HBoundsCheckBaseIndexInformation::IsRelationTrueInternal( |
1170 NumericRelation relation, | 1165 NumericRelation relation, |
1171 HValue* related_value, | 1166 HValue* related_value, |
1172 int offset, | 1167 int offset, |
(...skipping 2682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3855 case kBackingStore: | 3850 case kBackingStore: |
3856 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 3851 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
3857 stream->Add("[backing-store]"); | 3852 stream->Add("[backing-store]"); |
3858 break; | 3853 break; |
3859 } | 3854 } |
3860 | 3855 |
3861 stream->Add("@%d", offset()); | 3856 stream->Add("@%d", offset()); |
3862 } | 3857 } |
3863 | 3858 |
3864 } } // namespace v8::internal | 3859 } } // namespace v8::internal |
OLD | NEW |