Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index d001534bf579edf413d71ac8e74275c8594961db..39e1e159ee1b7b4bfade9c65602041ff0e685ce6 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -1099,11 +1099,6 @@ HInstruction* HGraphBuilder::BuildFastElementAccess( |
switch (elements_kind) { |
case FAST_SMI_ELEMENTS: |
case FAST_HOLEY_SMI_ELEMENTS: |
- 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: |
case FAST_DOUBLE_ELEMENTS: |
@@ -1292,14 +1287,17 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess( |
fast_elements || |
IsFastDoubleElementsKind(elements_kind)); |
+ // In case val is stored into a fast smi array, assure that the value is a smi |
+ // before manipulating the backing store. Otherwise the actual store may |
+ // deopt, leaving the backing store in an invalid state. |
if (is_store && IsFastSmiElementsKind(elements_kind) && |
!val->type().IsSmi()) { |
- AddInstruction(new(zone) HCheckSmi(val)); |
+ val = AddInstruction(new(zone) HForceRepresentation( |
+ val, Representation::Smi())); |
} |
if (IsGrowStoreMode(store_mode)) { |
NoObservableSideEffectsScope no_effects(this); |
- |
elements = BuildCheckForCapacityGrow(object, elements, elements_kind, |
length, key, is_js_array); |
checked_key = key; |
@@ -1542,6 +1540,7 @@ void HGraphBuilder::BuildFillElementsWithHole(HValue* context, |
if (IsFastSmiOrObjectElementsKind(elements_kind)) { |
elements_kind = FAST_HOLEY_ELEMENTS; |
} |
+ |
if (unfold_loop) { |
for (int i = 0; i < initial_capacity; i++) { |
HInstruction* key = AddInstruction(new(zone) |
@@ -6939,11 +6938,6 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { |
switch (boilerplate_elements_kind) { |
case FAST_SMI_ELEMENTS: |
case FAST_HOLEY_SMI_ELEMENTS: |
- 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: |