OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 CallKind call_kind); | 350 CallKind call_kind); |
351 | 351 |
352 // Invoke the JavaScript function in the given register. Changes the | 352 // Invoke the JavaScript function in the given register. Changes the |
353 // current context to the context in the function before invoking. | 353 // current context to the context in the function before invoking. |
354 void InvokeFunction(Register function, | 354 void InvokeFunction(Register function, |
355 const ParameterCount& actual, | 355 const ParameterCount& actual, |
356 InvokeFlag flag, | 356 InvokeFlag flag, |
357 const CallWrapper& call_wrapper, | 357 const CallWrapper& call_wrapper, |
358 CallKind call_kind); | 358 CallKind call_kind); |
359 | 359 |
360 void InvokeFunction(JSFunction* function, | 360 void InvokeFunction(Handle<JSFunction> function, |
361 const ParameterCount& actual, | 361 const ParameterCount& actual, |
362 InvokeFlag flag, | 362 InvokeFlag flag, |
363 const CallWrapper& call_wrapper, | 363 const CallWrapper& call_wrapper, |
364 CallKind call_kind); | 364 CallKind call_kind); |
365 | 365 |
366 // Invoke specified builtin JavaScript function. Adds an entry to | 366 // Invoke specified builtin JavaScript function. Adds an entry to |
367 // the unresolved list if the name does not resolve. | 367 // the unresolved list if the name does not resolve. |
368 void InvokeBuiltin(Builtins::JavaScript id, | 368 void InvokeBuiltin(Builtins::JavaScript id, |
369 InvokeFlag flag, | 369 InvokeFlag flag, |
370 const CallWrapper& call_wrapper = NullCallWrapper()); | 370 const CallWrapper& call_wrapper = NullCallWrapper()); |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 // Load the initial map from the global function. The registers | 1100 // Load the initial map from the global function. The registers |
1101 // function and map can be the same. | 1101 // function and map can be the same. |
1102 void LoadGlobalFunctionInitialMap(Register function, Register map); | 1102 void LoadGlobalFunctionInitialMap(Register function, Register map); |
1103 | 1103 |
1104 // --------------------------------------------------------------------------- | 1104 // --------------------------------------------------------------------------- |
1105 // Runtime calls | 1105 // Runtime calls |
1106 | 1106 |
1107 // Call a code stub. | 1107 // Call a code stub. |
1108 void CallStub(CodeStub* stub, unsigned ast_id = kNoASTId); | 1108 void CallStub(CodeStub* stub, unsigned ast_id = kNoASTId); |
1109 | 1109 |
1110 // Call a code stub and return the code object called. Try to generate | |
1111 // the code if necessary. Do not perform a GC but instead return a retry | |
1112 // after GC failure. | |
1113 MUST_USE_RESULT MaybeObject* TryCallStub(CodeStub* stub); | |
1114 | |
1115 // Tail call a code stub (jump). | 1110 // Tail call a code stub (jump). |
1116 void TailCallStub(CodeStub* stub); | 1111 void TailCallStub(CodeStub* stub); |
1117 | 1112 |
1118 // Tail call a code stub (jump) and return the code object called. Try to | |
1119 // generate the code if necessary. Do not perform a GC but instead return | |
1120 // a retry after GC failure. | |
1121 MUST_USE_RESULT MaybeObject* TryTailCallStub(CodeStub* stub); | |
1122 | |
1123 // Return from a code stub after popping its arguments. | 1113 // Return from a code stub after popping its arguments. |
1124 void StubReturn(int argc); | 1114 void StubReturn(int argc); |
1125 | 1115 |
1126 // Call a runtime routine. | 1116 // Call a runtime routine. |
1127 void CallRuntime(const Runtime::Function* f, int num_arguments); | 1117 void CallRuntime(const Runtime::Function* f, int num_arguments); |
1128 | 1118 |
1129 // Call a runtime function and save the value of XMM registers. | 1119 // Call a runtime function and save the value of XMM registers. |
1130 void CallRuntimeSaveDoubles(Runtime::FunctionId id); | 1120 void CallRuntimeSaveDoubles(Runtime::FunctionId id); |
1131 | 1121 |
1132 // Call a runtime function, returning the CodeStub object called. | |
1133 // Try to generate the stub code if necessary. Do not perform a GC | |
1134 // but instead return a retry after GC failure. | |
1135 MUST_USE_RESULT MaybeObject* TryCallRuntime(const Runtime::Function* f, | |
1136 int num_arguments); | |
1137 | |
1138 // Convenience function: Same as above, but takes the fid instead. | 1122 // Convenience function: Same as above, but takes the fid instead. |
1139 void CallRuntime(Runtime::FunctionId id, int num_arguments); | 1123 void CallRuntime(Runtime::FunctionId id, int num_arguments); |
1140 | 1124 |
1141 // Convenience function: Same as above, but takes the fid instead. | |
1142 MUST_USE_RESULT MaybeObject* TryCallRuntime(Runtime::FunctionId id, | |
1143 int num_arguments); | |
1144 | |
1145 // Convenience function: call an external reference. | 1125 // Convenience function: call an external reference. |
1146 void CallExternalReference(const ExternalReference& ext, | 1126 void CallExternalReference(const ExternalReference& ext, |
1147 int num_arguments); | 1127 int num_arguments); |
1148 | 1128 |
1149 // Tail call of a runtime routine (jump). | 1129 // Tail call of a runtime routine (jump). |
1150 // Like JumpToExternalReference, but also takes care of passing the number | 1130 // Like JumpToExternalReference, but also takes care of passing the number |
1151 // of parameters. | 1131 // of parameters. |
1152 void TailCallExternalReference(const ExternalReference& ext, | 1132 void TailCallExternalReference(const ExternalReference& ext, |
1153 int num_arguments, | 1133 int num_arguments, |
1154 int result_size); | 1134 int result_size); |
1155 | 1135 |
1156 MUST_USE_RESULT MaybeObject* TryTailCallExternalReference( | |
1157 const ExternalReference& ext, int num_arguments, int result_size); | |
1158 | |
1159 // Convenience function: tail call a runtime routine (jump). | 1136 // Convenience function: tail call a runtime routine (jump). |
1160 void TailCallRuntime(Runtime::FunctionId fid, | 1137 void TailCallRuntime(Runtime::FunctionId fid, |
1161 int num_arguments, | 1138 int num_arguments, |
1162 int result_size); | 1139 int result_size); |
1163 | 1140 |
1164 MUST_USE_RESULT MaybeObject* TryTailCallRuntime(Runtime::FunctionId fid, | |
1165 int num_arguments, | |
1166 int result_size); | |
1167 | |
1168 // Jump to a runtime routine. | 1141 // Jump to a runtime routine. |
1169 void JumpToExternalReference(const ExternalReference& ext, int result_size); | 1142 void JumpToExternalReference(const ExternalReference& ext, int result_size); |
1170 | 1143 |
1171 // Jump to a runtime routine. | 1144 // Prepares stack to put arguments (aligns and so on). WIN64 calling |
1172 MaybeObject* TryJumpToExternalReference(const ExternalReference& ext, | 1145 // convention requires to put the pointer to the return value slot into |
1173 int result_size); | 1146 // rcx (rcx must be preserverd until CallApiFunctionAndReturn). Saves |
1174 | 1147 // context (rsi). Clobbers rax. Allocates arg_stack_space * kPointerSize |
1175 // Prepares stack to put arguments (aligns and so on). | |
1176 // WIN64 calling convention requires to put the pointer to the return value | |
1177 // slot into rcx (rcx must be preserverd until TryCallApiFunctionAndReturn). | |
1178 // Saves context (rsi). Clobbers rax. Allocates arg_stack_space * kPointerSize | |
1179 // inside the exit frame (not GCed) accessible via StackSpaceOperand. | 1148 // inside the exit frame (not GCed) accessible via StackSpaceOperand. |
1180 void PrepareCallApiFunction(int arg_stack_space); | 1149 void PrepareCallApiFunction(int arg_stack_space); |
1181 | 1150 |
1182 // Calls an API function. Allocates HandleScope, extracts | 1151 // Calls an API function. Allocates HandleScope, extracts returned value |
1183 // returned value from handle and propagates exceptions. | 1152 // from handle and propagates exceptions. Clobbers r14, r15, rbx and |
1184 // Clobbers r14, r15, rbx and caller-save registers. Restores context. | 1153 // caller-save registers. Restores context. On return removes |
1185 // On return removes stack_space * kPointerSize (GCed). | 1154 // stack_space * kPointerSize (GCed). |
1186 MUST_USE_RESULT MaybeObject* TryCallApiFunctionAndReturn( | 1155 void CallApiFunctionAndReturn(Address function_address, int stack_space); |
1187 ApiFunction* function, int stack_space); | |
1188 | 1156 |
1189 // Before calling a C-function from generated code, align arguments on stack. | 1157 // Before calling a C-function from generated code, align arguments on stack. |
1190 // After aligning the frame, arguments must be stored in esp[0], esp[4], | 1158 // After aligning the frame, arguments must be stored in esp[0], esp[4], |
1191 // etc., not pushed. The argument count assumes all arguments are word sized. | 1159 // etc., not pushed. The argument count assumes all arguments are word sized. |
1192 // The number of slots reserved for arguments depends on platform. On Windows | 1160 // The number of slots reserved for arguments depends on platform. On Windows |
1193 // stack slots are reserved for the arguments passed in registers. On other | 1161 // stack slots are reserved for the arguments passed in registers. On other |
1194 // platforms stack slots are only reserved for the arguments actually passed | 1162 // platforms stack slots are only reserved for the arguments actually passed |
1195 // on the stack. | 1163 // on the stack. |
1196 void PrepareCallCFunction(int num_arguments); | 1164 void PrepareCallCFunction(int num_arguments); |
1197 | 1165 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 masm->popfd(); \ | 1415 masm->popfd(); \ |
1448 } \ | 1416 } \ |
1449 masm-> | 1417 masm-> |
1450 #else | 1418 #else |
1451 #define ACCESS_MASM(masm) masm-> | 1419 #define ACCESS_MASM(masm) masm-> |
1452 #endif | 1420 #endif |
1453 | 1421 |
1454 } } // namespace v8::internal | 1422 } } // namespace v8::internal |
1455 | 1423 |
1456 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1424 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |