| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 3781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3792 | 3792 |
| 3793 __ bind(&need_incremental_pop_object); | 3793 __ bind(&need_incremental_pop_object); |
| 3794 __ pop(regs_.object()); | 3794 __ pop(regs_.object()); |
| 3795 | 3795 |
| 3796 __ bind(&need_incremental); | 3796 __ bind(&need_incremental); |
| 3797 | 3797 |
| 3798 // Fall through when we need to inform the incremental marker. | 3798 // Fall through when we need to inform the incremental marker. |
| 3799 } | 3799 } |
| 3800 | 3800 |
| 3801 | 3801 |
| 3802 void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) { | |
| 3803 // ----------- S t a t e ------------- | |
| 3804 // -- eax : element value to store | |
| 3805 // -- ecx : element index as smi | |
| 3806 // -- esp[0] : return address | |
| 3807 // -- esp[4] : array literal index in function | |
| 3808 // -- esp[8] : array literal | |
| 3809 // clobbers ebx, edx, edi | |
| 3810 // ----------------------------------- | |
| 3811 | |
| 3812 Label element_done; | |
| 3813 Label double_elements; | |
| 3814 Label smi_element; | |
| 3815 Label slow_elements; | |
| 3816 Label slow_elements_from_double; | |
| 3817 Label fast_elements; | |
| 3818 | |
| 3819 // Get array literal index, array literal and its map. | |
| 3820 __ mov(edx, Operand(esp, 1 * kPointerSize)); | |
| 3821 __ mov(ebx, Operand(esp, 2 * kPointerSize)); | |
| 3822 __ mov(edi, FieldOperand(ebx, JSObject::kMapOffset)); | |
| 3823 | |
| 3824 __ CheckFastElements(edi, &double_elements); | |
| 3825 | |
| 3826 // Check for FAST_*_SMI_ELEMENTS or FAST_*_ELEMENTS elements | |
| 3827 __ JumpIfSmi(eax, &smi_element); | |
| 3828 __ CheckFastSmiElements(edi, &fast_elements, Label::kNear); | |
| 3829 | |
| 3830 // Store into the array literal requires a elements transition. Call into | |
| 3831 // the runtime. | |
| 3832 | |
| 3833 __ bind(&slow_elements); | |
| 3834 __ pop(edi); // Pop return address and remember to put back later for tail | |
| 3835 // call. | |
| 3836 __ push(ebx); | |
| 3837 __ push(ecx); | |
| 3838 __ push(eax); | |
| 3839 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | |
| 3840 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset)); | |
| 3841 __ push(edx); | |
| 3842 __ push(edi); // Return return address so that tail call returns to right | |
| 3843 // place. | |
| 3844 __ TailCallRuntime(Runtime::kStoreArrayLiteralElement, 5, 1); | |
| 3845 | |
| 3846 __ bind(&slow_elements_from_double); | |
| 3847 __ pop(edx); | |
| 3848 __ jmp(&slow_elements); | |
| 3849 | |
| 3850 // Array literal has ElementsKind of FAST_*_ELEMENTS and value is an object. | |
| 3851 __ bind(&fast_elements); | |
| 3852 __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset)); | |
| 3853 __ lea(ecx, FieldOperand(ebx, ecx, times_half_pointer_size, | |
| 3854 FixedArrayBase::kHeaderSize)); | |
| 3855 __ mov(Operand(ecx, 0), eax); | |
| 3856 // Update the write barrier for the array store. | |
| 3857 __ RecordWrite(ebx, ecx, eax, kDontSaveFPRegs, EMIT_REMEMBERED_SET, | |
| 3858 OMIT_SMI_CHECK); | |
| 3859 __ ret(0); | |
| 3860 | |
| 3861 // Array literal has ElementsKind of FAST_*_SMI_ELEMENTS or FAST_*_ELEMENTS, | |
| 3862 // and value is Smi. | |
| 3863 __ bind(&smi_element); | |
| 3864 __ mov(ebx, FieldOperand(ebx, JSObject::kElementsOffset)); | |
| 3865 __ mov(FieldOperand(ebx, ecx, times_half_pointer_size, | |
| 3866 FixedArrayBase::kHeaderSize), eax); | |
| 3867 __ ret(0); | |
| 3868 | |
| 3869 // Array literal has ElementsKind of FAST_*_DOUBLE_ELEMENTS. | |
| 3870 __ bind(&double_elements); | |
| 3871 | |
| 3872 __ push(edx); | |
| 3873 __ mov(edx, FieldOperand(ebx, JSObject::kElementsOffset)); | |
| 3874 __ StoreNumberToDoubleElements(eax, | |
| 3875 edx, | |
| 3876 ecx, | |
| 3877 edi, | |
| 3878 &slow_elements_from_double, | |
| 3879 false); | |
| 3880 __ pop(edx); | |
| 3881 __ ret(0); | |
| 3882 } | |
| 3883 | |
| 3884 | |
| 3885 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { | 3802 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { |
| 3886 CEntryStub ces(isolate(), 1, kSaveFPRegs); | 3803 CEntryStub ces(isolate(), 1, kSaveFPRegs); |
| 3887 __ call(ces.GetCode(), RelocInfo::CODE_TARGET); | 3804 __ call(ces.GetCode(), RelocInfo::CODE_TARGET); |
| 3888 int parameter_count_offset = | 3805 int parameter_count_offset = |
| 3889 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 3806 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; |
| 3890 __ mov(ebx, MemOperand(ebp, parameter_count_offset)); | 3807 __ mov(ebx, MemOperand(ebp, parameter_count_offset)); |
| 3891 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 3808 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| 3892 __ pop(ecx); | 3809 __ pop(ecx); |
| 3893 int additional_offset = | 3810 int additional_offset = |
| 3894 function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0; | 3811 function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0; |
| (...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5432 Operand(ebp, 7 * kPointerSize), NULL); | 5349 Operand(ebp, 7 * kPointerSize), NULL); |
| 5433 } | 5350 } |
| 5434 | 5351 |
| 5435 | 5352 |
| 5436 #undef __ | 5353 #undef __ |
| 5437 | 5354 |
| 5438 } // namespace internal | 5355 } // namespace internal |
| 5439 } // namespace v8 | 5356 } // namespace v8 |
| 5440 | 5357 |
| 5441 #endif // V8_TARGET_ARCH_X87 | 5358 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |