Index: src/mips/codegen-mips.cc |
diff --git a/src/mips/codegen-mips.cc b/src/mips/codegen-mips.cc |
index 8aaeaca367860d623132e57def80f6dee80a1b46..376113fa88741e3a24c89afc354d25b3d2800c75 100644 |
--- a/src/mips/codegen-mips.cc |
+++ b/src/mips/codegen-mips.cc |
@@ -605,351 +605,6 @@ void StubRuntimeCallHelper::AfterCall(MacroAssembler* masm) const { |
#define __ ACCESS_MASM(masm) |
-void ElementsTransitionGenerator::GenerateMapChangeElementsTransition( |
- MacroAssembler* masm, |
- Register receiver, |
- Register key, |
- Register value, |
- Register target_map, |
- AllocationSiteMode mode, |
- Label* allocation_memento_found) { |
- Register scratch_elements = t0; |
- DCHECK(!AreAliased(receiver, key, value, target_map, |
- scratch_elements)); |
- |
- if (mode == TRACK_ALLOCATION_SITE) { |
- DCHECK(allocation_memento_found != NULL); |
- __ JumpIfJSArrayHasAllocationMemento( |
- receiver, scratch_elements, allocation_memento_found); |
- } |
- |
- // Set transitioned map. |
- __ sw(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
- __ RecordWriteField(receiver, |
- HeapObject::kMapOffset, |
- target_map, |
- t5, |
- kRAHasNotBeenSaved, |
- kDontSaveFPRegs, |
- EMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
-} |
- |
- |
-void ElementsTransitionGenerator::GenerateSmiToDouble( |
- MacroAssembler* masm, |
- Register receiver, |
- Register key, |
- Register value, |
- Register target_map, |
- AllocationSiteMode mode, |
- Label* fail) { |
- // Register ra contains the return address. |
- Label loop, entry, convert_hole, gc_required, only_change_map, done; |
- Register elements = t0; |
- Register length = t1; |
- Register array = t2; |
- Register array_end = array; |
- |
- // target_map parameter can be clobbered. |
- Register scratch1 = target_map; |
- Register scratch2 = t5; |
- Register scratch3 = t3; |
- |
- // Verify input registers don't conflict with locals. |
- DCHECK(!AreAliased(receiver, key, value, target_map, |
- elements, length, array, scratch2)); |
- |
- Register scratch = t6; |
- |
- if (mode == TRACK_ALLOCATION_SITE) { |
- __ JumpIfJSArrayHasAllocationMemento(receiver, elements, fail); |
- } |
- |
- // Check for empty arrays, which only require a map transition and no changes |
- // to the backing store. |
- __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
- __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex); |
- __ Branch(&only_change_map, eq, at, Operand(elements)); |
- |
- __ push(ra); |
- __ lw(length, FieldMemOperand(elements, FixedArray::kLengthOffset)); |
- // elements: source FixedArray |
- // length: number of elements (smi-tagged) |
- |
- // Allocate new FixedDoubleArray. |
- __ sll(scratch, length, 2); |
- __ Addu(scratch, scratch, FixedDoubleArray::kHeaderSize); |
- __ Allocate(scratch, array, t3, scratch2, &gc_required, DOUBLE_ALIGNMENT); |
- // array: destination FixedDoubleArray, tagged as heap object |
- |
- // Set destination FixedDoubleArray's length and map. |
- __ LoadRoot(scratch2, Heap::kFixedDoubleArrayMapRootIndex); |
- __ sw(length, FieldMemOperand(array, FixedDoubleArray::kLengthOffset)); |
- // Update receiver's map. |
- __ sw(scratch2, FieldMemOperand(array, HeapObject::kMapOffset)); |
- |
- __ sw(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
- __ RecordWriteField(receiver, |
- HeapObject::kMapOffset, |
- target_map, |
- scratch2, |
- kRAHasBeenSaved, |
- kDontSaveFPRegs, |
- OMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
- // Replace receiver's backing store with newly created FixedDoubleArray. |
- __ Addu(scratch1, array, Operand(kHeapObjectTag - kHeapObjectTag)); |
- __ sw(scratch1, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
- __ RecordWriteField(receiver, |
- JSObject::kElementsOffset, |
- scratch1, |
- scratch2, |
- kRAHasBeenSaved, |
- kDontSaveFPRegs, |
- EMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
- |
- |
- // Prepare for conversion loop. |
- __ Addu(scratch1, elements, |
- Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
- __ Addu(scratch3, array, |
- Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag)); |
- __ Lsa(array_end, scratch3, length, 2); |
- |
- // Repurpose registers no longer in use. |
- Register hole_lower = elements; |
- Register hole_upper = length; |
- __ li(hole_lower, Operand(kHoleNanLower32)); |
- __ li(hole_upper, Operand(kHoleNanUpper32)); |
- |
- // scratch1: begin of source FixedArray element fields, not tagged |
- // hole_lower: kHoleNanLower32 |
- // hole_upper: kHoleNanUpper32 |
- // array_end: end of destination FixedDoubleArray, not tagged |
- // scratch3: begin of FixedDoubleArray element fields, not tagged |
- |
- __ Branch(&entry); |
- |
- __ bind(&only_change_map); |
- __ sw(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
- __ RecordWriteField(receiver, |
- HeapObject::kMapOffset, |
- target_map, |
- scratch2, |
- kRAHasBeenSaved, |
- kDontSaveFPRegs, |
- OMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
- __ Branch(&done); |
- |
- // Call into runtime if GC is required. |
- __ bind(&gc_required); |
- __ lw(ra, MemOperand(sp, 0)); |
- __ Branch(USE_DELAY_SLOT, fail); |
- __ addiu(sp, sp, kPointerSize); // In delay slot. |
- |
- // Convert and copy elements. |
- __ bind(&loop); |
- __ lw(scratch2, MemOperand(scratch1)); |
- __ Addu(scratch1, scratch1, kIntSize); |
- // scratch2: current element |
- __ UntagAndJumpIfNotSmi(scratch2, scratch2, &convert_hole); |
- |
- // Normal smi, convert to double and store. |
- __ mtc1(scratch2, f0); |
- __ cvt_d_w(f0, f0); |
- __ sdc1(f0, MemOperand(scratch3)); |
- __ Branch(USE_DELAY_SLOT, &entry); |
- __ addiu(scratch3, scratch3, kDoubleSize); // In delay slot. |
- |
- // Hole found, store the-hole NaN. |
- __ bind(&convert_hole); |
- if (FLAG_debug_code) { |
- // Restore a "smi-untagged" heap object. |
- __ SmiTag(scratch2); |
- __ Or(scratch2, scratch2, Operand(1)); |
- __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
- __ Assert(eq, kObjectFoundInSmiOnlyArray, at, Operand(scratch2)); |
- } |
- // mantissa |
- __ sw(hole_lower, MemOperand(scratch3, Register::kMantissaOffset)); |
- // exponent |
- __ sw(hole_upper, MemOperand(scratch3, Register::kExponentOffset)); |
- __ addiu(scratch3, scratch3, kDoubleSize); |
- |
- __ bind(&entry); |
- __ Branch(&loop, lt, scratch3, Operand(array_end)); |
- |
- __ bind(&done); |
- __ pop(ra); |
-} |
- |
- |
-void ElementsTransitionGenerator::GenerateDoubleToObject( |
- MacroAssembler* masm, |
- Register receiver, |
- Register key, |
- Register value, |
- Register target_map, |
- AllocationSiteMode mode, |
- Label* fail) { |
- // Register ra contains the return address. |
- Label entry, loop, convert_hole, gc_required, only_change_map; |
- Register elements = t0; |
- Register array = t2; |
- Register length = t1; |
- Register scratch = t5; |
- |
- // Verify input registers don't conflict with locals. |
- DCHECK(!AreAliased(receiver, key, value, target_map, |
- elements, array, length, scratch)); |
- |
- if (mode == TRACK_ALLOCATION_SITE) { |
- __ JumpIfJSArrayHasAllocationMemento(receiver, elements, fail); |
- } |
- |
- // Check for empty arrays, which only require a map transition and no changes |
- // to the backing store. |
- __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
- __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex); |
- __ Branch(&only_change_map, eq, at, Operand(elements)); |
- |
- __ MultiPush( |
- value.bit() | key.bit() | receiver.bit() | target_map.bit() | ra.bit()); |
- |
- __ lw(length, FieldMemOperand(elements, FixedArray::kLengthOffset)); |
- // elements: source FixedArray |
- // length: number of elements (smi-tagged) |
- |
- // Allocate new FixedArray. |
- // Re-use value and target_map registers, as they have been saved on the |
- // stack. |
- Register array_size = value; |
- Register allocate_scratch = target_map; |
- __ sll(array_size, length, 1); |
- __ Addu(array_size, array_size, FixedDoubleArray::kHeaderSize); |
- __ Allocate(array_size, array, allocate_scratch, scratch, &gc_required, |
- NO_ALLOCATION_FLAGS); |
- // array: destination FixedArray, not tagged as heap object |
- // Set destination FixedDoubleArray's length and map. |
- __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex); |
- __ sw(length, FieldMemOperand(array, FixedDoubleArray::kLengthOffset)); |
- __ sw(scratch, FieldMemOperand(array, HeapObject::kMapOffset)); |
- |
- // Prepare for conversion loop. |
- Register src_elements = elements; |
- Register dst_elements = target_map; |
- Register dst_end = length; |
- Register heap_number_map = scratch; |
- __ Addu(src_elements, src_elements, Operand( |
- FixedDoubleArray::kHeaderSize - kHeapObjectTag |
- + Register::kExponentOffset)); |
- __ Addu(dst_elements, array, |
- Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
- __ Lsa(dst_end, dst_elements, dst_end, 1); |
- |
- // Allocating heap numbers in the loop below can fail and cause a jump to |
- // gc_required. We can't leave a partly initialized FixedArray behind, |
- // so pessimistically fill it with holes now. |
- Label initialization_loop, initialization_loop_entry; |
- __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); |
- __ Branch(&initialization_loop_entry); |
- __ bind(&initialization_loop); |
- __ sw(scratch, MemOperand(dst_elements)); |
- __ Addu(dst_elements, dst_elements, Operand(kPointerSize)); |
- __ bind(&initialization_loop_entry); |
- __ Branch(&initialization_loop, lt, dst_elements, Operand(dst_end)); |
- |
- __ Addu(dst_elements, array, |
- Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
- __ LoadRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); |
- // Using offsetted addresses. |
- // dst_elements: begin of destination FixedArray element fields, not tagged |
- // src_elements: begin of source FixedDoubleArray element fields, not tagged, |
- // points to the exponent |
- // dst_end: end of destination FixedArray, not tagged |
- // array: destination FixedArray |
- // heap_number_map: heap number map |
- __ Branch(&entry); |
- |
- // Call into runtime if GC is required. |
- __ bind(&gc_required); |
- __ MultiPop( |
- value.bit() | key.bit() | receiver.bit() | target_map.bit() | ra.bit()); |
- |
- __ Branch(fail); |
- |
- __ bind(&loop); |
- Register upper_bits = key; |
- __ lw(upper_bits, MemOperand(src_elements)); |
- __ Addu(src_elements, src_elements, kDoubleSize); |
- // upper_bits: current element's upper 32 bit |
- // src_elements: address of next element's upper 32 bit |
- __ Branch(&convert_hole, eq, a1, Operand(kHoleNanUpper32)); |
- |
- // Non-hole double, copy value into a heap number. |
- Register heap_number = receiver; |
- Register scratch2 = value; |
- Register scratch3 = t6; |
- __ AllocateHeapNumber(heap_number, scratch2, scratch3, heap_number_map, |
- &gc_required); |
- // heap_number: new heap number |
- // Load mantissa of current element, src_elements |
- // point to exponent of next element. |
- __ lw(scratch2, MemOperand(src_elements, (Register::kMantissaOffset |
- - Register::kExponentOffset - kDoubleSize))); |
- __ sw(scratch2, FieldMemOperand(heap_number, HeapNumber::kMantissaOffset)); |
- __ sw(upper_bits, FieldMemOperand(heap_number, HeapNumber::kExponentOffset)); |
- __ mov(scratch2, dst_elements); |
- __ sw(heap_number, MemOperand(dst_elements)); |
- __ Addu(dst_elements, dst_elements, kIntSize); |
- __ RecordWrite(array, |
- scratch2, |
- heap_number, |
- kRAHasBeenSaved, |
- kDontSaveFPRegs, |
- EMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
- __ Branch(&entry); |
- |
- // Replace the-hole NaN with the-hole pointer. |
- __ bind(&convert_hole); |
- __ LoadRoot(scratch2, Heap::kTheHoleValueRootIndex); |
- __ sw(scratch2, MemOperand(dst_elements)); |
- __ Addu(dst_elements, dst_elements, kIntSize); |
- |
- __ bind(&entry); |
- __ Branch(&loop, lt, dst_elements, Operand(dst_end)); |
- |
- __ MultiPop(receiver.bit() | target_map.bit() | value.bit() | key.bit()); |
- // Replace receiver's backing store with newly created and filled FixedArray. |
- __ sw(array, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
- __ RecordWriteField(receiver, |
- JSObject::kElementsOffset, |
- array, |
- scratch, |
- kRAHasBeenSaved, |
- kDontSaveFPRegs, |
- EMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
- __ pop(ra); |
- |
- __ bind(&only_change_map); |
- // Update receiver's map. |
- __ sw(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
- __ RecordWriteField(receiver, |
- HeapObject::kMapOffset, |
- target_map, |
- scratch, |
- kRAHasNotBeenSaved, |
- kDontSaveFPRegs, |
- OMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
-} |
- |
- |
void StringCharLoadGenerator::Generate(MacroAssembler* masm, |
Register string, |
Register index, |