Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 5c573feb198c9cddc227186db482388bad94bdb7..cd46747fb0234d67e31d39bf1fed1eefff7e1944 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -1129,8 +1129,10 @@ HInstruction* HGraphBuilder::BuildFastElementAccess( |
switch (elements_kind) { |
case FAST_SMI_ELEMENTS: |
case FAST_HOLEY_SMI_ELEMENTS: |
- // Smi-only arrays need a smi check. |
- AddInstruction(new(zone) HCheckSmi(val)); |
+ if (!val->type().IsSmi()) { |
+ // Smi-only arrays need a smi check. |
+ AddInstruction(new(zone) HCheckSmi(val)); |
+ } |
// Fall through. |
case FAST_ELEMENTS: |
case FAST_HOLEY_ELEMENTS: |
@@ -6934,9 +6936,11 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { |
switch (boilerplate_elements_kind) { |
case FAST_SMI_ELEMENTS: |
case FAST_HOLEY_SMI_ELEMENTS: |
- // Smi-only arrays need a smi check. |
- AddInstruction(new(zone()) HCheckSmi(value)); |
- // Fall through. |
+ if (!value->type().IsSmi()) { |
+ // Smi-only arrays need a smi check. |
+ AddInstruction(new(zone()) HCheckSmi(value)); |
+ // Fall through. |
+ } |
case FAST_ELEMENTS: |
case FAST_HOLEY_ELEMENTS: |
case FAST_DOUBLE_ELEMENTS: |