Also check if the length ia a smi in a HBoundsCheck.

Review URL: https://codereview.chromium.org/12301026

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13701 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mmassi@chromium.org 2013-02-21 09:09:01 +00:00
parent 215ba8cfc9
commit 0832d08dd9

View File

@ -784,11 +784,16 @@ HBoundsCheck* HGraphBuilder::AddBoundsCheck(HValue* index,
HValue* length,
BoundsCheckKeyMode key_mode,
Representation r) {
HCheckSmiOrInt32* checked_index =
new(graph()->zone()) HCheckSmiOrInt32(index);
AddInstruction(checked_index);
if (!index->type().IsSmi()) {
index = new(graph()->zone()) HCheckSmiOrInt32(index);
AddInstruction(HCheckSmiOrInt32::cast(index));
}
if (!length->type().IsSmi()) {
length = new(graph()->zone()) HCheckSmiOrInt32(length);
AddInstruction(HCheckSmiOrInt32::cast(length));
}
HBoundsCheck* result = new(graph()->zone()) HBoundsCheck(
checked_index, length, key_mode, r);
index, length, key_mode, r);
AddInstruction(result);
return result;
}