Chromium Code Reviews| Index: src/hydrogen-instructions.cc |
| diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
| index 4f8af2b0c041f429b1992213a8f4d7571dd5bea4..d3250af806034186c12458145416aff440729e94 100644 |
| --- a/src/hydrogen-instructions.cc |
| +++ b/src/hydrogen-instructions.cc |
| @@ -2123,23 +2123,34 @@ void HLoadKeyed::PrintDataTo(StringStream* stream) { |
| } |
| -bool HLoadKeyed::RequiresHoleCheck() const { |
| +bool HLoadKeyed::CanReturnHole() const { |
|
Michael Starzinger
2013/02/01 13:15:08
This name is kind of disambiguate, it took me a wh
danno
2013/02/02 17:56:21
Done.
|
| if (IsFastPackedElementsKind(elements_kind())) { |
| return false; |
| } |
| + if (hole_mode() == ALLOW_RETURN_HOLE) return true; |
| + |
| if (IsFastDoubleElementsKind(elements_kind())) { |
| - return true; |
| + return false; |
| } |
| for (HUseIterator it(uses()); !it.Done(); it.Advance()) { |
| HValue* use = it.value(); |
| if (!use->IsChange()) { |
| - return true; |
| + return false; |
| } |
| } |
| - return false; |
| + return true; |
| +} |
| + |
| + |
| +bool HLoadKeyed::RequiresHoleCheck() const { |
| + if (IsFastPackedElementsKind(elements_kind())) { |
| + return false; |
| + } |
| + |
| + return !CanReturnHole(); |
| } |
| @@ -2413,6 +2424,11 @@ HType HAllocateObject::CalculateInferredType() { |
| } |
| +HType HAllocate::CalculateInferredType() { |
| + return type_; |
| +} |
| + |
| + |
| HType HFastLiteral::CalculateInferredType() { |
| // TODO(mstarzinger): Be smarter, could also be JSArray here. |
| return HType::JSObject(); |
| @@ -2534,12 +2550,21 @@ HValue* HAdd::EnsureAndPropagateNotMinusZero(BitVector* visited) { |
| bool HStoreKeyed::NeedsCanonicalization() { |
| - // If value is an integer or comes from the result of a keyed load |
| - // then it will be a non-hole value: no need for canonicalization. |
| - if (value()->IsLoadKeyed() || |
| - (value()->IsChange() && HChange::cast(value())->from().IsInteger32())) { |
| + // 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. |
| + if (value()->IsLoadKeyed() || value()->IsConstant()) { |
| return false; |
| } |
| + |
| + if (value()->IsChange()) { |
| + if (HChange::cast(value())->from().IsInteger32()) { |
| + return false; |
| + } |
| + if (HChange::cast(value())->value()->type().IsSmi()) { |
| + return false; |
| + } |
| + } |
| return true; |
| } |