Index: src/hydrogen-instructions.cc |
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
index 287fc56399229f262db4d21f8011cd4dca35f7f4..a1a60b370e1f7f46d9fc1a62150add4faa402ba9 100644 |
--- a/src/hydrogen-instructions.cc |
+++ b/src/hydrogen-instructions.cc |
@@ -4040,31 +4040,19 @@ bool HStoreKeyed::TryIncreaseBaseOffset(uint32_t increase_by_value) { |
bool HStoreKeyed::NeedsCanonicalization() { |
- // If value is an integer or smi or comes from the result of a keyed load or |
- // constant then it is either be a non-hole value or in the case of a constant |
- // the hole is only being stored explicitly: no need for canonicalization. |
- // |
- // The exception to that is keyed loads from external float or double arrays: |
- // these can load arbitrary representation of NaN. |
- |
- if (value()->IsConstant()) { |
- return false; |
- } |
- |
- if (value()->IsLoadKeyed()) { |
- return IsExternalFloatOrDoubleElementsKind( |
- HLoadKeyed::cast(value())->elements_kind()); |
- } |
- |
- if (value()->IsChange()) { |
- if (HChange::cast(value())->from().IsSmiOrInteger32()) { |
- return false; |
+ switch (value()->opcode()) { |
+ case kLoadKeyed: { |
+ ElementsKind load_kind = HLoadKeyed::cast(value())->elements_kind(); |
+ return IsExternalFloatOrDoubleElementsKind(load_kind) || |
+ IsFixedFloatElementsKind(load_kind); |
} |
- if (HChange::cast(value())->value()->type().IsSmi()) { |
- return false; |
+ case kChange: { |
+ Representation from = HChange::cast(value())->from(); |
+ return from.IsTagged() || from.IsHeapObject(); |
} |
+ default: |
+ return false; |
} |
- return true; |
} |