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 2838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2849 : new(zone) Range(); | 2849 : new(zone) Range(); |
2850 result->Shl(c->Integer32Value()); | 2850 result->Shl(c->Integer32Value()); |
2851 return result; | 2851 return result; |
2852 } | 2852 } |
2853 } | 2853 } |
2854 return HValue::InferRange(zone); | 2854 return HValue::InferRange(zone); |
2855 } | 2855 } |
2856 | 2856 |
2857 | 2857 |
2858 Range* HLoadNamedField::InferRange(Zone* zone) { | 2858 Range* HLoadNamedField::InferRange(Zone* zone) { |
2859 if (access().representation().IsByte()) { | 2859 if (access().representation().IsInteger8()) { |
2860 return new(zone) Range(-128, 127); | |
2861 } | |
2862 if (access().representation().IsUInteger8()) { | |
2860 return new(zone) Range(0, 255); | 2863 return new(zone) Range(0, 255); |
2861 } | 2864 } |
2865 if (access().representation().IsInteger16()) { | |
2866 return new(zone) Range(-16384, 16383); | |
Yang
2013/11/07 09:32:43
Afaik signed integer goes from -2^15 to 2^15-1, wh
danno
2013/11/07 13:19:57
Done.
| |
2867 } | |
2868 if (access().representation().IsUInteger16()) { | |
2869 return new(zone) Range(0, 65535); | |
Yang
2013/11/07 09:32:43
Same here. Using a constant would be better.
danno
2013/11/07 13:19:57
Done.
| |
2870 } | |
2862 if (access().IsStringLength()) { | 2871 if (access().IsStringLength()) { |
2863 return new(zone) Range(0, String::kMaxLength); | 2872 return new(zone) Range(0, String::kMaxLength); |
2864 } | 2873 } |
2865 return HValue::InferRange(zone); | 2874 return HValue::InferRange(zone); |
2866 } | 2875 } |
2867 | 2876 |
2868 | 2877 |
2869 Range* HLoadKeyed::InferRange(Zone* zone) { | 2878 Range* HLoadKeyed::InferRange(Zone* zone) { |
2870 switch (elements_kind()) { | 2879 switch (elements_kind()) { |
2871 case EXTERNAL_PIXEL_ELEMENTS: | 2880 case EXTERNAL_PIXEL_ELEMENTS: |
2872 return new(zone) Range(0, 255); | 2881 return new(zone) Range(0, 255); |
Yang
2013/11/07 09:32:43
While you are at it, this part can also be constan
danno
2013/11/07 13:19:57
Done.
| |
2873 case EXTERNAL_BYTE_ELEMENTS: | 2882 case EXTERNAL_BYTE_ELEMENTS: |
2874 return new(zone) Range(-128, 127); | 2883 return new(zone) Range(-128, 127); |
2875 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 2884 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
2876 return new(zone) Range(0, 255); | 2885 return new(zone) Range(0, 255); |
2877 case EXTERNAL_SHORT_ELEMENTS: | 2886 case EXTERNAL_SHORT_ELEMENTS: |
2878 return new(zone) Range(-32768, 32767); | 2887 return new(zone) Range(-32768, 32767); |
2879 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 2888 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
2880 return new(zone) Range(0, 65535); | 2889 return new(zone) Range(0, 65535); |
2881 default: | 2890 default: |
2882 return HValue::InferRange(zone); | 2891 return HValue::InferRange(zone); |
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4298 break; | 4307 break; |
4299 case kExternalMemory: | 4308 case kExternalMemory: |
4300 stream->Add("[external-memory]"); | 4309 stream->Add("[external-memory]"); |
4301 break; | 4310 break; |
4302 } | 4311 } |
4303 | 4312 |
4304 stream->Add("@%d", offset()); | 4313 stream->Add("@%d", offset()); |
4305 } | 4314 } |
4306 | 4315 |
4307 } } // namespace v8::internal | 4316 } } // namespace v8::internal |
OLD | NEW |