Index: src/hydrogen-instructions.cc |
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
index 16476a9c5a95c2b9a1bcca90e388255d7d25438b..68c8139943dd0c37894e3a2bb4452d65d9b54831 100644 |
--- a/src/hydrogen-instructions.cc |
+++ b/src/hydrogen-instructions.cc |
@@ -3210,12 +3210,10 @@ void HAllocate::HandleSideEffectDominator(GVNFlag side_effect, |
HValue* dominator_size = dominator_allocate_instr->size(); |
HValue* current_size = size(); |
// 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() || |
+ if (!GuaranteedInNewSpace() || |
!current_size->IsInteger32Constant() || |
!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", |
@@ -3229,7 +3227,13 @@ void HAllocate::HandleSideEffectDominator(GVNFlag side_effect, |
HConstant::cast(dominator_size)->GetInteger32Constant(); |
int32_t current_size_constant = |
HConstant::cast(current_size)->GetInteger32Constant(); |
- int32_t new_dominator_size = dominator_size_constant + current_size_constant; |
+ int32_t new_dominator_size = |
+ dominator_size_constant + current_size_constant; |
+ bool double_alignment = MustAllocateDoubleAligned() && |
+ kPointerAlignment != kDoubleAlignment; |
+ |
+ if (double_alignment) new_dominator_size += kDoubleSize / 2; |
+ |
if (new_dominator_size > Page::kMaxNonCodeHeapObjectSize) { |
if (FLAG_trace_allocation_folding) { |
PrintF("#%d (%s) cannot fold into #%d (%s) due to size: %d\n", |
@@ -3255,7 +3259,8 @@ void HAllocate::HandleSideEffectDominator(GVNFlag side_effect, |
HInstruction* dominated_allocate_instr = |
new(zone) HInnerAllocatedObject(dominator_allocate_instr, |
dominator_size_constant, |
- type()); |
+ type(), |
+ double_alignment); |
dominated_allocate_instr->InsertBefore(this); |
DeleteAndReplaceWith(dominated_allocate_instr); |
if (FLAG_trace_allocation_folding) { |