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/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 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 __ mov(eax, arg_count()); | 1268 __ mov(eax, arg_count()); |
1269 // Reload ecx. | 1269 // Reload ecx. |
1270 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, | 1270 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, |
1271 FixedArray::kHeaderSize)); | 1271 FixedArray::kHeaderSize)); |
1272 | 1272 |
1273 // Increment the call count for monomorphic function calls. | 1273 // Increment the call count for monomorphic function calls. |
1274 IncrementCallCount(masm, ebx, edx); | 1274 IncrementCallCount(masm, ebx, edx); |
1275 | 1275 |
1276 __ mov(ebx, ecx); | 1276 __ mov(ebx, ecx); |
1277 __ mov(edx, edi); | 1277 __ mov(edx, edi); |
1278 ArrayConstructorStub stub(masm->isolate(), arg_count()); | 1278 ArrayConstructorStub stub(masm->isolate()); |
1279 __ TailCallStub(&stub); | 1279 __ TailCallStub(&stub); |
1280 | 1280 |
1281 // Unreachable. | 1281 // Unreachable. |
1282 } | 1282 } |
1283 | 1283 |
1284 | 1284 |
1285 void CallICStub::Generate(MacroAssembler* masm) { | 1285 void CallICStub::Generate(MacroAssembler* masm) { |
1286 // edi - function | 1286 // edi - function |
1287 // edx - slot id | 1287 // edx - slot id |
1288 // ebx - vector | 1288 // ebx - vector |
(...skipping 2338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3627 // For internal arrays we only need a few things | 3627 // For internal arrays we only need a few things |
3628 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]); | 3628 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]); |
3629 stubh1.GetCode(); | 3629 stubh1.GetCode(); |
3630 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); | 3630 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); |
3631 stubh2.GetCode(); | 3631 stubh2.GetCode(); |
3632 } | 3632 } |
3633 } | 3633 } |
3634 | 3634 |
3635 void ArrayConstructorStub::GenerateDispatchToArrayStub( | 3635 void ArrayConstructorStub::GenerateDispatchToArrayStub( |
3636 MacroAssembler* masm, AllocationSiteOverrideMode mode) { | 3636 MacroAssembler* masm, AllocationSiteOverrideMode mode) { |
3637 if (argument_count() == ANY) { | 3637 Label not_zero_case, not_one_case; |
3638 Label not_zero_case, not_one_case; | 3638 __ test(eax, eax); |
3639 __ test(eax, eax); | 3639 __ j(not_zero, ¬_zero_case); |
3640 __ j(not_zero, ¬_zero_case); | 3640 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); |
3641 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); | |
3642 | 3641 |
3643 __ bind(¬_zero_case); | 3642 __ bind(¬_zero_case); |
3644 __ cmp(eax, 1); | 3643 __ cmp(eax, 1); |
3645 __ j(greater, ¬_one_case); | 3644 __ j(greater, ¬_one_case); |
3646 CreateArrayDispatchOneArgument(masm, mode); | 3645 CreateArrayDispatchOneArgument(masm, mode); |
3647 | 3646 |
3648 __ bind(¬_one_case); | 3647 __ bind(¬_one_case); |
3649 ArrayNArgumentsConstructorStub stub(masm->isolate()); | 3648 ArrayNArgumentsConstructorStub stub(masm->isolate()); |
3650 __ TailCallStub(&stub); | 3649 __ TailCallStub(&stub); |
3651 } else if (argument_count() == NONE) { | |
3652 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); | |
3653 } else if (argument_count() == ONE) { | |
3654 CreateArrayDispatchOneArgument(masm, mode); | |
3655 } else if (argument_count() == MORE_THAN_ONE) { | |
3656 ArrayNArgumentsConstructorStub stub(masm->isolate()); | |
3657 __ TailCallStub(&stub); | |
3658 } else { | |
3659 UNREACHABLE(); | |
3660 } | |
3661 } | 3650 } |
3662 | 3651 |
3663 void ArrayConstructorStub::Generate(MacroAssembler* masm) { | 3652 void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
3664 // ----------- S t a t e ------------- | 3653 // ----------- S t a t e ------------- |
3665 // -- eax : argc (only if argument_count() is ANY or MORE_THAN_ONE) | 3654 // -- eax : argc (only if argument_count() is ANY or MORE_THAN_ONE) |
3666 // -- ebx : AllocationSite or undefined | 3655 // -- ebx : AllocationSite or undefined |
3667 // -- edi : constructor | 3656 // -- edi : constructor |
3668 // -- edx : Original constructor | 3657 // -- edx : Original constructor |
3669 // -- esp[0] : return address | 3658 // -- esp[0] : return address |
3670 // -- esp[4] : last argument | 3659 // -- esp[4] : last argument |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3704 __ SmiUntag(edx); | 3693 __ SmiUntag(edx); |
3705 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); | 3694 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
3706 __ and_(edx, Immediate(AllocationSite::ElementsKindBits::kMask)); | 3695 __ and_(edx, Immediate(AllocationSite::ElementsKindBits::kMask)); |
3707 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 3696 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
3708 | 3697 |
3709 __ bind(&no_info); | 3698 __ bind(&no_info); |
3710 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 3699 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
3711 | 3700 |
3712 // Subclassing. | 3701 // Subclassing. |
3713 __ bind(&subclassing); | 3702 __ bind(&subclassing); |
3714 switch (argument_count()) { | 3703 __ mov(Operand(esp, eax, times_pointer_size, kPointerSize), edi); |
3715 case ANY: | 3704 __ add(eax, Immediate(3)); |
3716 case MORE_THAN_ONE: | |
3717 __ mov(Operand(esp, eax, times_pointer_size, kPointerSize), edi); | |
3718 __ add(eax, Immediate(3)); | |
3719 break; | |
3720 case NONE: | |
3721 __ mov(Operand(esp, 1 * kPointerSize), edi); | |
3722 __ mov(eax, Immediate(3)); | |
3723 break; | |
3724 case ONE: | |
3725 __ mov(Operand(esp, 2 * kPointerSize), edi); | |
3726 __ mov(eax, Immediate(4)); | |
3727 break; | |
3728 } | |
3729 __ PopReturnAddressTo(ecx); | 3705 __ PopReturnAddressTo(ecx); |
3730 __ Push(edx); | 3706 __ Push(edx); |
3731 __ Push(ebx); | 3707 __ Push(ebx); |
3732 __ PushReturnAddressFrom(ecx); | 3708 __ PushReturnAddressFrom(ecx); |
3733 __ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate())); | 3709 __ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate())); |
3734 } | 3710 } |
3735 | 3711 |
3736 void InternalArrayConstructorStub::GenerateCase(MacroAssembler* masm, | 3712 void InternalArrayConstructorStub::GenerateCase(MacroAssembler* masm, |
3737 ElementsKind kind) { | 3713 ElementsKind kind) { |
3738 Label not_zero_case, not_one_case; | 3714 Label not_zero_case, not_one_case; |
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4994 kStackUnwindSpace, nullptr, return_value_operand, | 4970 kStackUnwindSpace, nullptr, return_value_operand, |
4995 NULL); | 4971 NULL); |
4996 } | 4972 } |
4997 | 4973 |
4998 #undef __ | 4974 #undef __ |
4999 | 4975 |
5000 } // namespace internal | 4976 } // namespace internal |
5001 } // namespace v8 | 4977 } // namespace v8 |
5002 | 4978 |
5003 #endif // V8_TARGET_ARCH_X87 | 4979 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |