Index: src/crankshaft/x64/lithium-codegen-x64.cc |
diff --git a/src/crankshaft/x64/lithium-codegen-x64.cc b/src/crankshaft/x64/lithium-codegen-x64.cc |
index 5ff00315547e661b147deddc7d1b7b6a646a2651..9dfd05ffbfc821d48090dce44fea91721511490f 100644 |
--- a/src/crankshaft/x64/lithium-codegen-x64.cc |
+++ b/src/crankshaft/x64/lithium-codegen-x64.cc |
@@ -5170,6 +5170,14 @@ void LCodeGen::DoAllocate(LAllocate* instr) { |
flags = static_cast<AllocationFlags>(flags | PRETENURE); |
} |
+ if (instr->hydrogen()->IsAllocationFoldingDominator()) { |
+ flags = static_cast<AllocationFlags>(flags | ALLOCATION_FOLDING_DOMINATOR); |
+ } |
+ |
+ if (instr->hydrogen()->IsAllocationFoldingDominated()) { |
+ flags = static_cast<AllocationFlags>(flags | ALLOCATION_FOLDING_DOMINATED); |
+ } |
+ |
if (instr->size()->IsConstantOperand()) { |
int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); |
CHECK(size <= Page::kMaxRegularHeapObjectSize); |
@@ -5231,6 +5239,18 @@ void LCodeGen::DoDeferredAllocate(LAllocate* instr) { |
CallRuntimeFromDeferred( |
Runtime::kAllocateInTargetSpace, 2, instr, instr->context()); |
__ StoreToSafepointRegisterSlot(result, rax); |
+ |
+ if (instr->hydrogen()->IsAllocationFoldingDominator()) { |
+ AllocationFlags allocation_flags = TAG_OBJECT; |
+ if (instr->hydrogen()->IsOldSpaceAllocation()) { |
+ DCHECK(!instr->hydrogen()->IsNewSpaceAllocation()); |
+ allocation_flags = static_cast<AllocationFlags>(flags | PRETENURE); |
+ } |
+ // If the allocation folding dominator allocate triggered a GC, allocation |
+ // happend in the runtime. We have to reset the top pointer to virtually |
+ // undo the allocation. |
+ __ SetTop(rax, allocation_flags); |
+ } |
} |