| Index: src/mips64/codegen-mips64.cc
 | 
| diff --git a/src/mips64/codegen-mips64.cc b/src/mips64/codegen-mips64.cc
 | 
| index 943c2a6e639a0314667411be3365563f36fb6d37..689bcce5b32190cef030b31f854575a5bb628e06 100644
 | 
| --- a/src/mips64/codegen-mips64.cc
 | 
| +++ b/src/mips64/codegen-mips64.cc
 | 
| @@ -607,348 +607,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 = a4;
 | 
| -  DCHECK(!AreAliased(receiver, key, value, target_map,
 | 
| -                     scratch_elements));
 | 
| -
 | 
| -  if (mode == TRACK_ALLOCATION_SITE) {
 | 
| -    __ JumpIfJSArrayHasAllocationMemento(
 | 
| -        receiver, scratch_elements, allocation_memento_found);
 | 
| -  }
 | 
| -
 | 
| -  // Set transitioned map.
 | 
| -  __ sd(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset));
 | 
| -  __ RecordWriteField(receiver,
 | 
| -                      HeapObject::kMapOffset,
 | 
| -                      target_map,
 | 
| -                      t1,
 | 
| -                      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 = a4;
 | 
| -  Register length = a5;
 | 
| -  Register array = a6;
 | 
| -  Register array_end = array;
 | 
| -
 | 
| -  // target_map parameter can be clobbered.
 | 
| -  Register scratch1 = target_map;
 | 
| -  Register scratch2 = t1;
 | 
| -  Register scratch3 = a7;
 | 
| -
 | 
| -  // Verify input registers don't conflict with locals.
 | 
| -  DCHECK(!AreAliased(receiver, key, value, target_map,
 | 
| -                     elements, length, array, scratch2));
 | 
| -
 | 
| -  Register scratch = t2;
 | 
| -  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.
 | 
| -  __ ld(elements, FieldMemOperand(receiver, JSObject::kElementsOffset));
 | 
| -  __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex);
 | 
| -  __ Branch(&only_change_map, eq, at, Operand(elements));
 | 
| -
 | 
| -  __ push(ra);
 | 
| -  __ ld(length, FieldMemOperand(elements, FixedArray::kLengthOffset));
 | 
| -  // elements: source FixedArray
 | 
| -  // length: number of elements (smi-tagged)
 | 
| -
 | 
| -  // Allocate new FixedDoubleArray.
 | 
| -  __ SmiScale(scratch, length, kDoubleSizeLog2);
 | 
| -  __ Daddu(scratch, scratch, FixedDoubleArray::kHeaderSize);
 | 
| -  __ Allocate(scratch, array, t3, scratch2, &gc_required, DOUBLE_ALIGNMENT);
 | 
| -  __ Dsubu(array, array, kHeapObjectTag);
 | 
| -  // array: destination FixedDoubleArray, not tagged as heap object
 | 
| -
 | 
| -  // Set destination FixedDoubleArray's length and map.
 | 
| -  __ LoadRoot(scratch2, Heap::kFixedDoubleArrayMapRootIndex);
 | 
| -  __ sd(length, MemOperand(array, FixedDoubleArray::kLengthOffset));
 | 
| -  // Update receiver's map.
 | 
| -  __ sd(scratch2, MemOperand(array, HeapObject::kMapOffset));
 | 
| -
 | 
| -  __ sd(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.
 | 
| -  __ Daddu(scratch1, array, Operand(kHeapObjectTag));
 | 
| -  __ sd(scratch1, FieldMemOperand(receiver, JSObject::kElementsOffset));
 | 
| -  __ RecordWriteField(receiver,
 | 
| -                      JSObject::kElementsOffset,
 | 
| -                      scratch1,
 | 
| -                      scratch2,
 | 
| -                      kRAHasBeenSaved,
 | 
| -                      kDontSaveFPRegs,
 | 
| -                      EMIT_REMEMBERED_SET,
 | 
| -                      OMIT_SMI_CHECK);
 | 
| -
 | 
| -
 | 
| -  // Prepare for conversion loop.
 | 
| -  __ Daddu(scratch1, elements,
 | 
| -      Operand(FixedArray::kHeaderSize - kHeapObjectTag));
 | 
| -  __ Daddu(scratch3, array, Operand(FixedDoubleArray::kHeaderSize));
 | 
| -  __ SmiScale(array_end, length, kDoubleSizeLog2);
 | 
| -  __ Daddu(array_end, array_end, scratch3);
 | 
| -
 | 
| -  // 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);
 | 
| -  __ sd(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);
 | 
| -  __ ld(ra, MemOperand(sp, 0));
 | 
| -  __ Branch(USE_DELAY_SLOT, fail);
 | 
| -  __ daddiu(sp, sp, kPointerSize);  // In delay slot.
 | 
| -
 | 
| -  // Convert and copy elements.
 | 
| -  __ bind(&loop);
 | 
| -  __ ld(scratch2, MemOperand(scratch1));
 | 
| -  __ Daddu(scratch1, scratch1, kPointerSize);
 | 
| -  // scratch2: current element
 | 
| -  __ JumpIfNotSmi(scratch2, &convert_hole);
 | 
| -  __ SmiUntag(scratch2);
 | 
| -
 | 
| -  // Normal smi, convert to double and store.
 | 
| -  __ mtc1(scratch2, f0);
 | 
| -  __ cvt_d_w(f0, f0);
 | 
| -  __ sdc1(f0, MemOperand(scratch3));
 | 
| -  __ Branch(USE_DELAY_SLOT, &entry);
 | 
| -  __ daddiu(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.
 | 
| -    __ 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));
 | 
| -  __ Daddu(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 = a4;
 | 
| -  Register array = a6;
 | 
| -  Register length = a5;
 | 
| -  Register scratch = t1;
 | 
| -
 | 
| -  // 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.
 | 
| -  __ ld(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());
 | 
| -
 | 
| -  __ ld(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;
 | 
| -  __ SmiScale(array_size, length, kPointerSizeLog2);
 | 
| -  __ Daddu(array_size, array_size, FixedDoubleArray::kHeaderSize);
 | 
| -  __ Allocate(array_size, array, allocate_scratch, scratch, &gc_required,
 | 
| -              NO_ALLOCATION_FLAGS);
 | 
| -  __ Dsubu(array, array, kHeapObjectTag);
 | 
| -  // array: destination FixedArray, not tagged as heap object
 | 
| -  // Set destination FixedDoubleArray's length and map.
 | 
| -  __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex);
 | 
| -  __ sd(length, MemOperand(array, FixedDoubleArray::kLengthOffset));
 | 
| -  __ sd(scratch, MemOperand(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;
 | 
| -  __ Daddu(src_elements, src_elements,
 | 
| -           Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag));
 | 
| -  __ Daddu(dst_elements, array, Operand(FixedArray::kHeaderSize));
 | 
| -  __ SmiScale(dst_end, dst_end, kPointerSizeLog2);
 | 
| -  __ Daddu(dst_end, dst_elements, dst_end);
 | 
| -
 | 
| -  // 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);
 | 
| -  __ sd(scratch, MemOperand(dst_elements));
 | 
| -  __ Daddu(dst_elements, dst_elements, Operand(kPointerSize));
 | 
| -  __ bind(&initialization_loop_entry);
 | 
| -  __ Branch(&initialization_loop, lt, dst_elements, Operand(dst_end));
 | 
| -
 | 
| -  __ Daddu(dst_elements, array, Operand(FixedArray::kHeaderSize));
 | 
| -  __ Daddu(array, array, Operand(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, Register::kExponentOffset));
 | 
| -  __ Daddu(src_elements, src_elements, kDoubleSize);
 | 
| -  // upper_bits: current element's upper 32 bit
 | 
| -  // src_elements: address of next element
 | 
| -  __ 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 = t2;
 | 
| -  __ AllocateHeapNumber(heap_number, scratch2, scratch3, heap_number_map,
 | 
| -                        &gc_required);
 | 
| -  // heap_number: new heap number
 | 
| -  // Load current element, src_elements point to next element.
 | 
| -
 | 
| -  __ ld(scratch2, MemOperand(src_elements, -kDoubleSize));
 | 
| -  __ sd(scratch2, FieldMemOperand(heap_number, HeapNumber::kValueOffset));
 | 
| -
 | 
| -  __ mov(scratch2, dst_elements);
 | 
| -  __ sd(heap_number, MemOperand(dst_elements));
 | 
| -  __ Daddu(dst_elements, dst_elements, kPointerSize);
 | 
| -  __ 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);
 | 
| -  __ sd(scratch2, MemOperand(dst_elements));
 | 
| -  __ Daddu(dst_elements, dst_elements, kPointerSize);
 | 
| -
 | 
| -  __ 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.
 | 
| -  __ sd(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.
 | 
| -  __ sd(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,
 | 
| 
 |