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-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 __ Push(Operand(start_address, 0)); | 688 __ Push(Operand(start_address, 0)); |
689 __ sub(start_address, Immediate(kPointerSize)); | 689 __ sub(start_address, Immediate(kPointerSize)); |
690 __ bind(&loop_check); | 690 __ bind(&loop_check); |
691 __ cmp(start_address, array_limit); | 691 __ cmp(start_address, array_limit); |
692 __ j(greater, &loop_header, Label::kNear); | 692 __ j(greater, &loop_header, Label::kNear); |
693 } | 693 } |
694 | 694 |
695 // static | 695 // static |
696 void Builtins::Generate_InterpreterPushArgsAndCallImpl( | 696 void Builtins::Generate_InterpreterPushArgsAndCallImpl( |
697 MacroAssembler* masm, TailCallMode tail_call_mode, | 697 MacroAssembler* masm, TailCallMode tail_call_mode, |
698 CallableType function_type) { | 698 InterpreterPushArgsMode mode) { |
699 // ----------- S t a t e ------------- | 699 // ----------- S t a t e ------------- |
700 // -- eax : the number of arguments (not including the receiver) | 700 // -- eax : the number of arguments (not including the receiver) |
701 // -- ebx : the address of the first argument to be pushed. Subsequent | 701 // -- ebx : the address of the first argument to be pushed. Subsequent |
702 // arguments should be consecutive above this, in the same order as | 702 // arguments should be consecutive above this, in the same order as |
703 // they are to be pushed onto the stack. | 703 // they are to be pushed onto the stack. |
704 // -- edi : the target to call (can be any Object). | 704 // -- edi : the target to call (can be any Object). |
705 // ----------------------------------- | 705 // ----------------------------------- |
706 Label stack_overflow; | 706 Label stack_overflow; |
707 // Compute the expected number of arguments. | 707 // Compute the expected number of arguments. |
708 __ mov(ecx, eax); | 708 __ mov(ecx, eax); |
(...skipping 11 matching lines...) Expand all Loading... |
720 | 720 |
721 // Find the address of the last argument. | 721 // Find the address of the last argument. |
722 __ shl(ecx, kPointerSizeLog2); | 722 __ shl(ecx, kPointerSizeLog2); |
723 __ neg(ecx); | 723 __ neg(ecx); |
724 __ add(ecx, ebx); | 724 __ add(ecx, ebx); |
725 Generate_InterpreterPushArgs(masm, ecx, ebx); | 725 Generate_InterpreterPushArgs(masm, ecx, ebx); |
726 | 726 |
727 // Call the target. | 727 // Call the target. |
728 __ Push(edx); // Re-push return address. | 728 __ Push(edx); // Re-push return address. |
729 | 729 |
730 if (function_type == CallableType::kJSFunction) { | 730 if (mode == InterpreterPushArgsMode::kJSFunction) { |
731 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, | 731 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, |
732 tail_call_mode), | 732 tail_call_mode), |
733 RelocInfo::CODE_TARGET); | 733 RelocInfo::CODE_TARGET); |
734 } else { | 734 } else { |
735 DCHECK_EQ(function_type, CallableType::kAny); | 735 DCHECK_EQ(mode, InterpreterPushArgsMode::kOther); |
736 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 736 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
737 tail_call_mode), | 737 tail_call_mode), |
738 RelocInfo::CODE_TARGET); | 738 RelocInfo::CODE_TARGET); |
739 } | 739 } |
740 | 740 |
741 __ bind(&stack_overflow); | 741 __ bind(&stack_overflow); |
742 { | 742 { |
743 // Pop the temporary registers, so that return address is on top of stack. | 743 // Pop the temporary registers, so that return address is on top of stack. |
744 __ Pop(edi); | 744 __ Pop(edi); |
745 | 745 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 __ sub(scratch1, Immediate(1)); | 838 __ sub(scratch1, Immediate(1)); |
839 __ bind(&loop_check); | 839 __ bind(&loop_check); |
840 __ cmp(scratch1, Immediate(0)); | 840 __ cmp(scratch1, Immediate(0)); |
841 __ j(greater, &loop_header, Label::kNear); | 841 __ j(greater, &loop_header, Label::kNear); |
842 } | 842 } |
843 | 843 |
844 } // end anonymous namespace | 844 } // end anonymous namespace |
845 | 845 |
846 // static | 846 // static |
847 void Builtins::Generate_InterpreterPushArgsAndConstructImpl( | 847 void Builtins::Generate_InterpreterPushArgsAndConstructImpl( |
848 MacroAssembler* masm, PushArgsConstructMode mode) { | 848 MacroAssembler* masm, InterpreterPushArgsMode mode) { |
849 // ----------- S t a t e ------------- | 849 // ----------- S t a t e ------------- |
850 // -- eax : the number of arguments (not including the receiver) | 850 // -- eax : the number of arguments (not including the receiver) |
851 // -- edx : the new target | 851 // -- edx : the new target |
852 // -- edi : the constructor | 852 // -- edi : the constructor |
853 // -- ebx : allocation site feedback (if available or undefined) | 853 // -- ebx : allocation site feedback (if available or undefined) |
854 // -- ecx : the address of the first argument to be pushed. Subsequent | 854 // -- ecx : the address of the first argument to be pushed. Subsequent |
855 // arguments should be consecutive above this, in the same order as | 855 // arguments should be consecutive above this, in the same order as |
856 // they are to be pushed onto the stack. | 856 // they are to be pushed onto the stack. |
857 // ----------------------------------- | 857 // ----------------------------------- |
858 Label stack_overflow; | 858 Label stack_overflow; |
859 // We need two scratch registers. Push edi and edx onto stack. | 859 // We need two scratch registers. Push edi and edx onto stack. |
860 __ Push(edi); | 860 __ Push(edi); |
861 __ Push(edx); | 861 __ Push(edx); |
862 | 862 |
863 // Push arguments and move return address to the top of stack. | 863 // Push arguments and move return address to the top of stack. |
864 // The eax register is readonly. The ecx register will be modified. The edx | 864 // The eax register is readonly. The ecx register will be modified. The edx |
865 // and edi registers will be modified but restored to their original values. | 865 // and edi registers will be modified but restored to their original values. |
866 Generate_InterpreterPushArgsAndReturnAddress(masm, eax, ecx, edx, edi, false, | 866 Generate_InterpreterPushArgsAndReturnAddress(masm, eax, ecx, edx, edi, false, |
867 2, &stack_overflow); | 867 2, &stack_overflow); |
868 | 868 |
869 // Restore edi and edx | 869 // Restore edi and edx |
870 __ Pop(edx); | 870 __ Pop(edx); |
871 __ Pop(edi); | 871 __ Pop(edi); |
872 | 872 |
873 __ AssertUndefinedOrAllocationSite(ebx); | 873 __ AssertUndefinedOrAllocationSite(ebx); |
874 if (mode == PushArgsConstructMode::kJSFunction) { | 874 if (mode == InterpreterPushArgsMode::kJSFunction) { |
875 // Tail call to the function-specific construct stub (still in the caller | 875 // Tail call to the function-specific construct stub (still in the caller |
876 // context at this point). | 876 // context at this point). |
877 __ AssertFunction(edi); | 877 __ AssertFunction(edi); |
878 | 878 |
879 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 879 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
880 __ mov(ecx, FieldOperand(ecx, SharedFunctionInfo::kConstructStubOffset)); | 880 __ mov(ecx, FieldOperand(ecx, SharedFunctionInfo::kConstructStubOffset)); |
881 __ lea(ecx, FieldOperand(ecx, Code::kHeaderSize)); | 881 __ lea(ecx, FieldOperand(ecx, Code::kHeaderSize)); |
882 __ jmp(ecx); | 882 __ jmp(ecx); |
883 } else if (mode == PushArgsConstructMode::kWithFinalSpread) { | 883 } else if (mode == InterpreterPushArgsMode::kWithFinalSpread) { |
884 // Call the constructor with unmodified eax, edi, edx values. | 884 // Call the constructor with unmodified eax, edi, edx values. |
885 __ Jump(masm->isolate()->builtins()->ConstructWithSpread(), | 885 __ Jump(masm->isolate()->builtins()->ConstructWithSpread(), |
886 RelocInfo::CODE_TARGET); | 886 RelocInfo::CODE_TARGET); |
887 } else { | 887 } else { |
888 DCHECK_EQ(PushArgsConstructMode::kOther, mode); | 888 DCHECK_EQ(InterpreterPushArgsMode::kOther, mode); |
889 // Call the constructor with unmodified eax, edi, edx values. | 889 // Call the constructor with unmodified eax, edi, edx values. |
890 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 890 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
891 } | 891 } |
892 | 892 |
893 __ bind(&stack_overflow); | 893 __ bind(&stack_overflow); |
894 { | 894 { |
895 // Pop the temporary registers, so that return address is on top of stack. | 895 // Pop the temporary registers, so that return address is on top of stack. |
896 __ Pop(edx); | 896 __ Pop(edx); |
897 __ Pop(edi); | 897 __ Pop(edi); |
898 | 898 |
(...skipping 2423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3322 | 3322 |
3323 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 3323 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
3324 Generate_OnStackReplacementHelper(masm, true); | 3324 Generate_OnStackReplacementHelper(masm, true); |
3325 } | 3325 } |
3326 | 3326 |
3327 #undef __ | 3327 #undef __ |
3328 } // namespace internal | 3328 } // namespace internal |
3329 } // namespace v8 | 3329 } // namespace v8 |
3330 | 3330 |
3331 #endif // V8_TARGET_ARCH_X87 | 3331 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |