Index: src/arm/codegen-arm.cc |
diff --git a/src/arm/codegen-arm.cc b/src/arm/codegen-arm.cc |
index e63da5c766c8f87c4c828b87c2cb9ff5ec46fec5..e80bac47dccb6aeef1e381716924a9986a7ad56a 100644 |
--- a/src/arm/codegen-arm.cc |
+++ b/src/arm/codegen-arm.cc |
@@ -317,337 +317,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 = r4; |
- 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. |
- __ str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
- __ RecordWriteField(receiver, |
- HeapObject::kMapOffset, |
- target_map, |
- r9, |
- kLRHasNotBeenSaved, |
- 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 lr contains the return address. |
- Label loop, entry, convert_hole, gc_required, only_change_map, done; |
- Register elements = r4; |
- Register length = r5; |
- Register array = r6; |
- Register array_end = array; |
- |
- // target_map parameter can be clobbered. |
- Register scratch1 = target_map; |
- Register scratch2 = r9; |
- |
- // Verify input registers don't conflict with locals. |
- DCHECK(!AreAliased(receiver, key, value, target_map, |
- elements, length, array, scratch2)); |
- |
- 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. |
- __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
- __ CompareRoot(elements, Heap::kEmptyFixedArrayRootIndex); |
- __ b(eq, &only_change_map); |
- |
- __ push(lr); |
- __ ldr(length, FieldMemOperand(elements, FixedArray::kLengthOffset)); |
- // length: number of elements (smi-tagged) |
- |
- // Allocate new FixedDoubleArray. |
- // Use lr as a temporary register. |
- __ mov(lr, Operand(length, LSL, 2)); |
- __ add(lr, lr, Operand(FixedDoubleArray::kHeaderSize)); |
- __ Allocate(lr, array, elements, scratch2, &gc_required, DOUBLE_ALIGNMENT); |
- __ sub(array, array, Operand(kHeapObjectTag)); |
- // array: destination FixedDoubleArray, not tagged as heap object. |
- __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
- // r4: source FixedArray. |
- |
- // Set destination FixedDoubleArray's length and map. |
- __ LoadRoot(scratch2, Heap::kFixedDoubleArrayMapRootIndex); |
- __ str(length, MemOperand(array, FixedDoubleArray::kLengthOffset)); |
- // Update receiver's map. |
- __ str(scratch2, MemOperand(array, HeapObject::kMapOffset)); |
- |
- __ str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
- __ RecordWriteField(receiver, |
- HeapObject::kMapOffset, |
- target_map, |
- scratch2, |
- kLRHasBeenSaved, |
- kDontSaveFPRegs, |
- OMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
- // Replace receiver's backing store with newly created FixedDoubleArray. |
- __ add(scratch1, array, Operand(kHeapObjectTag)); |
- __ str(scratch1, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
- __ RecordWriteField(receiver, |
- JSObject::kElementsOffset, |
- scratch1, |
- scratch2, |
- kLRHasBeenSaved, |
- kDontSaveFPRegs, |
- EMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
- |
- // Prepare for conversion loop. |
- __ add(scratch1, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
- __ add(scratch2, array, Operand(FixedDoubleArray::kHeaderSize)); |
- __ add(array_end, scratch2, Operand(length, LSL, 2)); |
- |
- // Repurpose registers no longer in use. |
- Register hole_lower = elements; |
- Register hole_upper = length; |
- |
- __ mov(hole_lower, Operand(kHoleNanLower32)); |
- __ mov(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 |
- // scratch2: begin of FixedDoubleArray element fields, not tagged |
- |
- __ b(&entry); |
- |
- __ bind(&only_change_map); |
- __ str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
- __ RecordWriteField(receiver, |
- HeapObject::kMapOffset, |
- target_map, |
- scratch2, |
- kLRHasNotBeenSaved, |
- kDontSaveFPRegs, |
- OMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
- __ b(&done); |
- |
- // Call into runtime if GC is required. |
- __ bind(&gc_required); |
- __ pop(lr); |
- __ b(fail); |
- |
- // Convert and copy elements. |
- __ bind(&loop); |
- __ ldr(lr, MemOperand(scratch1, 4, PostIndex)); |
- // lr: current element |
- __ UntagAndJumpIfNotSmi(lr, lr, &convert_hole); |
- |
- // Normal smi, convert to double and store. |
- __ vmov(s0, lr); |
- __ vcvt_f64_s32(d0, s0); |
- __ vstr(d0, scratch2, 0); |
- __ add(scratch2, scratch2, Operand(8)); |
- __ b(&entry); |
- |
- // Hole found, store the-hole NaN. |
- __ bind(&convert_hole); |
- if (FLAG_debug_code) { |
- // Restore a "smi-untagged" heap object. |
- __ SmiTag(lr); |
- __ orr(lr, lr, Operand(1)); |
- __ CompareRoot(lr, Heap::kTheHoleValueRootIndex); |
- __ Assert(eq, kObjectFoundInSmiOnlyArray); |
- } |
- __ Strd(hole_lower, hole_upper, MemOperand(scratch2, 8, PostIndex)); |
- |
- __ bind(&entry); |
- __ cmp(scratch2, array_end); |
- __ b(lt, &loop); |
- |
- __ pop(lr); |
- __ bind(&done); |
-} |
- |
- |
-void ElementsTransitionGenerator::GenerateDoubleToObject( |
- MacroAssembler* masm, |
- Register receiver, |
- Register key, |
- Register value, |
- Register target_map, |
- AllocationSiteMode mode, |
- Label* fail) { |
- // Register lr contains the return address. |
- Label entry, loop, convert_hole, gc_required, only_change_map; |
- Register elements = r4; |
- Register array = r6; |
- Register length = r5; |
- Register scratch = r9; |
- |
- // 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. |
- __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
- __ CompareRoot(elements, Heap::kEmptyFixedArrayRootIndex); |
- __ b(eq, &only_change_map); |
- |
- __ push(lr); |
- __ Push(target_map, receiver, key, value); |
- __ ldr(length, FieldMemOperand(elements, FixedArray::kLengthOffset)); |
- // elements: source FixedDoubleArray |
- // 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; |
- __ mov(array_size, Operand(FixedDoubleArray::kHeaderSize)); |
- __ add(array_size, array_size, Operand(length, LSL, 1)); |
- __ Allocate(array_size, array, allocate_scratch, scratch, &gc_required, |
- NO_ALLOCATION_FLAGS); |
- // array: destination FixedArray, tagged as heap object |
- // Set destination FixedDoubleArray's length and map. |
- __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex); |
- __ str(length, FieldMemOperand(array, FixedDoubleArray::kLengthOffset)); |
- __ str(scratch, FieldMemOperand(array, HeapObject::kMapOffset)); |
- |
- __ sub(array, array, Operand(kHeapObjectTag)); |
- |
- // Prepare for conversion loop. |
- Register src_elements = elements; |
- Register dst_elements = target_map; |
- Register dst_end = length; |
- Register heap_number_map = scratch; |
- __ add(src_elements, elements, |
- Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag + 4)); |
- __ add(dst_elements, array, Operand(FixedArray::kHeaderSize)); |
- __ add(dst_end, dst_elements, Operand(length, LSL, 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); |
- __ b(&initialization_loop_entry); |
- __ bind(&initialization_loop); |
- __ str(scratch, MemOperand(dst_elements, kPointerSize, PostIndex)); |
- __ bind(&initialization_loop_entry); |
- __ cmp(dst_elements, dst_end); |
- __ b(lt, &initialization_loop); |
- |
- __ add(dst_elements, array, Operand(FixedArray::kHeaderSize)); |
- __ add(array, array, Operand(kHeapObjectTag)); |
- __ LoadRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); |
- // Using offsetted addresses in src_elements to fully take advantage of |
- // post-indexing. |
- // dst_elements: begin of destination FixedArray element fields, not tagged |
- // src_elements: begin of source FixedDoubleArray element fields, |
- // not tagged, +4 |
- // dst_end: end of destination FixedArray, not tagged |
- // array: destination FixedArray |
- // heap_number_map: heap number map |
- __ b(&entry); |
- |
- // Call into runtime if GC is required. |
- __ bind(&gc_required); |
- __ Pop(target_map, receiver, key, value); |
- __ pop(lr); |
- __ b(fail); |
- |
- __ bind(&loop); |
- Register upper_bits = key; |
- __ ldr(upper_bits, MemOperand(src_elements, 8, PostIndex)); |
- // upper_bits: current element's upper 32 bit |
- // src_elements: address of next element's upper 32 bit |
- __ cmp(upper_bits, Operand(kHoleNanUpper32)); |
- __ b(eq, &convert_hole); |
- |
- // Non-hole double, copy value into a heap number. |
- Register heap_number = receiver; |
- Register scratch2 = value; |
- __ AllocateHeapNumber(heap_number, scratch2, lr, heap_number_map, |
- &gc_required); |
- // heap_number: new heap number |
- __ ldr(scratch2, MemOperand(src_elements, 12, NegOffset)); |
- __ Strd(scratch2, upper_bits, |
- FieldMemOperand(heap_number, HeapNumber::kValueOffset)); |
- __ mov(scratch2, dst_elements); |
- __ str(heap_number, MemOperand(dst_elements, 4, PostIndex)); |
- __ RecordWrite(array, |
- scratch2, |
- heap_number, |
- kLRHasBeenSaved, |
- kDontSaveFPRegs, |
- EMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
- __ b(&entry); |
- |
- // Replace the-hole NaN with the-hole pointer. |
- __ bind(&convert_hole); |
- __ LoadRoot(scratch2, Heap::kTheHoleValueRootIndex); |
- __ str(scratch2, MemOperand(dst_elements, 4, PostIndex)); |
- |
- __ bind(&entry); |
- __ cmp(dst_elements, dst_end); |
- __ b(lt, &loop); |
- |
- __ Pop(target_map, receiver, key, value); |
- // Replace receiver's backing store with newly created and filled FixedArray. |
- __ str(array, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
- __ RecordWriteField(receiver, |
- JSObject::kElementsOffset, |
- array, |
- scratch, |
- kLRHasBeenSaved, |
- kDontSaveFPRegs, |
- EMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
- __ pop(lr); |
- |
- __ bind(&only_change_map); |
- // Update receiver's map. |
- __ str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
- __ RecordWriteField(receiver, |
- HeapObject::kMapOffset, |
- target_map, |
- scratch, |
- kLRHasNotBeenSaved, |
- kDontSaveFPRegs, |
- OMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
-} |
- |
- |
void StringCharLoadGenerator::Generate(MacroAssembler* masm, |
Register string, |
Register index, |