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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 // Enter specific kind of exit frame; either in normal or | 154 // Enter specific kind of exit frame; either in normal or |
155 // debug mode. Expects the number of arguments in register rax and | 155 // debug mode. Expects the number of arguments in register rax and |
156 // sets up the number of arguments in register rdi and the pointer | 156 // sets up the number of arguments in register rdi and the pointer |
157 // to the first argument in register rsi. | 157 // to the first argument in register rsi. |
158 // | 158 // |
159 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack | 159 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack |
160 // accessible via StackSpaceOperand. | 160 // accessible via StackSpaceOperand. |
161 void EnterExitFrame(int arg_stack_space = 0); | 161 void EnterExitFrame(int arg_stack_space = 0); |
162 | 162 |
163 void EnterApiExitFrame(int stack_space, | 163 // Enter specific kind of exit frame. Allocates arg_stack_space * kPointerSize |
164 int arg_stack_space); | 164 // memory (not GCed) on the stack accessible via StackSpaceOperand. |
| 165 void EnterApiExitFrame(int arg_stack_space); |
165 | 166 |
166 // Leave the current exit frame. Expects/provides the return value in | 167 // Leave the current exit frame. Expects/provides the return value in |
167 // register rax:rdx (untouched) and the pointer to the first | 168 // register rax:rdx (untouched) and the pointer to the first |
168 // argument in register rsi. | 169 // argument in register rsi. |
169 void LeaveExitFrame(int result_size = 1); | 170 void LeaveExitFrame(); |
170 | 171 |
| 172 // Leave the current exit frame. Expects/provides the return value in |
| 173 // register rax (untouched). |
| 174 void LeaveApiExitFrame(); |
171 | 175 |
172 // --------------------------------------------------------------------------- | 176 // --------------------------------------------------------------------------- |
173 // JavaScript invokes | 177 // JavaScript invokes |
174 | 178 |
175 // Invoke the JavaScript function code by either calling or jumping. | 179 // Invoke the JavaScript function code by either calling or jumping. |
176 void InvokeCode(Register code, | 180 void InvokeCode(Register code, |
177 const ParameterCount& expected, | 181 const ParameterCount& expected, |
178 const ParameterCount& actual, | 182 const ParameterCount& actual, |
179 InvokeFlag flag); | 183 InvokeFlag flag); |
180 | 184 |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 int result_size); | 832 int result_size); |
829 | 833 |
830 // Jump to a runtime routine. | 834 // Jump to a runtime routine. |
831 void JumpToExternalReference(const ExternalReference& ext, int result_size); | 835 void JumpToExternalReference(const ExternalReference& ext, int result_size); |
832 | 836 |
833 // Jump to a runtime routine. | 837 // Jump to a runtime routine. |
834 MaybeObject* TryJumpToExternalReference(const ExternalReference& ext, | 838 MaybeObject* TryJumpToExternalReference(const ExternalReference& ext, |
835 int result_size); | 839 int result_size); |
836 | 840 |
837 // Prepares stack to put arguments (aligns and so on). | 841 // Prepares stack to put arguments (aligns and so on). |
838 // Uses callee-saved rsi to restore stack state after call. WIN64 calling | 842 // WIN64 calling convention requires to put the pointer to the return value |
839 // convention requires to put the pointer to the return value slot into rcx | 843 // slot into rcx (rcx must be preserverd until TryCallApiFunctionAndReturn). |
840 // (rcx must be preserverd until TryCallApiFunctionAndReturn). argc is number | 844 // Saves context (rsi). Clobbers rax. Allocates arg_stack_space * kPointerSize |
841 // of arguments to be passed in C-function. stack_space * kPointerSize bytes | 845 // inside the exit frame (not GCed) accessible via StackSpaceOperand. |
842 // will be removed from stack after the call. Saves context (rsi). | 846 void PrepareCallApiFunction(int arg_stack_space); |
843 // Clobbers rax. Allocates arg_stack_space * kPointerSize inside the exit | |
844 // frame (not GCed). | |
845 // | |
846 // Assumes stack_space GCed references on top of the stack and return address. | |
847 // After call they will be removed. | |
848 void PrepareCallApiFunction(int stack_space, int arg_stack_space); | |
849 | 847 |
850 // Calls an API function. Allocates HandleScope, extracts | 848 // Calls an API function. Allocates HandleScope, extracts |
851 // returned value from handle and propagates exceptions. | 849 // returned value from handle and propagates exceptions. |
852 // Clobbers r12, r14, rbx and caller-save registers. Restores context. | 850 // Clobbers r12, r14, rbx and caller-save registers. Restores context. |
| 851 // On return removes stack_space * kPointerSize (GCed). |
853 MUST_USE_RESULT MaybeObject* TryCallApiFunctionAndReturn( | 852 MUST_USE_RESULT MaybeObject* TryCallApiFunctionAndReturn( |
854 ApiFunction* function); | 853 ApiFunction* function, int stack_space); |
855 | 854 |
856 // Before calling a C-function from generated code, align arguments on stack. | 855 // Before calling a C-function from generated code, align arguments on stack. |
857 // After aligning the frame, arguments must be stored in esp[0], esp[4], | 856 // After aligning the frame, arguments must be stored in esp[0], esp[4], |
858 // etc., not pushed. The argument count assumes all arguments are word sized. | 857 // etc., not pushed. The argument count assumes all arguments are word sized. |
859 // The number of slots reserved for arguments depends on platform. On Windows | 858 // The number of slots reserved for arguments depends on platform. On Windows |
860 // stack slots are reserved for the arguments passed in registers. On other | 859 // stack slots are reserved for the arguments passed in registers. On other |
861 // platforms stack slots are only reserved for the arguments actually passed | 860 // platforms stack slots are only reserved for the arguments actually passed |
862 // on the stack. | 861 // on the stack. |
863 void PrepareCallCFunction(int num_arguments); | 862 void PrepareCallCFunction(int num_arguments); |
864 | 863 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 // Activation support. | 939 // Activation support. |
941 void EnterFrame(StackFrame::Type type); | 940 void EnterFrame(StackFrame::Type type); |
942 void LeaveFrame(StackFrame::Type type); | 941 void LeaveFrame(StackFrame::Type type); |
943 | 942 |
944 void EnterExitFramePrologue(bool save_rax); | 943 void EnterExitFramePrologue(bool save_rax); |
945 | 944 |
946 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack | 945 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack |
947 // accessible via StackSpaceOperand. | 946 // accessible via StackSpaceOperand. |
948 void EnterExitFrameEpilogue(int arg_stack_space); | 947 void EnterExitFrameEpilogue(int arg_stack_space); |
949 | 948 |
| 949 void LeaveExitFrameEpilogue(); |
| 950 |
950 // Allocation support helpers. | 951 // Allocation support helpers. |
951 // Loads the top of new-space into the result register. | 952 // Loads the top of new-space into the result register. |
952 // If flags contains RESULT_CONTAINS_TOP then result_end is valid and | 953 // If flags contains RESULT_CONTAINS_TOP then result_end is valid and |
953 // already contains the top of new-space, and scratch is invalid. | 954 // already contains the top of new-space, and scratch is invalid. |
954 // Otherwise the address of the new-space top is loaded into scratch (if | 955 // Otherwise the address of the new-space top is loaded into scratch (if |
955 // scratch is valid), and the new-space top is loaded into result. | 956 // scratch is valid), and the new-space top is loaded into result. |
956 void LoadAllocationTopHelper(Register result, | 957 void LoadAllocationTopHelper(Register result, |
957 Register result_end, | 958 Register result_end, |
958 Register scratch, | 959 Register scratch, |
959 AllocationFlags flags); | 960 AllocationFlags flags); |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1739 Jump(adaptor, RelocInfo::CODE_TARGET); | 1740 Jump(adaptor, RelocInfo::CODE_TARGET); |
1740 } | 1741 } |
1741 bind(&invoke); | 1742 bind(&invoke); |
1742 } | 1743 } |
1743 } | 1744 } |
1744 | 1745 |
1745 | 1746 |
1746 } } // namespace v8::internal | 1747 } } // namespace v8::internal |
1747 | 1748 |
1748 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1749 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |