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 // stack_space * kPointerSize bytes will be removed from stack after the call. |
antonm
2010/11/17 10:23:08
there is no statck_space any more, please, rework
SeRya
2010/11/17 10:29:28
Done.
| |
841 // of arguments to be passed in C-function. stack_space * kPointerSize bytes | 845 // Saves context (rsi). Clobbers rax. Allocates arg_stack_space * kPointerSize |
842 // will be removed from stack after the call. Saves context (rsi). | 846 // inside the exit frame (not GCed) accessible via StackSpaceOperand. |
843 // Clobbers rax. Allocates arg_stack_space * kPointerSize inside the exit | 847 void PrepareCallApiFunction(int arg_stack_space); |
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 | 848 |
850 // Calls an API function. Allocates HandleScope, extracts | 849 // Calls an API function. Allocates HandleScope, extracts |
851 // returned value from handle and propagates exceptions. | 850 // returned value from handle and propagates exceptions. |
852 // Clobbers r12, r14, rbx and caller-save registers. Restores context. | 851 // Clobbers r12, r14, rbx and caller-save registers. Restores context. |
852 // On return removes stack_space * kPointerSize (GCed). | |
853 MUST_USE_RESULT MaybeObject* TryCallApiFunctionAndReturn( | 853 MUST_USE_RESULT MaybeObject* TryCallApiFunctionAndReturn( |
854 ApiFunction* function); | 854 ApiFunction* function, int stack_space); |
855 | 855 |
856 // Before calling a C-function from generated code, align arguments on stack. | 856 // 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], | 857 // 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. | 858 // 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 | 859 // 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 | 860 // stack slots are reserved for the arguments passed in registers. On other |
861 // platforms stack slots are only reserved for the arguments actually passed | 861 // platforms stack slots are only reserved for the arguments actually passed |
862 // on the stack. | 862 // on the stack. |
863 void PrepareCallCFunction(int num_arguments); | 863 void PrepareCallCFunction(int num_arguments); |
864 | 864 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
940 // Activation support. | 940 // Activation support. |
941 void EnterFrame(StackFrame::Type type); | 941 void EnterFrame(StackFrame::Type type); |
942 void LeaveFrame(StackFrame::Type type); | 942 void LeaveFrame(StackFrame::Type type); |
943 | 943 |
944 void EnterExitFramePrologue(bool save_rax); | 944 void EnterExitFramePrologue(bool save_rax); |
945 | 945 |
946 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack | 946 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack |
947 // accessible via StackSpaceOperand. | 947 // accessible via StackSpaceOperand. |
948 void EnterExitFrameEpilogue(int arg_stack_space); | 948 void EnterExitFrameEpilogue(int arg_stack_space); |
949 | 949 |
950 void LeaveExitFrameEpilogue(); | |
951 | |
950 // Allocation support helpers. | 952 // Allocation support helpers. |
951 // Loads the top of new-space into the result register. | 953 // Loads the top of new-space into the result register. |
952 // If flags contains RESULT_CONTAINS_TOP then result_end is valid and | 954 // If flags contains RESULT_CONTAINS_TOP then result_end is valid and |
953 // already contains the top of new-space, and scratch is invalid. | 955 // 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 | 956 // 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. | 957 // scratch is valid), and the new-space top is loaded into result. |
956 void LoadAllocationTopHelper(Register result, | 958 void LoadAllocationTopHelper(Register result, |
957 Register result_end, | 959 Register result_end, |
958 Register scratch, | 960 Register scratch, |
959 AllocationFlags flags); | 961 AllocationFlags flags); |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1739 Jump(adaptor, RelocInfo::CODE_TARGET); | 1741 Jump(adaptor, RelocInfo::CODE_TARGET); |
1740 } | 1742 } |
1741 bind(&invoke); | 1743 bind(&invoke); |
1742 } | 1744 } |
1743 } | 1745 } |
1744 | 1746 |
1745 | 1747 |
1746 } } // namespace v8::internal | 1748 } } // namespace v8::internal |
1747 | 1749 |
1748 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1750 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |