diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc index 2d32ad1fed..7ae0b44a27 100644 --- a/src/hydrogen-instructions.cc +++ b/src/hydrogen-instructions.cc @@ -1339,6 +1339,23 @@ Range* HShl::InferRange() { } +Range* HLoadKeyedSpecializedArrayElement::InferRange() { + switch (elements_kind()) { + case EXTERNAL_PIXEL_ELEMENTS: + return new Range(0, 255); + case EXTERNAL_BYTE_ELEMENTS: + return new Range(-128, 127); + case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: + return new Range(0, 255); + case EXTERNAL_SHORT_ELEMENTS: + return new Range(-32768, 32767); + case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: + return new Range(0, 65535); + default: + return HValue::InferRange(); + } +} + void HCompareGeneric::PrintDataTo(StringStream* stream) { stream->Add(Token::Name(token())); diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index 9f661d6f03..de197fffa4 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -3844,6 +3844,8 @@ class HLoadKeyedSpecializedArrayElement: public HTemplateInstruction<2> { HValue* key() { return OperandAt(1); } ElementsKind elements_kind() const { return elements_kind_; } + virtual Range* InferRange(); + DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement) protected: