| 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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 6 | 6 |
| 7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
| 8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1439 __ mov(eax, arg_count()); | 1439 __ mov(eax, arg_count()); |
| 1440 // Reload ecx. | 1440 // Reload ecx. |
| 1441 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, | 1441 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, |
| 1442 FixedArray::kHeaderSize)); | 1442 FixedArray::kHeaderSize)); |
| 1443 | 1443 |
| 1444 // Increment the call count for monomorphic function calls. | 1444 // Increment the call count for monomorphic function calls. |
| 1445 IncrementCallCount(masm, ebx, edx); | 1445 IncrementCallCount(masm, ebx, edx); |
| 1446 | 1446 |
| 1447 __ mov(ebx, ecx); | 1447 __ mov(ebx, ecx); |
| 1448 __ mov(edx, edi); | 1448 __ mov(edx, edi); |
| 1449 ArrayConstructorStub stub(masm->isolate(), arg_count()); | 1449 ArrayConstructorStub stub(masm->isolate()); |
| 1450 __ TailCallStub(&stub); | 1450 __ TailCallStub(&stub); |
| 1451 | 1451 |
| 1452 // Unreachable. | 1452 // Unreachable. |
| 1453 } | 1453 } |
| 1454 | 1454 |
| 1455 | 1455 |
| 1456 void CallICStub::Generate(MacroAssembler* masm) { | 1456 void CallICStub::Generate(MacroAssembler* masm) { |
| 1457 // edi - function | 1457 // edi - function |
| 1458 // edx - slot id | 1458 // edx - slot id |
| 1459 // ebx - vector | 1459 // ebx - vector |
| (...skipping 2363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3823 ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS }; | 3823 ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS }; |
| 3824 for (int i = 0; i < 2; i++) { | 3824 for (int i = 0; i < 2; i++) { |
| 3825 // For internal arrays we only need a few things | 3825 // For internal arrays we only need a few things |
| 3826 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]); | 3826 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]); |
| 3827 stubh1.GetCode(); | 3827 stubh1.GetCode(); |
| 3828 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); | 3828 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); |
| 3829 stubh2.GetCode(); | 3829 stubh2.GetCode(); |
| 3830 } | 3830 } |
| 3831 } | 3831 } |
| 3832 | 3832 |
| 3833 void ArrayConstructorStub::GenerateDispatchToArrayStub( |
| 3834 MacroAssembler* masm, AllocationSiteOverrideMode mode) { |
| 3835 Label not_zero_case, not_one_case; |
| 3836 __ test(eax, eax); |
| 3837 __ j(not_zero, ¬_zero_case); |
| 3838 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); |
| 3833 | 3839 |
| 3834 void ArrayConstructorStub::GenerateDispatchToArrayStub( | 3840 __ bind(¬_zero_case); |
| 3835 MacroAssembler* masm, | 3841 __ cmp(eax, 1); |
| 3836 AllocationSiteOverrideMode mode) { | 3842 __ j(greater, ¬_one_case); |
| 3837 if (argument_count() == ANY) { | 3843 CreateArrayDispatchOneArgument(masm, mode); |
| 3838 Label not_zero_case, not_one_case; | |
| 3839 __ test(eax, eax); | |
| 3840 __ j(not_zero, ¬_zero_case); | |
| 3841 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); | |
| 3842 | 3844 |
| 3843 __ bind(¬_zero_case); | 3845 __ bind(¬_one_case); |
| 3844 __ cmp(eax, 1); | 3846 ArrayNArgumentsConstructorStub stub(masm->isolate()); |
| 3845 __ j(greater, ¬_one_case); | 3847 __ TailCallStub(&stub); |
| 3846 CreateArrayDispatchOneArgument(masm, mode); | |
| 3847 | |
| 3848 __ bind(¬_one_case); | |
| 3849 ArrayNArgumentsConstructorStub stub(masm->isolate()); | |
| 3850 __ TailCallStub(&stub); | |
| 3851 } else if (argument_count() == NONE) { | |
| 3852 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); | |
| 3853 } else if (argument_count() == ONE) { | |
| 3854 CreateArrayDispatchOneArgument(masm, mode); | |
| 3855 } else if (argument_count() == MORE_THAN_ONE) { | |
| 3856 ArrayNArgumentsConstructorStub stub(masm->isolate()); | |
| 3857 __ TailCallStub(&stub); | |
| 3858 } else { | |
| 3859 UNREACHABLE(); | |
| 3860 } | |
| 3861 } | 3848 } |
| 3862 | 3849 |
| 3863 | |
| 3864 void ArrayConstructorStub::Generate(MacroAssembler* masm) { | 3850 void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
| 3865 // ----------- S t a t e ------------- | 3851 // ----------- S t a t e ------------- |
| 3866 // -- eax : argc (only if argument_count() is ANY or MORE_THAN_ONE) | 3852 // -- eax : argc (only if argument_count() is ANY or MORE_THAN_ONE) |
| 3867 // -- ebx : AllocationSite or undefined | 3853 // -- ebx : AllocationSite or undefined |
| 3868 // -- edi : constructor | 3854 // -- edi : constructor |
| 3869 // -- edx : Original constructor | 3855 // -- edx : Original constructor |
| 3870 // -- esp[0] : return address | 3856 // -- esp[0] : return address |
| 3871 // -- esp[4] : last argument | 3857 // -- esp[4] : last argument |
| 3872 // ----------------------------------- | 3858 // ----------------------------------- |
| 3873 if (FLAG_debug_code) { | 3859 if (FLAG_debug_code) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3905 __ SmiUntag(edx); | 3891 __ SmiUntag(edx); |
| 3906 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); | 3892 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
| 3907 __ and_(edx, Immediate(AllocationSite::ElementsKindBits::kMask)); | 3893 __ and_(edx, Immediate(AllocationSite::ElementsKindBits::kMask)); |
| 3908 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 3894 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
| 3909 | 3895 |
| 3910 __ bind(&no_info); | 3896 __ bind(&no_info); |
| 3911 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 3897 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
| 3912 | 3898 |
| 3913 // Subclassing. | 3899 // Subclassing. |
| 3914 __ bind(&subclassing); | 3900 __ bind(&subclassing); |
| 3915 switch (argument_count()) { | 3901 __ mov(Operand(esp, eax, times_pointer_size, kPointerSize), edi); |
| 3916 case ANY: | 3902 __ add(eax, Immediate(3)); |
| 3917 case MORE_THAN_ONE: | |
| 3918 __ mov(Operand(esp, eax, times_pointer_size, kPointerSize), edi); | |
| 3919 __ add(eax, Immediate(3)); | |
| 3920 break; | |
| 3921 case NONE: | |
| 3922 __ mov(Operand(esp, 1 * kPointerSize), edi); | |
| 3923 __ mov(eax, Immediate(3)); | |
| 3924 break; | |
| 3925 case ONE: | |
| 3926 __ mov(Operand(esp, 2 * kPointerSize), edi); | |
| 3927 __ mov(eax, Immediate(4)); | |
| 3928 break; | |
| 3929 } | |
| 3930 __ PopReturnAddressTo(ecx); | 3903 __ PopReturnAddressTo(ecx); |
| 3931 __ Push(edx); | 3904 __ Push(edx); |
| 3932 __ Push(ebx); | 3905 __ Push(ebx); |
| 3933 __ PushReturnAddressFrom(ecx); | 3906 __ PushReturnAddressFrom(ecx); |
| 3934 __ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate())); | 3907 __ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate())); |
| 3935 } | 3908 } |
| 3936 | 3909 |
| 3937 | 3910 |
| 3938 void InternalArrayConstructorStub::GenerateCase( | 3911 void InternalArrayConstructorStub::GenerateCase( |
| 3939 MacroAssembler* masm, ElementsKind kind) { | 3912 MacroAssembler* masm, ElementsKind kind) { |
| (...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5203 kStackUnwindSpace, nullptr, return_value_operand, | 5176 kStackUnwindSpace, nullptr, return_value_operand, |
| 5204 NULL); | 5177 NULL); |
| 5205 } | 5178 } |
| 5206 | 5179 |
| 5207 #undef __ | 5180 #undef __ |
| 5208 | 5181 |
| 5209 } // namespace internal | 5182 } // namespace internal |
| 5210 } // namespace v8 | 5183 } // namespace v8 |
| 5211 | 5184 |
| 5212 #endif // V8_TARGET_ARCH_IA32 | 5185 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |