Commit 0832d08d authored by mmassi@chromium.org's avatar mmassi@chromium.org

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
parent 215ba8cf
......@@ -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;
}
......
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