Commit ef778970 authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: [crankshaft] Fragmentation-free allocation folding.

  port 61f5fbbb (r36133)

  original commit message:
  The new allocation folding implementation avoids fragmentation between folded allocation. As a consequence, our heap will always be iterable i.e. we do not have to perform a garbage collection
  before iterating the heap.

BUG=

Review-Url: https://codereview.chromium.org/1969553003
Cr-Commit-Position: refs/heads/master@{#36158}
parent 1270caed
......@@ -5456,6 +5456,30 @@ void LCodeGen::DoAllocate(LAllocate* instr) {
}
}
void LCodeGen::DoFastAllocate(LFastAllocate* instr) {
DCHECK(instr->hydrogen()->IsAllocationFolded());
Register result = ToRegister(instr->result());
Register temp = ToRegister(instr->temp());
AllocationFlags flags = NO_ALLOCATION_FLAGS;
if (instr->hydrogen()->MustAllocateDoubleAligned()) {
flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
}
if (instr->hydrogen()->IsOldSpaceAllocation()) {
DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
flags = static_cast<AllocationFlags>(flags | PRETENURE);
}
if (!instr->hydrogen()->IsAllocationFoldingDominator()) {
if (instr->size()->IsConstantOperand()) {
int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
CHECK(size <= Page::kMaxRegularHeapObjectSize);
__ FastAllocate(size, result, temp, flags);
} else {
Register size = ToRegister(instr->size());
__ FastAllocate(size, result, temp, flags);
}
}
}
void LCodeGen::DoDeferredAllocate(LAllocate* instr) {
Register result = ToRegister(instr->result());
......@@ -5513,31 +5537,6 @@ void LCodeGen::DoDeferredAllocate(LAllocate* instr) {
}
}
void LCodeGen::DoFastAllocate(LFastAllocate* instr) {
DCHECK(instr->hydrogen()->IsAllocationFolded());
Register result = ToRegister(instr->result());
Register temp = ToRegister(instr->temp());
AllocationFlags flags = NO_ALLOCATION_FLAGS;
if (instr->hydrogen()->MustAllocateDoubleAligned()) {
flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
}
if (instr->hydrogen()->IsOldSpaceAllocation()) {
DCHECK(!instr->hydrogen()->IsNewSpaceAllocation());
flags = static_cast<AllocationFlags>(flags | PRETENURE);
}
if (!instr->hydrogen()->IsAllocationFoldingDominator()) {
if (instr->size()->IsConstantOperand()) {
int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
CHECK(size <= Page::kMaxRegularHeapObjectSize);
__ FastAllocate(size, result, temp, flags);
} else {
Register size = ToRegister(instr->size());
__ FastAllocate(size, result, temp, flags);
}
}
}
void LCodeGen::DoTypeof(LTypeof* instr) {
DCHECK(ToRegister(instr->context()).is(esi));
......
......@@ -629,6 +629,9 @@ class MacroAssembler: public Assembler {
void Allocate(Register object_size, Register result, Register result_end,
Register scratch, Label* gc_required, AllocationFlags flags);
// FastAllocate is right now only used for folded allocations. It just
// increments the top pointer without checking against limit. This can only
// be done if it was proved earlier that the allocation will succeed.
void FastAllocate(int object_size, Register result, Register result_end,
AllocationFlags flags);
void FastAllocate(Register object_size, Register result, Register result_end,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment