Chromium Code Reviews| Index: src/ia32/macro-assembler-ia32.cc |
| diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc |
| index fb15302308e6a32e89b14d76d6f0b77732f5756c..12348ced873fd9caeeeebb640e24d858fb8f80fd 100644 |
| --- a/src/ia32/macro-assembler-ia32.cc |
| +++ b/src/ia32/macro-assembler-ia32.cc |
| @@ -1527,6 +1527,7 @@ void MacroAssembler::Allocate(int object_size, |
| AllocationFlags flags) { |
| DCHECK((flags & (RESULT_CONTAINS_TOP | SIZE_IN_WORDS)) == 0); |
| DCHECK(object_size <= Page::kMaxRegularHeapObjectSize); |
| + DCHECK((flags & ALLOCATION_FOLDED) == 0); |
| if (!FLAG_inline_new) { |
| if (emit_debug_code()) { |
| // Trash the registers to simulate an allocation failure. |
| @@ -1568,6 +1569,7 @@ void MacroAssembler::Allocate(int object_size, |
| // Calculate new top and bail out if space is exhausted. |
| Register top_reg = result_end.is_valid() ? result_end : result; |
| + |
| if (!top_reg.is(result)) { |
| mov(top_reg, result); |
| } |
| @@ -1575,8 +1577,10 @@ void MacroAssembler::Allocate(int object_size, |
| cmp(top_reg, Operand::StaticVariable(allocation_limit)); |
| j(above, gc_required); |
| - // Update allocation top. |
| - UpdateAllocationTopHelper(top_reg, scratch, flags); |
| + if ((flags & ALLOCATION_FOLDING_DOMINATOR) == 0) { |
| + // The top pointer is not updated for allocation folding dominators. |
| + UpdateAllocationTopHelper(top_reg, scratch, flags); |
| + } |
| if (top_reg.is(result)) { |
| sub(result, Immediate(object_size - kHeapObjectTag)); |
| @@ -1598,6 +1602,8 @@ void MacroAssembler::Allocate(int header_size, |
| Label* gc_required, |
| AllocationFlags flags) { |
| DCHECK((flags & SIZE_IN_WORDS) == 0); |
| + DCHECK((flags & ALLOCATION_FOLDING_DOMINATOR) == 0); |
| + DCHECK((flags & ALLOCATION_FOLDED) == 0); |
| if (!FLAG_inline_new) { |
| if (emit_debug_code()) { |
| // Trash the registers to simulate an allocation failure. |
| @@ -1649,9 +1655,9 @@ void MacroAssembler::Allocate(int header_size, |
| } else { |
| DCHECK(element_count_type == REGISTER_VALUE_IS_INT32); |
| } |
| + |
| lea(result_end, Operand(element_count, element_size, header_size)); |
| add(result_end, result); |
| - j(carry, gc_required); |
| cmp(result_end, Operand::StaticVariable(allocation_limit)); |
| j(above, gc_required); |
| @@ -1659,7 +1665,6 @@ void MacroAssembler::Allocate(int header_size, |
| DCHECK(kHeapObjectTag == 1); |
| inc(result); |
| - // Update allocation top. |
| UpdateAllocationTopHelper(result_end, scratch, flags); |
| } |
| @@ -1671,6 +1676,7 @@ void MacroAssembler::Allocate(Register object_size, |
| Label* gc_required, |
| AllocationFlags flags) { |
| DCHECK((flags & (RESULT_CONTAINS_TOP | SIZE_IN_WORDS)) == 0); |
| + DCHECK((flags & ALLOCATION_FOLDED) == 0); |
| if (!FLAG_inline_new) { |
| if (emit_debug_code()) { |
| // Trash the registers to simulate an allocation failure. |
| @@ -1699,7 +1705,7 @@ void MacroAssembler::Allocate(Register object_size, |
| Label aligned; |
| test(result, Immediate(kDoubleAlignmentMask)); |
| j(zero, &aligned, Label::kNear); |
| - if ((flags & PRETENURE) != 0) { |
| + if (((flags & ALLOCATION_FOLDED) == 0) && ((flags & PRETENURE) != 0)) { |
|
Michael Lippautz
2016/05/10 08:32:58
This does not make sense. We should never be in Al
Hannes Payer (out of office)
2016/05/10 09:04:45
leftover, removed.
|
| cmp(result, Operand::StaticVariable(allocation_limit)); |
| j(above_equal, gc_required); |
| } |
| @@ -1714,7 +1720,6 @@ void MacroAssembler::Allocate(Register object_size, |
| mov(result_end, object_size); |
| } |
| add(result_end, result); |
| - j(carry, gc_required); |
| cmp(result_end, Operand::StaticVariable(allocation_limit)); |
| j(above, gc_required); |
| @@ -1722,8 +1727,58 @@ void MacroAssembler::Allocate(Register object_size, |
| DCHECK(kHeapObjectTag == 1); |
| inc(result); |
| - // Update allocation top. |
| - UpdateAllocationTopHelper(result_end, scratch, flags); |
| + if ((flags & ALLOCATION_FOLDING_DOMINATOR) == 0) { |
| + // The top pointer is not updated for allocation folding dominators. |
| + UpdateAllocationTopHelper(result_end, scratch, flags); |
| + } |
| +} |
| + |
| +void MacroAssembler::FastAllocate(int object_size, Register result, |
| + Register result_end, AllocationFlags flags) { |
| + DCHECK(!result.is(result_end)); |
| + // Load address of new object into result. |
| + LoadAllocationTopHelper(result, no_reg, flags); |
| + |
| + if ((flags & DOUBLE_ALIGNMENT) != 0) { |
| + DCHECK(kPointerAlignment * 2 == kDoubleAlignment); |
| + Label aligned; |
| + test(result, Immediate(kDoubleAlignmentMask)); |
| + j(zero, &aligned, Label::kNear); |
| + mov(Operand(result, 0), |
| + Immediate(isolate()->factory()->one_pointer_filler_map())); |
| + add(result, Immediate(kDoubleSize / 2)); |
| + bind(&aligned); |
| + } |
| + |
| + lea(result_end, Operand(result, object_size)); |
| + UpdateAllocationTopHelper(result_end, no_reg, flags); |
| + |
| + DCHECK(kHeapObjectTag == 1); |
| + inc(result); |
| +} |
| + |
| +void MacroAssembler::FastAllocate(Register object_size, Register result, |
| + Register result_end, AllocationFlags flags) { |
| + DCHECK(!result.is(result_end)); |
| + // Load address of new object into result. |
| + LoadAllocationTopHelper(result, no_reg, flags); |
| + |
| + if ((flags & DOUBLE_ALIGNMENT) != 0) { |
| + DCHECK(kPointerAlignment * 2 == kDoubleAlignment); |
| + Label aligned; |
| + test(result, Immediate(kDoubleAlignmentMask)); |
| + j(zero, &aligned, Label::kNear); |
| + mov(Operand(result, 0), |
| + Immediate(isolate()->factory()->one_pointer_filler_map())); |
| + add(result, Immediate(kDoubleSize / 2)); |
| + bind(&aligned); |
| + } |
| + |
| + lea(result_end, Operand(result, object_size, times_1, 0)); |
| + UpdateAllocationTopHelper(result_end, no_reg, flags); |
| + |
| + DCHECK(kHeapObjectTag == 1); |
| + inc(result); |
| } |