Index: src/hydrogen-instructions.cc |
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
index 206ab7e2accf5e496b6cd814eb1071c511cb21e7..0d47b23f28264803a39b251a30a2c183a607fc04 100644 |
--- a/src/hydrogen-instructions.cc |
+++ b/src/hydrogen-instructions.cc |
@@ -2856,8 +2856,17 @@ Range* HShl::InferRange(Zone* zone) { |
Range* HLoadNamedField::InferRange(Zone* zone) { |
- if (access().representation().IsByte()) { |
- return new(zone) Range(0, 255); |
+ if (access().representation().IsInteger8()) { |
+ return new(zone) Range(kMinInt8, kMaxInt8); |
+ } |
+ if (access().representation().IsUInteger8()) { |
+ return new(zone) Range(kMinUInt8, kMaxUInt8); |
+ } |
+ if (access().representation().IsInteger16()) { |
+ return new(zone) Range(kMinInt16, kMaxInt16); |
+ } |
+ if (access().representation().IsUInteger16()) { |
+ return new(zone) Range(kMinUInt16, kMaxUInt16); |
} |
if (access().IsStringLength()) { |
return new(zone) Range(0, String::kMaxLength); |
@@ -2868,16 +2877,15 @@ Range* HLoadNamedField::InferRange(Zone* zone) { |
Range* HLoadKeyed::InferRange(Zone* zone) { |
switch (elements_kind()) { |
- case EXTERNAL_PIXEL_ELEMENTS: |
- return new(zone) Range(0, 255); |
case EXTERNAL_BYTE_ELEMENTS: |
- return new(zone) Range(-128, 127); |
+ return new(zone) Range(kMinInt8, kMaxInt8); |
case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
- return new(zone) Range(0, 255); |
+ case EXTERNAL_PIXEL_ELEMENTS: |
+ return new(zone) Range(kMinUInt8, kMaxUInt8); |
case EXTERNAL_SHORT_ELEMENTS: |
- return new(zone) Range(-32768, 32767); |
+ return new(zone) Range(kMinInt16, kMaxInt16); |
case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
- return new(zone) Range(0, 65535); |
+ return new(zone) Range(kMinUInt16, kMaxUInt16); |
default: |
return HValue::InferRange(zone); |
} |