Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: src/hydrogen.cc

Issue 12301026: Also check if the length ia a smi in a HBoundsCheck. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index ed21567e51b1a8f455fbf4bd0c00771808ce2273..9a517e0d75ec597459699cbc0a329dd1d7f89c70 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698