Add range information to external array loads.

Review URL: http://codereview.chromium.org/9226014

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10479 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 83b439a0
......@@ -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()));
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment