Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: src/x64/macro-assembler-x64.h

Issue 5188006: Push version 2.5.7 to trunk.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 void EnterInternalFrame() { EnterFrame(StackFrame::INTERNAL); } 148 void EnterInternalFrame() { EnterFrame(StackFrame::INTERNAL); }
149 void LeaveInternalFrame() { LeaveFrame(StackFrame::INTERNAL); } 149 void LeaveInternalFrame() { LeaveFrame(StackFrame::INTERNAL); }
150 150
151 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); } 151 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); }
152 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); } 152 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); }
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 void EnterExitFrame(int result_size = 1); 158 //
159 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack
160 // accessible via StackSpaceOperand.
161 void EnterExitFrame(int arg_stack_space = 0);
159 162
160 void EnterApiExitFrame(int stack_space, 163 // Enter specific kind of exit frame. Allocates arg_stack_space * kPointerSize
161 int argc, 164 // memory (not GCed) on the stack accessible via StackSpaceOperand.
162 int result_size = 1); 165 void EnterApiExitFrame(int arg_stack_space);
163 166
164 // Leave the current exit frame. Expects/provides the return value in 167 // Leave the current exit frame. Expects/provides the return value in
165 // register rax:rdx (untouched) and the pointer to the first 168 // register rax:rdx (untouched) and the pointer to the first
166 // argument in register rsi. 169 // argument in register rsi.
167 void LeaveExitFrame(int result_size = 1); 170 void LeaveExitFrame();
168 171
172 // Leave the current exit frame. Expects/provides the return value in
173 // register rax (untouched).
174 void LeaveApiExitFrame();
169 175
170 // --------------------------------------------------------------------------- 176 // ---------------------------------------------------------------------------
171 // JavaScript invokes 177 // JavaScript invokes
172 178
173 // Invoke the JavaScript function code by either calling or jumping. 179 // Invoke the JavaScript function code by either calling or jumping.
174 void InvokeCode(Register code, 180 void InvokeCode(Register code,
175 const ParameterCount& expected, 181 const ParameterCount& expected,
176 const ParameterCount& actual, 182 const ParameterCount& actual,
177 InvokeFlag flag); 183 InvokeFlag flag);
178 184
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 void CallExternalReference(const ExternalReference& ext, 812 void CallExternalReference(const ExternalReference& ext,
807 int num_arguments); 813 int num_arguments);
808 814
809 // Tail call of a runtime routine (jump). 815 // Tail call of a runtime routine (jump).
810 // Like JumpToExternalReference, but also takes care of passing the number 816 // Like JumpToExternalReference, but also takes care of passing the number
811 // of parameters. 817 // of parameters.
812 void TailCallExternalReference(const ExternalReference& ext, 818 void TailCallExternalReference(const ExternalReference& ext,
813 int num_arguments, 819 int num_arguments,
814 int result_size); 820 int result_size);
815 821
822 MUST_USE_RESULT MaybeObject* TryTailCallExternalReference(
823 const ExternalReference& ext, int num_arguments, int result_size);
824
816 // Convenience function: tail call a runtime routine (jump). 825 // Convenience function: tail call a runtime routine (jump).
817 void TailCallRuntime(Runtime::FunctionId fid, 826 void TailCallRuntime(Runtime::FunctionId fid,
818 int num_arguments, 827 int num_arguments,
819 int result_size); 828 int result_size);
820 829
830 MUST_USE_RESULT MaybeObject* TryTailCallRuntime(Runtime::FunctionId fid,
831 int num_arguments,
832 int result_size);
833
821 // Jump to a runtime routine. 834 // Jump to a runtime routine.
822 void JumpToExternalReference(const ExternalReference& ext, int result_size); 835 void JumpToExternalReference(const ExternalReference& ext, int result_size);
823 836
837 // Jump to a runtime routine.
838 MaybeObject* TryJumpToExternalReference(const ExternalReference& ext,
839 int result_size);
840
824 // Prepares stack to put arguments (aligns and so on). 841 // Prepares stack to put arguments (aligns and so on).
825 // Uses calle-saved esi to restore stack state after call. 842 // WIN64 calling convention requires to put the pointer to the return value
826 void PrepareCallApiFunction(int stack_space); 843 // slot into rcx (rcx must be preserverd until TryCallApiFunctionAndReturn).
844 // Saves context (rsi). Clobbers rax. Allocates arg_stack_space * kPointerSize
845 // inside the exit frame (not GCed) accessible via StackSpaceOperand.
846 void PrepareCallApiFunction(int arg_stack_space);
827 847
828 // Tail call an API function (jump). Allocates HandleScope, extracts 848 // Calls an API function. Allocates HandleScope, extracts
829 // returned value from handle and propogates exceptions. 849 // returned value from handle and propagates exceptions.
830 // Clobbers ebx, edi and caller-save registers. 850 // Clobbers r12, r14, rbx and caller-save registers. Restores context.
831 void CallApiFunctionAndReturn(ApiFunction* function); 851 // On return removes stack_space * kPointerSize (GCed).
852 MUST_USE_RESULT MaybeObject* TryCallApiFunctionAndReturn(
853 ApiFunction* function, int stack_space);
832 854
833 // 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.
834 // 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],
835 // 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.
836 // 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
837 // 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
838 // platforms stack slots are only reserved for the arguments actually passed 860 // platforms stack slots are only reserved for the arguments actually passed
839 // on the stack. 861 // on the stack.
840 void PrepareCallCFunction(int num_arguments); 862 void PrepareCallCFunction(int num_arguments);
841 863
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 Handle<Code> code_constant, 934 Handle<Code> code_constant,
913 Register code_register, 935 Register code_register,
914 LabelType* done, 936 LabelType* done,
915 InvokeFlag flag); 937 InvokeFlag flag);
916 938
917 // Activation support. 939 // Activation support.
918 void EnterFrame(StackFrame::Type type); 940 void EnterFrame(StackFrame::Type type);
919 void LeaveFrame(StackFrame::Type type); 941 void LeaveFrame(StackFrame::Type type);
920 942
921 void EnterExitFramePrologue(bool save_rax); 943 void EnterExitFramePrologue(bool save_rax);
922 void EnterExitFrameEpilogue(int result_size, int argc); 944
945 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack
946 // accessible via StackSpaceOperand.
947 void EnterExitFrameEpilogue(int arg_stack_space);
948
949 void LeaveExitFrameEpilogue();
923 950
924 // Allocation support helpers. 951 // Allocation support helpers.
925 // Loads the top of new-space into the result register. 952 // Loads the top of new-space into the result register.
926 // 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
927 // already contains the top of new-space, and scratch is invalid. 954 // already contains the top of new-space, and scratch is invalid.
928 // 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
929 // 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.
930 void LoadAllocationTopHelper(Register result, 957 void LoadAllocationTopHelper(Register result,
931 Register result_end, 958 Register result_end,
932 Register scratch, 959 Register scratch,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 1002
976 // Generate an Operand for loading an indexed field from an object. 1003 // Generate an Operand for loading an indexed field from an object.
977 static inline Operand FieldOperand(Register object, 1004 static inline Operand FieldOperand(Register object,
978 Register index, 1005 Register index,
979 ScaleFactor scale, 1006 ScaleFactor scale,
980 int offset) { 1007 int offset) {
981 return Operand(object, index, scale, offset - kHeapObjectTag); 1008 return Operand(object, index, scale, offset - kHeapObjectTag);
982 } 1009 }
983 1010
984 1011
1012 static inline Operand ContextOperand(Register context, int index) {
1013 return Operand(context, Context::SlotOffset(index));
1014 }
1015
1016
1017 static inline Operand GlobalObjectOperand() {
1018 return ContextOperand(rsi, Context::GLOBAL_INDEX);
1019 }
1020
1021
1022 // Provides access to exit frame stack space (not GCed).
1023 static inline Operand StackSpaceOperand(int index) {
1024 #ifdef _WIN64
1025 const int kShaddowSpace = 4;
1026 return Operand(rsp, (index + kShaddowSpace) * kPointerSize);
1027 #else
1028 return Operand(rsp, index * kPointerSize);
1029 #endif
1030 }
1031
1032
1033
985 #ifdef GENERATED_CODE_COVERAGE 1034 #ifdef GENERATED_CODE_COVERAGE
986 extern void LogGeneratedCodeCoverage(const char* file_line); 1035 extern void LogGeneratedCodeCoverage(const char* file_line);
987 #define CODE_COVERAGE_STRINGIFY(x) #x 1036 #define CODE_COVERAGE_STRINGIFY(x) #x
988 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) 1037 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x)
989 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) 1038 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__)
990 #define ACCESS_MASM(masm) { \ 1039 #define ACCESS_MASM(masm) { \
991 byte* x64_coverage_function = \ 1040 byte* x64_coverage_function = \
992 reinterpret_cast<byte*>(FUNCTION_ADDR(LogGeneratedCodeCoverage)); \ 1041 reinterpret_cast<byte*>(FUNCTION_ADDR(LogGeneratedCodeCoverage)); \
993 masm->pushfd(); \ 1042 masm->pushfd(); \
994 masm->pushad(); \ 1043 masm->pushad(); \
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 Jump(adaptor, RelocInfo::CODE_TARGET); 1740 Jump(adaptor, RelocInfo::CODE_TARGET);
1692 } 1741 }
1693 bind(&invoke); 1742 bind(&invoke);
1694 } 1743 }
1695 } 1744 }
1696 1745
1697 1746
1698 } } // namespace v8::internal 1747 } } // namespace v8::internal
1699 1748
1700 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ 1749 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698