Chromium Code Reviews| Index: src/hydrogen-instructions.cc |
| diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
| index 4475fc0c74eafe73dfbc981df4bf8b2fdbc7343b..674e33bd2d6d2a11a4826a71ed1bd0b02031bb56 100644 |
| --- a/src/hydrogen-instructions.cc |
| +++ b/src/hydrogen-instructions.cc |
| @@ -3181,21 +3181,26 @@ HType HAllocate::CalculateInferredType() { |
| void HAllocate::HandleSideEffectDominator(GVNFlag side_effect, |
| HValue* dominator) { |
| ASSERT(side_effect == kChangesNewSpacePromotion); |
| - // Try to fold allocations together with their dominating allocations. |
| - if (!FLAG_use_allocation_folding || !dominator->IsAllocate()) { |
| + if (!FLAG_use_allocation_folding) { |
| return; |
|
Michael Starzinger
2013/07/16 08:44:36
nit: This early return should fit into one line.
Hannes Payer (out of office)
2013/07/16 08:51:52
Done.
|
| } |
| HAllocate* dominator_allocate_instr = HAllocate::cast(dominator); |
|
Michael Starzinger
2013/07/16 08:44:36
This cast will fail if "dominator" is not an HAllo
Hannes Payer (out of office)
2013/07/16 08:51:52
Yes, then I guess I have to duplicate the tracing
|
| HValue* dominator_size = dominator_allocate_instr->size(); |
| HValue* current_size = size(); |
| + // Try to fold allocations together with their dominating allocations. |
| // We can just fold allocations that are guaranteed in new space. |
| // TODO(hpayer): Support double aligned allocations. |
| // TODO(hpayer): Add support for non-constant allocation in dominator. |
| if (!GuaranteedInNewSpace() || MustAllocateDoubleAligned() || |
| !current_size->IsInteger32Constant() || |
| + !dominator->IsAllocate() || |
| !dominator_allocate_instr->GuaranteedInNewSpace() || |
| dominator_allocate_instr->MustAllocateDoubleAligned() || |
| !dominator_size->IsInteger32Constant()) { |
| + if (FLAG_trace_allocation_folding) { |
| + PrintF("#%d (%s) cannot fold into #%d (%s)\n", |
| + id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); |
| + } |
| return; |
| } |