OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 // - JSFunction* function ( | 749 // - JSFunction* function ( |
750 // - Object* receiver | 750 // - Object* receiver |
751 // - int argc | 751 // - int argc |
752 // - Object*** argv | 752 // - Object*** argv |
753 // (see Handle::Invoke in execution.cc). | 753 // (see Handle::Invoke in execution.cc). |
754 | 754 |
755 // Platform specific argument handling. After this, the stack contains | 755 // Platform specific argument handling. After this, the stack contains |
756 // an internal frame and the pushed function and receiver, and | 756 // an internal frame and the pushed function and receiver, and |
757 // register rax and rbx holds the argument count and argument array, | 757 // register rax and rbx holds the argument count and argument array, |
758 // while rdi holds the function pointer and rsi the context. | 758 // while rdi holds the function pointer and rsi the context. |
759 #ifdef __MSVC__ | 759 #ifdef _WIN64 |
760 // MSVC parameters in: | 760 // MSVC parameters in: |
761 // rcx : entry (ignored) | 761 // rcx : entry (ignored) |
762 // rdx : function | 762 // rdx : function |
763 // r8 : receiver | 763 // r8 : receiver |
764 // r9 : argc | 764 // r9 : argc |
765 // [rsp+0x20] : argv | 765 // [rsp+0x20] : argv |
766 | 766 |
767 // Clear the context before we push it when entering the JS frame. | 767 // Clear the context before we push it when entering the JS frame. |
768 __ xor_(rsi, rsi); | 768 __ xor_(rsi, rsi); |
769 // Enter an internal frame. | |
770 __ EnterInternalFrame(); | 769 __ EnterInternalFrame(); |
771 | 770 |
772 // Load the function context into rsi. | 771 // Load the function context into rsi. |
773 __ movq(rsi, FieldOperand(rdx, JSFunction::kContextOffset)); | 772 __ movq(rsi, FieldOperand(rdx, JSFunction::kContextOffset)); |
774 | 773 |
775 // Push the function and the receiver onto the stack. | 774 // Push the function and the receiver onto the stack. |
776 __ push(rdx); | 775 __ push(rdx); |
777 __ push(r8); | 776 __ push(r8); |
778 | 777 |
779 // Load the number of arguments and setup pointer to the arguments. | 778 // Load the number of arguments and setup pointer to the arguments. |
780 __ movq(rax, r9); | 779 __ movq(rax, r9); |
781 // Load the previous frame pointer to access C argument on stack | 780 // Load the previous frame pointer to access C argument on stack |
782 __ movq(kScratchRegister, Operand(rbp, 0)); | 781 __ movq(kScratchRegister, Operand(rbp, 0)); |
783 __ movq(rbx, Operand(kScratchRegister, EntryFrameConstants::kArgvOffset)); | 782 __ movq(rbx, Operand(kScratchRegister, EntryFrameConstants::kArgvOffset)); |
784 // Load the function pointer into rdi. | 783 // Load the function pointer into rdi. |
785 __ movq(rdi, rdx); | 784 __ movq(rdi, rdx); |
786 #else // !defined(__MSVC__) | 785 #else // !defined(_WIN64) |
787 // GCC parameters in: | 786 // GCC parameters in: |
788 // rdi : entry (ignored) | 787 // rdi : entry (ignored) |
789 // rsi : function | 788 // rsi : function |
790 // rdx : receiver | 789 // rdx : receiver |
791 // rcx : argc | 790 // rcx : argc |
792 // r8 : argv | 791 // r8 : argv |
793 | 792 |
794 __ movq(rdi, rsi); | 793 __ movq(rdi, rsi); |
795 // rdi : function | 794 // rdi : function |
796 | 795 |
797 // Clear the context before we push it when entering the JS frame. | 796 // Clear the context before we push it when entering the JS frame. |
798 __ xor_(rsi, rsi); | 797 __ xor_(rsi, rsi); |
799 // Enter an internal frame. | 798 // Enter an internal frame. |
800 __ EnterInternalFrame(); | 799 __ EnterInternalFrame(); |
801 | 800 |
802 // Push the function and receiver and setup the context. | 801 // Push the function and receiver and setup the context. |
803 __ push(rdi); | 802 __ push(rdi); |
804 __ push(rdx); | 803 __ push(rdx); |
805 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 804 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
806 | 805 |
807 // Load the number of arguments and setup pointer to the arguments. | 806 // Load the number of arguments and setup pointer to the arguments. |
808 __ movq(rax, rcx); | 807 __ movq(rax, rcx); |
809 __ movq(rbx, r8); | 808 __ movq(rbx, r8); |
810 #endif // __MSVC__ | 809 #endif // _WIN64 |
811 // Current stack contents: | 810 // Current stack contents: |
812 // [rsp + 2 * kPointerSize ... ]: Internal frame | 811 // [rsp + 2 * kPointerSize ... ]: Internal frame |
813 // [rsp + kPointerSize] : function | 812 // [rsp + kPointerSize] : function |
814 // [rsp] : receiver | 813 // [rsp] : receiver |
815 // Current register contents: | 814 // Current register contents: |
816 // rax : argc | 815 // rax : argc |
817 // rbx : argv | 816 // rbx : argv |
818 // rsi : context | 817 // rsi : context |
819 // rdi : function | 818 // rdi : function |
820 | 819 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { | 854 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { |
856 Generate_JSEntryTrampolineHelper(masm, false); | 855 Generate_JSEntryTrampolineHelper(masm, false); |
857 } | 856 } |
858 | 857 |
859 | 858 |
860 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { | 859 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { |
861 Generate_JSEntryTrampolineHelper(masm, true); | 860 Generate_JSEntryTrampolineHelper(masm, true); |
862 } | 861 } |
863 | 862 |
864 } } // namespace v8::internal | 863 } } // namespace v8::internal |
OLD | NEW |