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, gc_cleanup, only_change_map, | 786 Label loop, entry, convert_hole, gc_required, only_change_map, success; |
787 success; | |
788 | 787 |
789 if (mode == TRACK_ALLOCATION_SITE) { | 788 if (mode == TRACK_ALLOCATION_SITE) { |
790 __ JumpIfJSArrayHasAllocationMemento(edx, edi, fail); | 789 __ JumpIfJSArrayHasAllocationMemento(edx, edi, fail); |
791 } | 790 } |
792 | 791 |
793 // Check for empty arrays, which only require a map transition and no changes | 792 // Check for empty arrays, which only require a map transition and no changes |
794 // to the backing store. | 793 // to the backing store. |
795 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | 794 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
796 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); | 795 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); |
797 __ j(equal, &only_change_map); | 796 __ j(equal, &only_change_map); |
(...skipping 25 matching lines...) Expand all Loading... |
823 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); | 822 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); |
824 __ RecordWriteField(edx, | 823 __ RecordWriteField(edx, |
825 HeapObject::kMapOffset, | 824 HeapObject::kMapOffset, |
826 ebx, | 825 ebx, |
827 edi, | 826 edi, |
828 kDontSaveFPRegs, | 827 kDontSaveFPRegs, |
829 OMIT_REMEMBERED_SET, | 828 OMIT_REMEMBERED_SET, |
830 OMIT_SMI_CHECK); | 829 OMIT_SMI_CHECK); |
831 __ jmp(&success); | 830 __ jmp(&success); |
832 | 831 |
833 __ bind(&gc_cleanup); | 832 // Call into runtime if GC is required. |
834 #ifdef VERIFY_HEAP | |
835 // Make sure new space is iterable if we are verifying the heap. | |
836 __ mov(edx, masm->isolate()->factory()->one_pointer_filler_map()); | |
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); | 833 __ bind(&gc_required); |
842 // Call into runtime if GC is required. | |
843 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 834 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
844 __ pop(ebx); | 835 __ pop(ebx); |
845 __ pop(edx); | 836 __ pop(edx); |
846 __ pop(eax); | 837 __ pop(eax); |
847 __ jmp(fail); | 838 __ jmp(fail); |
848 | 839 |
849 // Box doubles into heap numbers. | 840 // Box doubles into heap numbers. |
850 // edi: source FixedDoubleArray | 841 // edi: source FixedDoubleArray |
851 // eax: destination FixedArray | 842 // eax: destination FixedArray |
852 __ bind(&loop); | 843 __ bind(&loop); |
853 // ebx: index of current element (smi-tagged) | 844 // ebx: index of current element (smi-tagged) |
854 uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32); | 845 uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32); |
855 __ cmp(FieldOperand(edi, ebx, times_4, offset), Immediate(kHoleNanUpper32)); | 846 __ cmp(FieldOperand(edi, ebx, times_4, offset), Immediate(kHoleNanUpper32)); |
856 __ j(equal, &convert_hole); | 847 __ j(equal, &convert_hole); |
857 | 848 |
858 // Non-hole double, copy value into a heap number. | 849 // Non-hole double, copy value into a heap number. |
859 __ AllocateHeapNumber(edx, esi, no_reg, &gc_cleanup); | 850 __ AllocateHeapNumber(edx, esi, no_reg, &gc_required); |
860 // edx: new heap number | 851 // edx: new heap number |
861 if (CpuFeatures::IsSupported(SSE2)) { | 852 if (CpuFeatures::IsSupported(SSE2)) { |
862 CpuFeatureScope fscope(masm, SSE2); | 853 CpuFeatureScope fscope(masm, SSE2); |
863 __ movsd(xmm0, | 854 __ movsd(xmm0, |
864 FieldOperand(edi, ebx, times_4, FixedDoubleArray::kHeaderSize)); | 855 FieldOperand(edi, ebx, times_4, FixedDoubleArray::kHeaderSize)); |
865 __ movsd(FieldOperand(edx, HeapNumber::kValueOffset), xmm0); | 856 __ movsd(FieldOperand(edx, HeapNumber::kValueOffset), xmm0); |
866 } else { | 857 } else { |
867 __ mov(esi, FieldOperand(edi, ebx, times_4, FixedDoubleArray::kHeaderSize)); | 858 __ mov(esi, FieldOperand(edi, ebx, times_4, FixedDoubleArray::kHeaderSize)); |
868 __ mov(FieldOperand(edx, HeapNumber::kValueOffset), esi); | 859 __ mov(FieldOperand(edx, HeapNumber::kValueOffset), esi); |
869 __ mov(esi, FieldOperand(edi, ebx, times_4, offset)); | 860 __ mov(esi, FieldOperand(edi, ebx, times_4, offset)); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 Code* stub = GetCodeAgeStub(isolate, age, parity); | 1129 Code* stub = GetCodeAgeStub(isolate, age, parity); |
1139 CodePatcher patcher(sequence, young_length); | 1130 CodePatcher patcher(sequence, young_length); |
1140 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 1131 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
1141 } | 1132 } |
1142 } | 1133 } |
1143 | 1134 |
1144 | 1135 |
1145 } } // namespace v8::internal | 1136 } } // namespace v8::internal |
1146 | 1137 |
1147 #endif // V8_TARGET_ARCH_IA32 | 1138 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |