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 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 length_rep = Representation::Smi(); | 940 length_rep = Representation::Smi(); |
941 } | 941 } |
942 Representation r = index_rep.generalize(length_rep); | 942 Representation r = index_rep.generalize(length_rep); |
943 if (r.is_more_general_than(Representation::Integer32())) { | 943 if (r.is_more_general_than(Representation::Integer32())) { |
944 r = Representation::Integer32(); | 944 r = Representation::Integer32(); |
945 } | 945 } |
946 UpdateRepresentation(r, h_infer, "boundscheck"); | 946 UpdateRepresentation(r, h_infer, "boundscheck"); |
947 } | 947 } |
948 | 948 |
949 | 949 |
| 950 Range* HBoundsCheck::InferRange(Zone* zone) { |
| 951 Representation r = representation(); |
| 952 if (r.IsSmiOrInteger32() && length()->HasRange()) { |
| 953 int upper = length()->range()->upper() - (allow_equality() ? 0 : 1); |
| 954 int lower = 0; |
| 955 |
| 956 Range* result = new(zone) Range(lower, upper); |
| 957 if (index()->HasRange()) { |
| 958 result->Intersect(index()->range()); |
| 959 } |
| 960 |
| 961 // In case of Smi representation, clamp result to Smi::kMaxValue. |
| 962 if (r.IsSmi()) result->ClampToSmi(); |
| 963 return result; |
| 964 } |
| 965 return HValue::InferRange(zone); |
| 966 } |
| 967 |
| 968 |
950 void HBoundsCheckBaseIndexInformation::PrintDataTo(StringStream* stream) { | 969 void HBoundsCheckBaseIndexInformation::PrintDataTo(StringStream* stream) { |
951 stream->Add("base: "); | 970 stream->Add("base: "); |
952 base_index()->PrintNameTo(stream); | 971 base_index()->PrintNameTo(stream); |
953 stream->Add(", check: "); | 972 stream->Add(", check: "); |
954 base_index()->PrintNameTo(stream); | 973 base_index()->PrintNameTo(stream); |
955 } | 974 } |
956 | 975 |
957 | 976 |
958 void HCallConstantFunction::PrintDataTo(StringStream* stream) { | 977 void HCallConstantFunction::PrintDataTo(StringStream* stream) { |
959 if (IsApplyFunction()) { | 978 if (IsApplyFunction()) { |
(...skipping 3414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4374 break; | 4393 break; |
4375 case kExternalMemory: | 4394 case kExternalMemory: |
4376 stream->Add("[external-memory]"); | 4395 stream->Add("[external-memory]"); |
4377 break; | 4396 break; |
4378 } | 4397 } |
4379 | 4398 |
4380 stream->Add("@%d", offset()); | 4399 stream->Add("@%d", offset()); |
4381 } | 4400 } |
4382 | 4401 |
4383 } } // namespace v8::internal | 4402 } } // namespace v8::internal |
OLD | NEW |