| 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..08189e2985595ebcbc277a72110be61f59f6a64f 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.
|
| @@ -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);
|
| }
|
|
|
|
|
|
|