| Index: src/mips/macro-assembler-mips.cc
|
| diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc
|
| index c931e5b7e605cd41a0a1039d2eacf593ae771d11..c577d3b934989021753c09201901d1a8ed9ae7bd 100644
|
| --- a/src/mips/macro-assembler-mips.cc
|
| +++ b/src/mips/macro-assembler-mips.cc
|
| @@ -3270,12 +3270,7 @@ void MacroAssembler::Allocate(int object_size,
|
| return;
|
| }
|
|
|
| - DCHECK(!result.is(scratch1));
|
| - DCHECK(!result.is(scratch2));
|
| - DCHECK(!scratch1.is(scratch2));
|
| - DCHECK(!scratch1.is(t9));
|
| - DCHECK(!scratch2.is(t9));
|
| - DCHECK(!result.is(t9));
|
| + DCHECK(!AreAliased(result, scratch1, scratch2, t9));
|
|
|
| // Make object size into bytes.
|
| if ((flags & SIZE_IN_WORDS) != 0) {
|
| @@ -3291,54 +3286,52 @@ void MacroAssembler::Allocate(int object_size,
|
| ExternalReference allocation_limit =
|
| AllocationUtils::GetAllocationLimitReference(isolate(), flags);
|
|
|
| - intptr_t top =
|
| - reinterpret_cast<intptr_t>(allocation_top.address());
|
| - intptr_t limit =
|
| - reinterpret_cast<intptr_t>(allocation_limit.address());
|
| + intptr_t top = reinterpret_cast<intptr_t>(allocation_top.address());
|
| + intptr_t limit = reinterpret_cast<intptr_t>(allocation_limit.address());
|
| DCHECK((limit - top) == kPointerSize);
|
|
|
| - // Set up allocation top address and object size registers.
|
| - Register topaddr = scratch1;
|
| - li(topaddr, Operand(allocation_top));
|
| -
|
| + // Set up allocation top address and allocation limit registers.
|
| + Register top_address = scratch1;
|
| // This code stores a temporary value in t9.
|
| + Register alloc_limit = t9;
|
| + Register result_end = scratch2;
|
| + li(top_address, Operand(allocation_top));
|
| +
|
| if ((flags & RESULT_CONTAINS_TOP) == 0) {
|
| - // Load allocation top into result and allocation limit into t9.
|
| - lw(result, MemOperand(topaddr));
|
| - lw(t9, MemOperand(topaddr, kPointerSize));
|
| + // Load allocation top into result and allocation limit into alloc_limit.
|
| + lw(result, MemOperand(top_address));
|
| + lw(alloc_limit, MemOperand(top_address, kPointerSize));
|
| } else {
|
| if (emit_debug_code()) {
|
| - // Assert that result actually contains top on entry. t9 is used
|
| - // immediately below so this use of t9 does not cause difference with
|
| - // respect to register content between debug and release mode.
|
| - lw(t9, MemOperand(topaddr));
|
| - Check(eq, kUnexpectedAllocationTop, result, Operand(t9));
|
| + // Assert that result actually contains top on entry.
|
| + lw(alloc_limit, MemOperand(top_address));
|
| + Check(eq, kUnexpectedAllocationTop, result, Operand(alloc_limit));
|
| }
|
| - // Load allocation limit into t9. Result already contains allocation top.
|
| - lw(t9, MemOperand(topaddr, limit - top));
|
| + // Load allocation limit. Result already contains allocation top.
|
| + lw(alloc_limit, MemOperand(top_address, limit - top));
|
| }
|
|
|
| if ((flags & DOUBLE_ALIGNMENT) != 0) {
|
| // Align the next allocation. Storing the filler map without checking top is
|
| // safe in new-space because the limit of the heap is aligned there.
|
| DCHECK(kPointerAlignment * 2 == kDoubleAlignment);
|
| - And(scratch2, result, Operand(kDoubleAlignmentMask));
|
| + And(result_end, result, Operand(kDoubleAlignmentMask));
|
| Label aligned;
|
| - Branch(&aligned, eq, scratch2, Operand(zero_reg));
|
| + Branch(&aligned, eq, result_end, Operand(zero_reg));
|
| if ((flags & PRETENURE) != 0) {
|
| - Branch(gc_required, Ugreater_equal, result, Operand(t9));
|
| + Branch(gc_required, Ugreater_equal, result, Operand(alloc_limit));
|
| }
|
| - li(scratch2, Operand(isolate()->factory()->one_pointer_filler_map()));
|
| - sw(scratch2, MemOperand(result));
|
| + li(result_end, Operand(isolate()->factory()->one_pointer_filler_map()));
|
| + sw(result_end, MemOperand(result));
|
| Addu(result, result, Operand(kDoubleSize / 2));
|
| bind(&aligned);
|
| }
|
|
|
| // Calculate new top and bail out if new space is exhausted. Use result
|
| // to calculate the new top.
|
| - Addu(scratch2, result, Operand(object_size));
|
| - Branch(gc_required, Ugreater, scratch2, Operand(t9));
|
| - sw(scratch2, MemOperand(topaddr));
|
| + Addu(result_end, result, Operand(object_size));
|
| + Branch(gc_required, Ugreater, result_end, Operand(alloc_limit));
|
| + sw(result_end, MemOperand(top_address));
|
|
|
| // Tag object if requested.
|
| if ((flags & TAG_OBJECT) != 0) {
|
| @@ -3348,24 +3341,24 @@ void MacroAssembler::Allocate(int object_size,
|
|
|
|
|
| void MacroAssembler::Allocate(Register object_size, Register result,
|
| - Register result_end, Register scratch1,
|
| + Register result_end, Register scratch,
|
| Label* gc_required, AllocationFlags flags) {
|
| if (!FLAG_inline_new) {
|
| if (emit_debug_code()) {
|
| // Trash the registers to simulate an allocation failure.
|
| li(result, 0x7091);
|
| - li(scratch1, 0x7191);
|
| + li(scratch, 0x7191);
|
| li(result_end, 0x7291);
|
| }
|
| jmp(gc_required);
|
| return;
|
| }
|
|
|
| - DCHECK(!result.is(scratch1));
|
| - DCHECK(!result.is(result_end));
|
| - DCHECK(!scratch1.is(result_end));
|
| - DCHECK(!object_size.is(t9));
|
| - DCHECK(!scratch1.is(t9) && !result_end.is(t9) && !result.is(t9));
|
| + // |object_size| and |result_end| may overlap if the DOUBLE_ALIGNMENT flag
|
| + // is not specified. Other registers must not overlap.
|
| + DCHECK(!AreAliased(object_size, result, scratch, t9));
|
| + DCHECK(!AreAliased(result_end, result, scratch, t9));
|
| + DCHECK((flags & DOUBLE_ALIGNMENT) == 0 || !object_size.is(result_end));
|
|
|
| // Check relative positions of allocation top and limit addresses.
|
| // ARM adds additional checks to make sure the ldm instruction can be
|
| @@ -3374,31 +3367,28 @@ void MacroAssembler::Allocate(Register object_size, Register result,
|
| AllocationUtils::GetAllocationTopReference(isolate(), flags);
|
| ExternalReference allocation_limit =
|
| AllocationUtils::GetAllocationLimitReference(isolate(), flags);
|
| - intptr_t top =
|
| - reinterpret_cast<intptr_t>(allocation_top.address());
|
| - intptr_t limit =
|
| - reinterpret_cast<intptr_t>(allocation_limit.address());
|
| + intptr_t top = reinterpret_cast<intptr_t>(allocation_top.address());
|
| + intptr_t limit = reinterpret_cast<intptr_t>(allocation_limit.address());
|
| DCHECK((limit - top) == kPointerSize);
|
|
|
| - // Set up allocation top address and object size registers.
|
| - Register topaddr = scratch1;
|
| - li(topaddr, Operand(allocation_top));
|
| -
|
| + // Set up allocation top address and allocation limit registers.
|
| + Register top_address = scratch;
|
| // This code stores a temporary value in t9.
|
| + Register alloc_limit = t9;
|
| + li(top_address, Operand(allocation_top));
|
| +
|
| if ((flags & RESULT_CONTAINS_TOP) == 0) {
|
| - // Load allocation top into result and allocation limit into t9.
|
| - lw(result, MemOperand(topaddr));
|
| - lw(t9, MemOperand(topaddr, kPointerSize));
|
| + // Load allocation top into result and allocation limit into alloc_limit.
|
| + lw(result, MemOperand(top_address));
|
| + lw(alloc_limit, MemOperand(top_address, kPointerSize));
|
| } else {
|
| if (emit_debug_code()) {
|
| - // Assert that result actually contains top on entry. t9 is used
|
| - // immediately below so this use of t9 does not cause difference with
|
| - // respect to register content between debug and release mode.
|
| - lw(t9, MemOperand(topaddr));
|
| - Check(eq, kUnexpectedAllocationTop, result, Operand(t9));
|
| + // Assert that result actually contains top on entry.
|
| + lw(alloc_limit, MemOperand(top_address));
|
| + Check(eq, kUnexpectedAllocationTop, result, Operand(alloc_limit));
|
| }
|
| - // Load allocation limit into t9. Result already contains allocation top.
|
| - lw(t9, MemOperand(topaddr, limit - top));
|
| + // Load allocation limit. Result already contains allocation top.
|
| + lw(alloc_limit, MemOperand(top_address, limit - top));
|
| }
|
|
|
| if ((flags & DOUBLE_ALIGNMENT) != 0) {
|
| @@ -3409,7 +3399,7 @@ void MacroAssembler::Allocate(Register object_size, Register result,
|
| Label aligned;
|
| Branch(&aligned, eq, result_end, Operand(zero_reg));
|
| if ((flags & PRETENURE) != 0) {
|
| - Branch(gc_required, Ugreater_equal, result, Operand(t9));
|
| + Branch(gc_required, Ugreater_equal, result, Operand(alloc_limit));
|
| }
|
| li(result_end, Operand(isolate()->factory()->one_pointer_filler_map()));
|
| sw(result_end, MemOperand(result));
|
| @@ -3426,14 +3416,14 @@ void MacroAssembler::Allocate(Register object_size, Register result,
|
| } else {
|
| Addu(result_end, result, Operand(object_size));
|
| }
|
| - Branch(gc_required, Ugreater, result_end, Operand(t9));
|
| + Branch(gc_required, Ugreater, result_end, Operand(alloc_limit));
|
|
|
| // Update allocation top. result temporarily holds the new top.
|
| if (emit_debug_code()) {
|
| - And(t9, result_end, Operand(kObjectAlignmentMask));
|
| - Check(eq, kUnalignedAllocationInNewSpace, t9, Operand(zero_reg));
|
| + And(alloc_limit, result_end, Operand(kObjectAlignmentMask));
|
| + Check(eq, kUnalignedAllocationInNewSpace, alloc_limit, Operand(zero_reg));
|
| }
|
| - sw(result_end, MemOperand(topaddr));
|
| + sw(result_end, MemOperand(top_address));
|
|
|
| // Tag object if requested.
|
| if ((flags & TAG_OBJECT) != 0) {
|
|
|