OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3783 __ mov(eax, ebx); | 3783 __ mov(eax, ebx); |
3784 __ ret(0); | 3784 __ ret(0); |
3785 | 3785 |
3786 __ bind(&miss_force_generic); | 3786 __ bind(&miss_force_generic); |
3787 Handle<Code> miss_ic = | 3787 Handle<Code> miss_ic = |
3788 masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric(); | 3788 masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric(); |
3789 __ jmp(miss_ic, RelocInfo::CODE_TARGET); | 3789 __ jmp(miss_ic, RelocInfo::CODE_TARGET); |
3790 } | 3790 } |
3791 | 3791 |
3792 | 3792 |
3793 void KeyedLoadStubCompiler::GenerateLoadFastDoubleElement( | |
3794 MacroAssembler* masm) { | |
3795 // ----------- S t a t e ------------- | |
3796 // -- eax : key | |
3797 // -- edx : receiver | |
3798 // -- esp[0] : return address | |
3799 // ----------------------------------- | |
3800 Label miss_force_generic, slow_allocate_heapnumber; | |
3801 | |
3802 // This stub is meant to be tail-jumped to, the receiver must already | |
3803 // have been verified by the caller to not be a smi. | |
3804 | |
3805 // Check that the key is a smi. | |
3806 __ JumpIfNotSmi(eax, &miss_force_generic); | |
3807 | |
3808 // Get the elements array. | |
3809 __ mov(ecx, FieldOperand(edx, JSObject::kElementsOffset)); | |
3810 __ AssertFastElements(ecx); | |
3811 | |
3812 // Check that the key is within bounds. | |
3813 __ cmp(eax, FieldOperand(ecx, FixedDoubleArray::kLengthOffset)); | |
3814 __ j(above_equal, &miss_force_generic); | |
3815 | |
3816 // Check for the hole | |
3817 uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32); | |
3818 __ cmp(FieldOperand(ecx, eax, times_4, offset), Immediate(kHoleNanUpper32)); | |
3819 __ j(equal, &miss_force_generic); | |
3820 | |
3821 // Always allocate a heap number for the result. | |
3822 __ fld_d(FieldOperand(ecx, eax, times_4, FixedDoubleArray::kHeaderSize)); | |
Mads Ager (chromium)
2011/07/13 09:43:09
Would it be worth it to check for SSE2 here as wel
danno
2011/07/13 14:11:03
Done.
| |
3823 __ AllocateHeapNumber(ecx, ebx, edi, &slow_allocate_heapnumber); | |
3824 // Set the value. | |
3825 __ fstp_d(FieldOperand(ecx, HeapNumber::kValueOffset)); | |
3826 __ mov(eax, ecx); | |
3827 __ ret(0); | |
3828 | |
3829 __ bind(&slow_allocate_heapnumber); | |
3830 __ ffree(); | |
Mads Ager (chromium)
2011/07/13 09:43:09
Maybe add a short comment like: Pop double from FP
danno
2011/07/13 14:11:03
Done.
| |
3831 __ fincstp(); | |
3832 Handle<Code> slow_ic = | |
3833 masm->isolate()->builtins()->KeyedLoadIC_Slow(); | |
3834 __ jmp(slow_ic, RelocInfo::CODE_TARGET); | |
3835 | |
3836 __ bind(&miss_force_generic); | |
3837 Handle<Code> miss_ic = | |
3838 masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric(); | |
3839 __ jmp(miss_ic, RelocInfo::CODE_TARGET); | |
3840 } | |
3841 | |
3842 | |
3793 void KeyedStoreStubCompiler::GenerateStoreFastElement(MacroAssembler* masm, | 3843 void KeyedStoreStubCompiler::GenerateStoreFastElement(MacroAssembler* masm, |
3794 bool is_js_array) { | 3844 bool is_js_array) { |
3795 // ----------- S t a t e ------------- | 3845 // ----------- S t a t e ------------- |
3796 // -- eax : value | 3846 // -- eax : value |
3797 // -- ecx : key | 3847 // -- ecx : key |
3798 // -- edx : receiver | 3848 // -- edx : receiver |
3799 // -- esp[0] : return address | 3849 // -- esp[0] : return address |
3800 // ----------------------------------- | 3850 // ----------------------------------- |
3801 Label miss_force_generic; | 3851 Label miss_force_generic; |
3802 | 3852 |
(...skipping 29 matching lines...) Expand all Loading... | |
3832 __ ret(0); | 3882 __ ret(0); |
3833 | 3883 |
3834 // Handle store cache miss, replacing the ic with the generic stub. | 3884 // Handle store cache miss, replacing the ic with the generic stub. |
3835 __ bind(&miss_force_generic); | 3885 __ bind(&miss_force_generic); |
3836 Handle<Code> ic_force_generic = | 3886 Handle<Code> ic_force_generic = |
3837 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 3887 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); |
3838 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); | 3888 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); |
3839 } | 3889 } |
3840 | 3890 |
3841 | 3891 |
3892 void KeyedStoreStubCompiler::GenerateStoreFastDoubleElement( | |
3893 MacroAssembler* masm, | |
3894 bool is_js_array) { | |
3895 // ----------- S t a t e ------------- | |
3896 // -- eax : value | |
3897 // -- ecx : key | |
3898 // -- edx : receiver | |
3899 // -- esp[0] : return address | |
3900 // ----------------------------------- | |
3901 Label miss_force_generic, smi_value, is_nan, have_double_value; | |
3902 | |
3903 // This stub is meant to be tail-jumped to, the receiver must already | |
3904 // have been verified by the caller to not be a smi. | |
3905 | |
3906 // Check that the key is a smi. | |
3907 __ JumpIfNotSmi(ecx, &miss_force_generic); | |
3908 | |
3909 // Get the elements array. | |
3910 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | |
3911 __ AssertFastElements(edi); | |
3912 | |
3913 if (is_js_array) { | |
3914 // Check that the key is within bounds. | |
3915 __ cmp(ecx, FieldOperand(edx, JSArray::kLengthOffset)); // smis. | |
3916 } else { | |
3917 // Check that the key is within bounds. | |
3918 __ cmp(ecx, FieldOperand(edi, FixedArray::kLengthOffset)); // smis. | |
3919 } | |
3920 __ j(above_equal, &miss_force_generic); | |
3921 | |
3922 __ JumpIfSmi(eax, &smi_value, Label::kNear); | |
3923 | |
3924 __ CheckMap(eax, | |
3925 masm->isolate()->factory()->heap_number_map(), | |
3926 &miss_force_generic, | |
3927 DONT_DO_SMI_CHECK); | |
3928 | |
3929 // Double value, canonicalize NaN. | |
3930 uint32_t offset = HeapNumber::kValueOffset + sizeof(kHoleNanLower32); | |
3931 __ cmp(FieldOperand(eax, offset), Immediate(0x7ff00000)); | |
Mads Ager (chromium)
2011/07/13 09:43:09
You had a comment about this constant in the ARM c
danno
2011/07/13 14:11:03
Done.
| |
3932 __ j(greater, &is_nan, Label::kNear); | |
3933 | |
3934 ExternalReference canonical_nan_reference = | |
3935 ExternalReference::address_of_canonical_non_hole_nan(); | |
3936 if (CpuFeatures::IsSupported(SSE2)) { | |
3937 CpuFeatures::Scope use_sse2(SSE2); | |
3938 __ movdbl(xmm0, FieldOperand(eax, HeapNumber::kValueOffset)); | |
3939 __ bind(&have_double_value); | |
3940 __ movdbl(FieldOperand(edi, ecx, times_4, FixedDoubleArray::kHeaderSize), | |
3941 xmm0); | |
3942 __ ret(0); | |
3943 __ bind(&is_nan); | |
3944 __ movdbl(xmm0, Operand::StaticVariable(canonical_nan_reference)); | |
3945 __ jmp(&have_double_value, Label::kNear); | |
3946 } else { | |
3947 __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset)); | |
3948 __ bind(&have_double_value); | |
3949 __ fstp_d(FieldOperand(edi, ecx, times_4, FixedDoubleArray::kHeaderSize)); | |
3950 __ ret(0); | |
3951 __ bind(&is_nan); | |
3952 __ fld_d(Operand::StaticVariable(canonical_nan_reference)); | |
3953 __ jmp(&have_double_value, Label::kNear); | |
3954 } | |
3955 | |
3956 __ bind(&smi_value); | |
3957 | |
3958 // Value is a smi. convert to a double and store. | |
3959 __ SmiUntag(eax); | |
3960 __ push(eax); | |
3961 __ fild_s(Operand(esp, 0)); | |
3962 __ pop(eax); | |
3963 __ fstp_d(FieldOperand(edi, ecx, times_4, FixedDoubleArray::kHeaderSize)); | |
3964 __ ret(0); | |
3965 | |
3966 // Handle store cache miss, replacing the ic with the generic stub. | |
3967 __ bind(&miss_force_generic); | |
3968 Handle<Code> ic_force_generic = | |
3969 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | |
3970 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); | |
3971 } | |
3972 | |
3973 | |
3842 #undef __ | 3974 #undef __ |
3843 | 3975 |
3844 } } // namespace v8::internal | 3976 } } // namespace v8::internal |
3845 | 3977 |
3846 #endif // V8_TARGET_ARCH_IA32 | 3978 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |