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
This commit is contained in:
fschneider@chromium.org 2012-01-23 18:11:36 +00:00
parent 83b439a0f9
commit 2284996cc1
2 changed files with 19 additions and 0 deletions

View File

@ -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()));

View File

@ -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: