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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); } | 157 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); } |
158 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); } | 158 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); } |
159 | 159 |
160 // Enter specific kind of exit frame; either in normal or | 160 // Enter specific kind of exit frame; either in normal or |
161 // debug mode. Expects the number of arguments in register rax and | 161 // debug mode. Expects the number of arguments in register rax and |
162 // sets up the number of arguments in register rdi and the pointer | 162 // sets up the number of arguments in register rdi and the pointer |
163 // to the first argument in register rsi. | 163 // to the first argument in register rsi. |
164 void EnterExitFrame(ExitFrame::Mode mode, int result_size = 1); | 164 void EnterExitFrame(ExitFrame::Mode mode, int result_size = 1); |
165 | 165 |
| 166 void EnterApiExitFrame(ExitFrame::Mode mode, |
| 167 int stack_space, |
| 168 int argc, |
| 169 int result_size = 1); |
| 170 |
166 // Leave the current exit frame. Expects/provides the return value in | 171 // Leave the current exit frame. Expects/provides the return value in |
167 // register rax:rdx (untouched) and the pointer to the first | 172 // register rax:rdx (untouched) and the pointer to the first |
168 // argument in register rsi. | 173 // argument in register rsi. |
169 void LeaveExitFrame(ExitFrame::Mode mode, int result_size = 1); | 174 void LeaveExitFrame(ExitFrame::Mode mode, int result_size = 1); |
170 | 175 |
171 | 176 |
172 // --------------------------------------------------------------------------- | 177 // --------------------------------------------------------------------------- |
173 // JavaScript invokes | 178 // JavaScript invokes |
174 | 179 |
175 // Invoke the JavaScript function code by either calling or jumping. | 180 // Invoke the JavaScript function code by either calling or jumping. |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 | 717 |
713 // Find the function context up the context chain. | 718 // Find the function context up the context chain. |
714 void LoadContext(Register dst, int context_chain_length); | 719 void LoadContext(Register dst, int context_chain_length); |
715 | 720 |
716 // --------------------------------------------------------------------------- | 721 // --------------------------------------------------------------------------- |
717 // Runtime calls | 722 // Runtime calls |
718 | 723 |
719 // Call a code stub. | 724 // Call a code stub. |
720 void CallStub(CodeStub* stub); | 725 void CallStub(CodeStub* stub); |
721 | 726 |
| 727 // Call a code stub and return the code object called. Try to generate |
| 728 // the code if necessary. Do not perform a GC but instead return a retry |
| 729 // after GC failure. |
| 730 Object* TryCallStub(CodeStub* stub); |
| 731 |
722 // Tail call a code stub (jump). | 732 // Tail call a code stub (jump). |
723 void TailCallStub(CodeStub* stub); | 733 void TailCallStub(CodeStub* stub); |
724 | 734 |
| 735 // Tail call a code stub (jump) and return the code object called. Try to |
| 736 // generate the code if necessary. Do not perform a GC but instead return |
| 737 // a retry after GC failure. |
| 738 Object* TryTailCallStub(CodeStub* stub); |
| 739 |
725 // Return from a code stub after popping its arguments. | 740 // Return from a code stub after popping its arguments. |
726 void StubReturn(int argc); | 741 void StubReturn(int argc); |
727 | 742 |
728 // Call a runtime routine. | 743 // Call a runtime routine. |
729 void CallRuntime(Runtime::Function* f, int num_arguments); | 744 void CallRuntime(Runtime::Function* f, int num_arguments); |
730 | 745 |
| 746 // Call a runtime function, returning the CodeStub object called. |
| 747 // Try to generate the stub code if necessary. Do not perform a GC |
| 748 // but instead return a retry after GC failure. |
| 749 Object* TryCallRuntime(Runtime::Function* f, int num_arguments); |
| 750 |
731 // Convenience function: Same as above, but takes the fid instead. | 751 // Convenience function: Same as above, but takes the fid instead. |
732 void CallRuntime(Runtime::FunctionId id, int num_arguments); | 752 void CallRuntime(Runtime::FunctionId id, int num_arguments); |
733 | 753 |
| 754 // Convenience function: Same as above, but takes the fid instead. |
| 755 Object* TryCallRuntime(Runtime::FunctionId id, int num_arguments); |
| 756 |
734 // Convenience function: call an external reference. | 757 // Convenience function: call an external reference. |
735 void CallExternalReference(const ExternalReference& ext, | 758 void CallExternalReference(const ExternalReference& ext, |
736 int num_arguments); | 759 int num_arguments); |
737 | 760 |
738 // Tail call of a runtime routine (jump). | 761 // Tail call of a runtime routine (jump). |
739 // Like JumpToExternalReference, but also takes care of passing the number | 762 // Like JumpToExternalReference, but also takes care of passing the number |
740 // of parameters. | 763 // of parameters. |
741 void TailCallExternalReference(const ExternalReference& ext, | 764 void TailCallExternalReference(const ExternalReference& ext, |
742 int num_arguments, | 765 int num_arguments, |
743 int result_size); | 766 int result_size); |
744 | 767 |
745 // Convenience function: tail call a runtime routine (jump). | 768 // Convenience function: tail call a runtime routine (jump). |
746 void TailCallRuntime(Runtime::FunctionId fid, | 769 void TailCallRuntime(Runtime::FunctionId fid, |
747 int num_arguments, | 770 int num_arguments, |
748 int result_size); | 771 int result_size); |
749 | 772 |
| 773 void PushHandleScope(Register scratch); |
| 774 |
| 775 // Pops a handle scope using the specified scratch register and |
| 776 // ensuring that saved register is left unchanged. |
| 777 void PopHandleScope(Register saved, Register scratch); |
| 778 |
| 779 // As PopHandleScope, but does not perform a GC. Instead, returns a |
| 780 // retry after GC failure object if GC is necessary. |
| 781 Object* TryPopHandleScope(Register saved, Register scratch); |
| 782 |
750 // Jump to a runtime routine. | 783 // Jump to a runtime routine. |
751 void JumpToExternalReference(const ExternalReference& ext, int result_size); | 784 void JumpToExternalReference(const ExternalReference& ext, int result_size); |
752 | 785 |
753 // Before calling a C-function from generated code, align arguments on stack. | 786 // Before calling a C-function from generated code, align arguments on stack. |
754 // After aligning the frame, arguments must be stored in esp[0], esp[4], | 787 // After aligning the frame, arguments must be stored in esp[0], esp[4], |
755 // etc., not pushed. The argument count assumes all arguments are word sized. | 788 // etc., not pushed. The argument count assumes all arguments are word sized. |
756 // The number of slots reserved for arguments depends on platform. On Windows | 789 // The number of slots reserved for arguments depends on platform. On Windows |
757 // stack slots are reserved for the arguments passed in registers. On other | 790 // stack slots are reserved for the arguments passed in registers. On other |
758 // platforms stack slots are only reserved for the arguments actually passed | 791 // platforms stack slots are only reserved for the arguments actually passed |
759 // on the stack. | 792 // on the stack. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 const ParameterCount& actual, | 861 const ParameterCount& actual, |
829 Handle<Code> code_constant, | 862 Handle<Code> code_constant, |
830 Register code_register, | 863 Register code_register, |
831 Label* done, | 864 Label* done, |
832 InvokeFlag flag); | 865 InvokeFlag flag); |
833 | 866 |
834 // Activation support. | 867 // Activation support. |
835 void EnterFrame(StackFrame::Type type); | 868 void EnterFrame(StackFrame::Type type); |
836 void LeaveFrame(StackFrame::Type type); | 869 void LeaveFrame(StackFrame::Type type); |
837 | 870 |
| 871 void EnterExitFramePrologue(ExitFrame::Mode mode, bool save_rax); |
| 872 void EnterExitFrameEpilogue(ExitFrame::Mode mode, int result_size, int argc); |
| 873 |
838 // Allocation support helpers. | 874 // Allocation support helpers. |
839 // Loads the top of new-space into the result register. | 875 // Loads the top of new-space into the result register. |
840 // If flags contains RESULT_CONTAINS_TOP then result_end is valid and | 876 // If flags contains RESULT_CONTAINS_TOP then result_end is valid and |
841 // already contains the top of new-space, and scratch is invalid. | 877 // already contains the top of new-space, and scratch is invalid. |
842 // Otherwise the address of the new-space top is loaded into scratch (if | 878 // Otherwise the address of the new-space top is loaded into scratch (if |
843 // scratch is valid), and the new-space top is loaded into result. | 879 // scratch is valid), and the new-space top is loaded into result. |
844 void LoadAllocationTopHelper(Register result, | 880 void LoadAllocationTopHelper(Register result, |
845 Register result_end, | 881 Register result_end, |
846 Register scratch, | 882 Register scratch, |
847 AllocationFlags flags); | 883 AllocationFlags flags); |
848 // Update allocation top with value in result_end register. | 884 // Update allocation top with value in result_end register. |
849 // If scratch is valid, it contains the address of the allocation top. | 885 // If scratch is valid, it contains the address of the allocation top. |
850 void UpdateAllocationTopHelper(Register result_end, Register scratch); | 886 void UpdateAllocationTopHelper(Register result_end, Register scratch); |
| 887 |
| 888 // Helper for PopHandleScope. Allowed to perform a GC and returns |
| 889 // NULL if gc_allowed. Does not perform a GC if !gc_allowed, and |
| 890 // possibly returns a failure object indicating an allocation failure. |
| 891 Object* PopHandleScopeHelper(Register saved, |
| 892 Register scratch, |
| 893 bool gc_allowed); |
851 }; | 894 }; |
852 | 895 |
853 | 896 |
854 // The code patcher is used to patch (typically) small parts of code e.g. for | 897 // The code patcher is used to patch (typically) small parts of code e.g. for |
855 // debugging and other types of instrumentation. When using the code patcher | 898 // debugging and other types of instrumentation. When using the code patcher |
856 // the exact number of bytes specified must be emitted. Is not legal to emit | 899 // the exact number of bytes specified must be emitted. Is not legal to emit |
857 // relocation information. If any of these constraints are violated it causes | 900 // relocation information. If any of these constraints are violated it causes |
858 // an assertion. | 901 // an assertion. |
859 class CodePatcher { | 902 class CodePatcher { |
860 public: | 903 public: |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 } \ | 950 } \ |
908 masm-> | 951 masm-> |
909 #else | 952 #else |
910 #define ACCESS_MASM(masm) masm-> | 953 #define ACCESS_MASM(masm) masm-> |
911 #endif | 954 #endif |
912 | 955 |
913 | 956 |
914 } } // namespace v8::internal | 957 } } // namespace v8::internal |
915 | 958 |
916 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 959 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |