Index: src/ia32/codegen-ia32.cc |
diff --git a/src/ia32/codegen-ia32.cc b/src/ia32/codegen-ia32.cc |
index 18e53641e676d2ba2ea35f2a3ba2af5640ca48cf..738130faffccdd45f4d73a0975ae733655d8f39c 100644 |
--- a/src/ia32/codegen-ia32.cc |
+++ b/src/ia32/codegen-ia32.cc |
@@ -485,309 +485,6 @@ MemMoveFunction CreateMemMoveFunction(Isolate* isolate) { |
#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 = edi; |
- DCHECK(!AreAliased(receiver, key, value, target_map, scratch)); |
- |
- if (mode == TRACK_ALLOCATION_SITE) { |
- DCHECK(allocation_memento_found != NULL); |
- __ JumpIfJSArrayHasAllocationMemento( |
- receiver, scratch, allocation_memento_found); |
- } |
- |
- // Set transitioned map. |
- __ mov(FieldOperand(receiver, HeapObject::kMapOffset), target_map); |
- __ RecordWriteField(receiver, |
- HeapObject::kMapOffset, |
- target_map, |
- scratch, |
- 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) { |
- // Return address is on the stack. |
- DCHECK(receiver.is(edx)); |
- DCHECK(key.is(ecx)); |
- DCHECK(value.is(eax)); |
- DCHECK(target_map.is(ebx)); |
- |
- Label loop, entry, convert_hole, gc_required, only_change_map; |
- |
- if (mode == TRACK_ALLOCATION_SITE) { |
- __ JumpIfJSArrayHasAllocationMemento(edx, edi, fail); |
- } |
- |
- // Check for empty arrays, which only require a map transition and no changes |
- // to the backing store. |
- __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
- __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); |
- __ j(equal, &only_change_map); |
- |
- __ push(eax); |
- __ push(ebx); |
- __ push(esi); |
- |
- __ mov(edi, FieldOperand(edi, FixedArray::kLengthOffset)); |
- |
- // Allocate new FixedDoubleArray. |
- // edx: receiver |
- // edi: length of source FixedArray (smi-tagged) |
- AllocationFlags flags = static_cast<AllocationFlags>(DOUBLE_ALIGNMENT); |
- __ Allocate(FixedDoubleArray::kHeaderSize, times_8, edi, |
- REGISTER_VALUE_IS_SMI, eax, ebx, no_reg, &gc_required, flags); |
- |
- // eax: destination FixedDoubleArray |
- // edi: number of elements |
- // edx: receiver |
- __ mov(FieldOperand(eax, HeapObject::kMapOffset), |
- Immediate(masm->isolate()->factory()->fixed_double_array_map())); |
- __ mov(FieldOperand(eax, FixedDoubleArray::kLengthOffset), edi); |
- __ mov(esi, FieldOperand(edx, JSObject::kElementsOffset)); |
- // Replace receiver's backing store with newly created FixedDoubleArray. |
- __ mov(FieldOperand(edx, JSObject::kElementsOffset), eax); |
- __ mov(ebx, eax); |
- __ RecordWriteField(edx, |
- JSObject::kElementsOffset, |
- ebx, |
- edi, |
- kDontSaveFPRegs, |
- EMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
- |
- __ mov(edi, FieldOperand(esi, FixedArray::kLengthOffset)); |
- |
- // Prepare for conversion loop. |
- ExternalReference canonical_the_hole_nan_reference = |
- ExternalReference::address_of_the_hole_nan(); |
- XMMRegister the_hole_nan = xmm1; |
- __ movsd(the_hole_nan, |
- Operand::StaticVariable(canonical_the_hole_nan_reference)); |
- __ jmp(&entry); |
- |
- // Call into runtime if GC is required. |
- __ bind(&gc_required); |
- |
- // Restore registers before jumping into runtime. |
- __ pop(esi); |
- __ pop(ebx); |
- __ pop(eax); |
- __ jmp(fail); |
- |
- // Convert and copy elements |
- // esi: source FixedArray |
- __ bind(&loop); |
- __ mov(ebx, FieldOperand(esi, edi, times_2, FixedArray::kHeaderSize)); |
- // ebx: current element from source |
- // edi: index of current element |
- __ JumpIfNotSmi(ebx, &convert_hole); |
- |
- // Normal smi, convert it to double and store. |
- __ SmiUntag(ebx); |
- __ Cvtsi2sd(xmm0, ebx); |
- __ movsd(FieldOperand(eax, edi, times_4, FixedDoubleArray::kHeaderSize), |
- xmm0); |
- __ jmp(&entry); |
- |
- // Found hole, store hole_nan_as_double instead. |
- __ bind(&convert_hole); |
- |
- if (FLAG_debug_code) { |
- __ cmp(ebx, masm->isolate()->factory()->the_hole_value()); |
- __ Assert(equal, kObjectFoundInSmiOnlyArray); |
- } |
- |
- __ movsd(FieldOperand(eax, edi, times_4, FixedDoubleArray::kHeaderSize), |
- the_hole_nan); |
- |
- __ bind(&entry); |
- __ sub(edi, Immediate(Smi::FromInt(1))); |
- __ j(not_sign, &loop); |
- |
- // Restore registers. |
- __ pop(esi); |
- __ pop(ebx); |
- __ pop(eax); |
- |
- __ bind(&only_change_map); |
- // eax: value |
- // ebx: target map |
- // Set transitioned map. |
- __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); |
- __ RecordWriteField(edx, |
- HeapObject::kMapOffset, |
- ebx, |
- edi, |
- kDontSaveFPRegs, |
- OMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
-} |
- |
- |
-void ElementsTransitionGenerator::GenerateDoubleToObject( |
- MacroAssembler* masm, |
- Register receiver, |
- Register key, |
- Register value, |
- Register target_map, |
- AllocationSiteMode mode, |
- Label* fail) { |
- // Return address is on the stack. |
- DCHECK(receiver.is(edx)); |
- DCHECK(key.is(ecx)); |
- DCHECK(value.is(eax)); |
- DCHECK(target_map.is(ebx)); |
- |
- Label loop, entry, convert_hole, gc_required, only_change_map, success; |
- |
- if (mode == TRACK_ALLOCATION_SITE) { |
- __ JumpIfJSArrayHasAllocationMemento(edx, edi, fail); |
- } |
- |
- // Check for empty arrays, which only require a map transition and no changes |
- // to the backing store. |
- __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
- __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); |
- __ j(equal, &only_change_map); |
- |
- __ push(esi); |
- __ push(eax); |
- __ push(edx); |
- __ push(ebx); |
- |
- __ mov(ebx, FieldOperand(edi, FixedDoubleArray::kLengthOffset)); |
- |
- // Allocate new FixedArray. |
- // ebx: length of source FixedDoubleArray (smi-tagged) |
- __ lea(edi, Operand(ebx, times_2, FixedArray::kHeaderSize)); |
- __ Allocate(edi, eax, esi, no_reg, &gc_required, NO_ALLOCATION_FLAGS); |
- |
- // eax: destination FixedArray |
- // ebx: number of elements |
- __ mov(FieldOperand(eax, HeapObject::kMapOffset), |
- Immediate(masm->isolate()->factory()->fixed_array_map())); |
- __ mov(FieldOperand(eax, FixedArray::kLengthOffset), ebx); |
- __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
- |
- // 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; |
- __ jmp(&initialization_loop_entry, Label::kNear); |
- __ bind(&initialization_loop); |
- __ mov(FieldOperand(eax, ebx, times_2, FixedArray::kHeaderSize), |
- masm->isolate()->factory()->the_hole_value()); |
- __ bind(&initialization_loop_entry); |
- __ sub(ebx, Immediate(Smi::FromInt(1))); |
- __ j(not_sign, &initialization_loop); |
- |
- __ mov(ebx, FieldOperand(edi, FixedDoubleArray::kLengthOffset)); |
- __ jmp(&entry); |
- |
- // ebx: target map |
- // edx: receiver |
- // Set transitioned map. |
- __ bind(&only_change_map); |
- __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); |
- __ RecordWriteField(edx, |
- HeapObject::kMapOffset, |
- ebx, |
- edi, |
- kDontSaveFPRegs, |
- OMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
- __ jmp(&success); |
- |
- // Call into runtime if GC is required. |
- __ bind(&gc_required); |
- __ pop(ebx); |
- __ pop(edx); |
- __ pop(eax); |
- __ pop(esi); |
- __ jmp(fail); |
- |
- // Box doubles into heap numbers. |
- // edi: source FixedDoubleArray |
- // eax: destination FixedArray |
- __ bind(&loop); |
- // ebx: index of current element (smi-tagged) |
- uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32); |
- __ cmp(FieldOperand(edi, ebx, times_4, offset), Immediate(kHoleNanUpper32)); |
- __ j(equal, &convert_hole); |
- |
- // Non-hole double, copy value into a heap number. |
- __ AllocateHeapNumber(edx, esi, no_reg, &gc_required); |
- // edx: new heap number |
- __ movsd(xmm0, |
- FieldOperand(edi, ebx, times_4, FixedDoubleArray::kHeaderSize)); |
- __ movsd(FieldOperand(edx, HeapNumber::kValueOffset), xmm0); |
- __ mov(FieldOperand(eax, ebx, times_2, FixedArray::kHeaderSize), edx); |
- __ mov(esi, ebx); |
- __ RecordWriteArray(eax, |
- edx, |
- esi, |
- kDontSaveFPRegs, |
- EMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
- __ jmp(&entry, Label::kNear); |
- |
- // Replace the-hole NaN with the-hole pointer. |
- __ bind(&convert_hole); |
- __ mov(FieldOperand(eax, ebx, times_2, FixedArray::kHeaderSize), |
- masm->isolate()->factory()->the_hole_value()); |
- |
- __ bind(&entry); |
- __ sub(ebx, Immediate(Smi::FromInt(1))); |
- __ j(not_sign, &loop); |
- |
- __ pop(ebx); |
- __ pop(edx); |
- // ebx: target map |
- // edx: receiver |
- // Set transitioned map. |
- __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); |
- __ RecordWriteField(edx, |
- HeapObject::kMapOffset, |
- ebx, |
- edi, |
- kDontSaveFPRegs, |
- OMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
- // Replace receiver's backing store with newly created and filled FixedArray. |
- __ mov(FieldOperand(edx, JSObject::kElementsOffset), eax); |
- __ RecordWriteField(edx, |
- JSObject::kElementsOffset, |
- eax, |
- edi, |
- kDontSaveFPRegs, |
- EMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
- |
- // Restore registers. |
- __ pop(eax); |
- __ pop(esi); |
- |
- __ bind(&success); |
-} |
- |
- |
void StringCharLoadGenerator::Generate(MacroAssembler* masm, |
Factory* factory, |
Register string, |