OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 | 776 |
777 void ElementsTransitionGenerator::GenerateDoubleToObject( | 777 void ElementsTransitionGenerator::GenerateDoubleToObject( |
778 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { | 778 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { |
779 // ----------- S t a t e ------------- | 779 // ----------- S t a t e ------------- |
780 // -- eax : value | 780 // -- eax : value |
781 // -- ebx : target map | 781 // -- ebx : target map |
782 // -- ecx : key | 782 // -- ecx : key |
783 // -- edx : receiver | 783 // -- edx : receiver |
784 // -- esp[0] : return address | 784 // -- esp[0] : return address |
785 // ----------------------------------- | 785 // ----------------------------------- |
786 Label loop, entry, convert_hole, gc_required, only_change_map, success; | 786 Label loop, entry, convert_hole, gc_required, gc_cleanup, only_change_map, |
| 787 success; |
787 | 788 |
788 if (mode == TRACK_ALLOCATION_SITE) { | 789 if (mode == TRACK_ALLOCATION_SITE) { |
789 __ JumpIfJSArrayHasAllocationMemento(edx, edi, fail); | 790 __ JumpIfJSArrayHasAllocationMemento(edx, edi, fail); |
790 } | 791 } |
791 | 792 |
792 // Check for empty arrays, which only require a map transition and no changes | 793 // Check for empty arrays, which only require a map transition and no changes |
793 // to the backing store. | 794 // to the backing store. |
794 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | 795 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
795 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); | 796 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); |
796 __ j(equal, &only_change_map); | 797 __ j(equal, &only_change_map); |
(...skipping 25 matching lines...) Expand all Loading... |
822 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); | 823 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); |
823 __ RecordWriteField(edx, | 824 __ RecordWriteField(edx, |
824 HeapObject::kMapOffset, | 825 HeapObject::kMapOffset, |
825 ebx, | 826 ebx, |
826 edi, | 827 edi, |
827 kDontSaveFPRegs, | 828 kDontSaveFPRegs, |
828 OMIT_REMEMBERED_SET, | 829 OMIT_REMEMBERED_SET, |
829 OMIT_SMI_CHECK); | 830 OMIT_SMI_CHECK); |
830 __ jmp(&success); | 831 __ jmp(&success); |
831 | 832 |
| 833 __ bind(&gc_cleanup); |
| 834 #ifdef VERIFY_HEAP |
| 835 // Make sure new space is iterable if we are verifying the heap. |
| 836 __ mov(edx, Immediate(Smi::FromInt(0))); |
| 837 __ mov(FieldOperand(eax, ebx, times_2, FixedArray::kHeaderSize), edx); |
| 838 __ sub(ebx, Immediate(Smi::FromInt(1))); |
| 839 __ j(not_sign, &gc_cleanup); |
| 840 #endif |
| 841 __ bind(&gc_required); |
832 // Call into runtime if GC is required. | 842 // Call into runtime if GC is required. |
833 __ bind(&gc_required); | |
834 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 843 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
835 __ pop(ebx); | 844 __ pop(ebx); |
836 __ pop(edx); | 845 __ pop(edx); |
837 __ pop(eax); | 846 __ pop(eax); |
838 __ jmp(fail); | 847 __ jmp(fail); |
839 | 848 |
840 // Box doubles into heap numbers. | 849 // Box doubles into heap numbers. |
841 // edi: source FixedDoubleArray | 850 // edi: source FixedDoubleArray |
842 // eax: destination FixedArray | 851 // eax: destination FixedArray |
843 __ bind(&loop); | 852 __ bind(&loop); |
844 // ebx: index of current element (smi-tagged) | 853 // ebx: index of current element (smi-tagged) |
845 uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32); | 854 uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32); |
846 __ cmp(FieldOperand(edi, ebx, times_4, offset), Immediate(kHoleNanUpper32)); | 855 __ cmp(FieldOperand(edi, ebx, times_4, offset), Immediate(kHoleNanUpper32)); |
847 __ j(equal, &convert_hole); | 856 __ j(equal, &convert_hole); |
848 | 857 |
849 // Non-hole double, copy value into a heap number. | 858 // Non-hole double, copy value into a heap number. |
850 __ AllocateHeapNumber(edx, esi, no_reg, &gc_required); | 859 __ AllocateHeapNumber(edx, esi, no_reg, &gc_cleanup); |
851 // edx: new heap number | 860 // edx: new heap number |
852 if (CpuFeatures::IsSupported(SSE2)) { | 861 if (CpuFeatures::IsSupported(SSE2)) { |
853 CpuFeatureScope fscope(masm, SSE2); | 862 CpuFeatureScope fscope(masm, SSE2); |
854 __ movsd(xmm0, | 863 __ movsd(xmm0, |
855 FieldOperand(edi, ebx, times_4, FixedDoubleArray::kHeaderSize)); | 864 FieldOperand(edi, ebx, times_4, FixedDoubleArray::kHeaderSize)); |
856 __ movsd(FieldOperand(edx, HeapNumber::kValueOffset), xmm0); | 865 __ movsd(FieldOperand(edx, HeapNumber::kValueOffset), xmm0); |
857 } else { | 866 } else { |
858 __ mov(esi, FieldOperand(edi, ebx, times_4, FixedDoubleArray::kHeaderSize)); | 867 __ mov(esi, FieldOperand(edi, ebx, times_4, FixedDoubleArray::kHeaderSize)); |
859 __ mov(FieldOperand(edx, HeapNumber::kValueOffset), esi); | 868 __ mov(FieldOperand(edx, HeapNumber::kValueOffset), esi); |
860 __ mov(esi, FieldOperand(edi, ebx, times_4, offset)); | 869 __ mov(esi, FieldOperand(edi, ebx, times_4, offset)); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 Code* stub = GetCodeAgeStub(isolate, age, parity); | 1138 Code* stub = GetCodeAgeStub(isolate, age, parity); |
1130 CodePatcher patcher(sequence, young_length); | 1139 CodePatcher patcher(sequence, young_length); |
1131 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 1140 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
1132 } | 1141 } |
1133 } | 1142 } |
1134 | 1143 |
1135 | 1144 |
1136 } } // namespace v8::internal | 1145 } } // namespace v8::internal |
1137 | 1146 |
1138 #endif // V8_TARGET_ARCH_IA32 | 1147 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |