| Index: src/mips/codegen-mips.cc
|
| diff --git a/src/mips/codegen-mips.cc b/src/mips/codegen-mips.cc
|
| index c48432c7022bb3ec763306902ab4d80755cc9e54..d7bddaf1252f6b9b72ed9c7760ed1c2c4525cdd4 100644
|
| --- a/src/mips/codegen-mips.cc
|
| +++ b/src/mips/codegen-mips.cc
|
| @@ -89,13 +89,18 @@ void ElementsTransitionGenerator::GenerateSmiOnlyToDouble(
|
| // -- a3 : target map, scratch for subsequent call
|
| // -- t0 : scratch (elements)
|
| // -----------------------------------
|
| - Label loop, entry, convert_hole, gc_required;
|
| + Label loop, entry, convert_hole, gc_required, only_change_map, done;
|
| bool fpu_supported = CpuFeatures::IsSupported(FPU);
|
| - __ push(ra);
|
|
|
| Register scratch = t6;
|
|
|
| + // Check for empty arrays, which only require a map transition and no changes
|
| + // to the backing store.
|
| __ lw(t0, FieldMemOperand(a2, JSObject::kElementsOffset));
|
| + __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex);
|
| + __ Branch(&only_change_map, eq, at, Operand(t0));
|
| +
|
| + __ push(ra);
|
| __ lw(t1, FieldMemOperand(t0, FixedArray::kLengthOffset));
|
| // t0: source FixedArray
|
| // t1: number of elements (smi-tagged)
|
| @@ -118,7 +123,7 @@ void ElementsTransitionGenerator::GenerateSmiOnlyToDouble(
|
| t5,
|
| kRAHasBeenSaved,
|
| kDontSaveFPRegs,
|
| - EMIT_REMEMBERED_SET,
|
| + OMIT_REMEMBERED_SET,
|
| OMIT_SMI_CHECK);
|
| // Replace receiver's backing store with newly created FixedDoubleArray.
|
| __ Addu(a3, t2, Operand(kHeapObjectTag));
|
| @@ -149,6 +154,18 @@ void ElementsTransitionGenerator::GenerateSmiOnlyToDouble(
|
|
|
| __ Branch(&entry);
|
|
|
| + __ bind(&only_change_map);
|
| + __ sw(a3, FieldMemOperand(a2, HeapObject::kMapOffset));
|
| + __ RecordWriteField(a2,
|
| + HeapObject::kMapOffset,
|
| + a3,
|
| + t5,
|
| + kRAHasBeenSaved,
|
| + kDontSaveFPRegs,
|
| + OMIT_REMEMBERED_SET,
|
| + OMIT_SMI_CHECK);
|
| + __ Branch(&done);
|
| +
|
| // Call into runtime if GC is required.
|
| __ bind(&gc_required);
|
| __ pop(ra);
|
| @@ -201,6 +218,7 @@ void ElementsTransitionGenerator::GenerateSmiOnlyToDouble(
|
|
|
| if (!fpu_supported) __ Pop(a1, a0);
|
| __ pop(ra);
|
| + __ bind(&done);
|
| }
|
|
|
|
|
| @@ -214,10 +232,16 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
|
| // -- a3 : target map, scratch for subsequent call
|
| // -- t0 : scratch (elements)
|
| // -----------------------------------
|
| - Label entry, loop, convert_hole, gc_required;
|
| - __ MultiPush(a0.bit() | a1.bit() | a2.bit() | a3.bit() | ra.bit());
|
| + Label entry, loop, convert_hole, gc_required, only_change_map;
|
|
|
| + // Check for empty arrays, which only require a map transition and no changes
|
| + // to the backing store.
|
| __ lw(t0, FieldMemOperand(a2, JSObject::kElementsOffset));
|
| + __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex);
|
| + __ Branch(&only_change_map, eq, at, Operand(t0));
|
| +
|
| + __ MultiPush(a0.bit() | a1.bit() | a2.bit() | a3.bit() | ra.bit());
|
| +
|
| __ lw(t1, FieldMemOperand(t0, FixedArray::kLengthOffset));
|
| // t0: source FixedArray
|
| // t1: number of elements (smi-tagged)
|
| @@ -289,16 +313,6 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
|
| __ Branch(&loop, lt, a3, Operand(t1));
|
|
|
| __ MultiPop(a2.bit() | a3.bit() | a0.bit() | a1.bit());
|
| - // Update receiver's map.
|
| - __ sw(a3, FieldMemOperand(a2, HeapObject::kMapOffset));
|
| - __ RecordWriteField(a2,
|
| - HeapObject::kMapOffset,
|
| - a3,
|
| - t5,
|
| - kRAHasBeenSaved,
|
| - kDontSaveFPRegs,
|
| - EMIT_REMEMBERED_SET,
|
| - OMIT_SMI_CHECK);
|
| // Replace receiver's backing store with newly created and filled FixedArray.
|
| __ sw(t2, FieldMemOperand(a2, JSObject::kElementsOffset));
|
| __ RecordWriteField(a2,
|
| @@ -310,6 +324,18 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
|
| EMIT_REMEMBERED_SET,
|
| OMIT_SMI_CHECK);
|
| __ pop(ra);
|
| +
|
| + __ bind(&only_change_map);
|
| + // Update receiver's map.
|
| + __ sw(a3, FieldMemOperand(a2, HeapObject::kMapOffset));
|
| + __ RecordWriteField(a2,
|
| + HeapObject::kMapOffset,
|
| + a3,
|
| + t5,
|
| + kRAHasNotBeenSaved,
|
| + kDontSaveFPRegs,
|
| + OMIT_REMEMBERED_SET,
|
| + OMIT_SMI_CHECK);
|
| }
|
|
|
|
|
|
|